Instructables

RGB LED Strip Circuit with Arduino

Picture of RGB LED Strip Circuit with Arduino
things.jpg
This Instructable covers the assembly of a circuit capable of PWM-ing (pulse width modulating) a high-power RGB LED strip and programming an Arduino to cycle through a range of colors. In this context, "high power" is 9-12 volts. I will discuss how to mount a transistor to a heatsink and assemble the circuit. I will not go into soldering as some of the RGB LED strip comes with leads (and there is no shortage of great tutorials out there). Also, I will use the most plain, non-jargony language possible to explain the circuit because I know how frustrating it can be to learn this stuff.

You will need:
- A Microcontroller
- Breadboard or PCB
- RGB LED strip
- Battery (9-12v)
- 3 NPN transistors (I'm using TIP 120s)
- LM7805 Voltage regulator (optional, but recommended)
- (4) 4-40 screws (length, up to you)
- (4) 4-40 nuts
- (4) nylon washers
- 22g hookup wire

Note 1: I am in no way affiliated with any of the companies mentioned or linked to, including Arduino, Jameco, Adafruit, and Sparkfun. I receive no compensation for the publication of this Instructable by any of the aforementioned companies.
 
Remove these adsRemove these ads by Signing Up

Step 1: Brief Explanation of the Electronics

If you are new to Arduino and are wondering why more than a few LEDs or other components like motors won't activate when functions are called in the code, its because each output has a current limit of 40mA. In other words, a component cannot draw more than 40mA of current from each channel. To refer to the water analogy of electronics, the "pump pressure" is 5V, and the amount of water is the number of electrons (measured in Amps, or in our case, a much smaller amount - milliamps, mA). To accommodate a load that requires more current than 40mA at 5V, we will use our microcontroller to control a transistor, which will provide a component with power from an external source (the battery).

Without getting too technical, its worth knowing that individual strips are made up of 3 LEDs in series which can be cut with clippers at any junction. If you want to cut the strip at any point, just be sure to leave connection points on each halve. To understand how the RGB LED strip can be powered with 9-12V, you need to know the difference between circuits in series vs. parallel (this page has a simple explanation with great illustrations, and there is a popular Instructable that covers wiring LEDs in series & parallel). Basically, when active components are connected in series, their supply voltages are added together. For example, since an average RGB LED requires 3.3 V and 60mA (at full brightness; each color channel draws 20mA, so R-G-B all on at same time is 20 x 3 = 60mA), each strip of 3 RGB LEDs will require approximately 9.9V (the strip I'm using from Jameco can be powered between 9-12V. Be sure to look at your product's datasheet to prevent frying your components. Not all RGB LED strip is powered in the 9-12V range, such as Adafruit's digitally addressable RGB LED strip). One more thing, these strips are "common anode," meaning the LEDs share a positive terminal (read about anode vs. cathode).

Perhaps the greatest take-away is the power limitation of the Arduino. The next section which shows how to use a transistor can be applied to all sorts of other components (ex. motors, solenoids, servos) that require more than 40mA at 5V.


Note: Since I mentioned digitally-addressable strips, its important to recognize a limitation of the strip I'm using - all of the LEDs will behave in the exact same way as you will see. Digitally-addressable RGB LEDs are pretty awesome in that each LED can be accessed individually (check out this cheesy/awesome video)
Dunky134 months ago

Could you upload your ATTiny85 code somewhere, currently I'm working on this but all I need right now is the tripple pwm :/

danm_daniel (author)  Dunky134 months ago

I have read that it is possible, though I have not been able to get it working. Would love to see some working code that allows for 3 PWM channels with the 85.

mbraverman7 months ago
I'm just wondering, Are you using PWM on your Attiny85?
danm_daniel (author)  mbraverman7 months ago
yes, but only 2 channels
That's Sad, I gueSs I would be better off using an AtTiny 84 for a similar project. Thanks.
emikayee8 months ago
I made this last night, works like a charm, thanks!
danm_daniel (author)  emikayee8 months ago
awesome!
If you remove the current limiting resistors that are used to protect the LEDs in 12V use, you can get full brightness at 9V.
LED Strip.jpg
remove and BYPASS I mean by soldering a wire in it's place.
danm_daniel (author)  SuperTech-IT1 year ago
Or you could save yourself the trouble and just work with discrete RGB LEDs.
Absolutely - but to work with them the way they are wired in these strips, they have to NOT be pre-wired with a common anything - they have to be the 6 lead LEDs like the ones on the strip - otherwise you can't put them in series.
If you use the 4 wire RGB LEDs, you would have to use higher value current limiters, and each tri-colour LED would have to be in parallel to the next one.
Ultimately I think the strips are easier to work with, plus they are flexible.
another option for power would be an atx power supply (ground the green pin to turn it on) and use the molex (red is +5v, yellow is +12v and black is ground, common to all outputs) for the arduino AND LED strip, as it is a regulated power supply, and if too much current it pulled or something is wrong, it auto shuts off. the reason i like this so much is because i have rgb leds in my case :D
danm_daniel (author)  iamdarkyoshi1 year ago
A power supply is definitely the way to go if your project is not mobile. I have bought a few inexpensive ones on Amazon (DC 12V 20A Regulated Switching Power Supply) for around $20, which is much less than what you'll see advertised in electronic supply magazines.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!