loading
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 9-12v RGB LED strip and programming an Arduino to cycle through a range of colors. I will discuss how to mount a transistor to a heatsink & assemble the circuit but won't get into soldering as some RGB LED strips come with leads (and there is no shortage of great tutorials out there).

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

Step 1: Brief Explanation of the Electronics

Picture of Brief Explanation of the Electronics
hookup.jpg
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)
 
El Mano4 days ago

You have 12v going into the collector of your transistor and 5v from the arduino going into the base. On common transistors, this won't open the transistor to saturation and will impede full current flow. Do the Tip120's not care about this?

danm_daniel (author)  El Mano4 days ago
The Tip120 allows up to 5A to flow from the collector (12V here) when the base is activated (minimum 0.6V).

This tutorial explains the application of the Tip120 in a little more detail: use a transistor to control a high current load.
efritz094 months ago

FYI, if you're going to use a BJT, you need a current limiting resistor between the microcontroller and the base of the transistor. Without it you risk damaging the microcontroller.

I know this is post quite old but I'm working on a similar project and what would do you think should I put the value of the resistor? I'm also experiencing other problems here is the link to my questions

http://www.instructables.com/answers/Why-is-my-RGB...

kpelle401 month ago

Can this circuit in combination with the correct program be used to activate the leds in sequence ? or would there need to be a time element along with this circuit ? If so any suggestions ?

danm_daniel (author)  kpelle401 month ago

No, you would need shift registers in between each LED. Alternatively, you can check out Adafruit's NeoPixel strips (awesome).

haha thank you. I ended up stumbling upon those after researching for a bit. Definitely the way I'm going to go

AndreaB3 made it!4 months ago
Is working great with a 5m strip/300 leds. thanks!
temp_965250266.jpgtemp_1502217083.jpg
mconnelly made it!5 months ago

I made it with a very quick and dirty copper plated PCB, LM7805 regulator and TIP122 transistors. I had to run my LED strip at 12V, no problems overheating. This is a super simple circuit and now my workshop looks like a frickin night club.

IMG_20150321_224510.jpgIMG_20150321_225130.jpgIMG_20150321_224555.jpg
ObscureStar made it!1 year ago

This works great as a stand-alone, but I ran into some unpleasant behavior when using it in combination with one of Adafruit's microphone boards. The common ground between the transistors and the mic causes all sorts of undesired feedback and harmonics on the analog signal. I'm going to try to figure out how to buffer the output but I'm not very skilled with electronics. Anyhow, thought I'd mention this as a potential gotcha for others. Here's my circuit if any benevolent being wishes to debug it. The bit on the top right is a rotary encoder with a momentary switch. It and the resistor associated have been removed for debugging.

Moving the mic's ground from the common ground to the second ground on my mini helped a lot but I still get more noise than running without the transistors.

glove.gif
dushu ObscureStar8 months ago

You could try connecting some capacitors between the V and GND terminals of the microphone to filter out the noise.

danm_daniel (author)  ObscureStar9 months ago

Awesome, thanks for sharing your research

Dunky131 year 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)  Dunky131 year 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.

mbraverman1 year ago
I'm just wondering, Are you using PWM on your Attiny85?
danm_daniel (author)  mbraverman1 year 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.
emikayee1 year ago
I made this last night, works like a charm, thanks!
danm_daniel (author)  emikayee1 year 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-IT2 years 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)  iamdarkyoshi2 years 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.