RGB LED Strip Circuit with Arduino
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
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 LED’s are connected in series, the supply voltages and necessary current are added together (respectively). 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.
Step 2: Mounting a Transistor to a Heat Sink
A heat sink‘s function is to dissipate heat so components don’t fry, melt connections/become un-soldered, or become too hot to touch. This is really important if you’re using a 7805 for voltage regulation, which I’m also doing in this circuit. The 7805 will output a steady 5V to the microcontroller and dissipate quite a bit of heat. I like to do this because I don’t trust the Arduino SMD voltage regulator, especially on ProMinis which I use frequently (even thought the Arduino Uno datasheet says the input voltage can be as high as 20V).
This part is pretty straight-forward. Apply some heat sink compound to the transistor (first image in this series) and then put the nylon washer on screw on then through the transistor (second). The compound increases thermal conductivity, which aids in the dissipation process. Lastly, fasten the nut to the back of the heat sink.
Repeat two times for each transistor and once for the 7805.
For more detail: RGB LED Strip Circuit with Arduino
This Post / Project can also be found using search terms:
- arduino rgb led projects
- using led strip driver stm32 rgb schematic diagram arduino sketch
- arduino led strip circut
- arduino led strip projects