Author Options:

Why is my RGB led strip giving lots of problems? Answered

     I'm working on project with RGB LED strips with my arduino and a ATtiny84. Basically, what I plan to do is attach the strip to my display cabinet and attach the strip to an ATtiny84 microcontroller which will program the lights. Doing this I have encounter a few problems. As I haven't receive my ATtiny84 chip from the store yet, I'm testing everything on my arduino first. I first attached a normal single RGB LED to test all my programs and it works almost fine.

      My first problem was when I attached 3 potentiometer(pot) to the arduino to control the intensity of each pin(red, green, blue). It did as it suppose to. When I turn the knob the brightness increase but as I'm reaching its maximum it drops back low again. So basically as I turn the knob gradually increasing, the brightness increase gradually from zero to it brightest then drops. I have attached a screenshot of this program below. I think it may be the connection between the pot and the arduino as they are quite sensitive but I'm not sure.

      My second problem is when I replaced the single RGB LED with the RGB strip, MOSFETs(TIP120) and an external 12V supply it worked like before. I attached a couple of pictures of the layout below. However, when I set all the pins to low brightness the red and blue is turned off but the green led did not. The green led is dim but not completely turned off like the others. Why is this so? I'm very sure its not a defect in the strip. I hv also a attached a picture below of it.

      My third problem is when I bought the three MOSFETs from the store I got one slightly different one although with the same label of TIP120. I have also attach a picture of the MOSFETS below.  The pin that is connected to this different MOSFET seems to act the opposite of its values. As in when I set that pin to low brightness it will be bright and vice versa unlike the other two. I can easily buy another one but I would like to know why this happens.

      This is not really a problem but more of a question. As you can see I attached a 1k ohm resistor between the MOSFET and the arduino output to limit the draw of current. I would like to know what would you recommend the value of the resistor because I do not want to damage my chip. Is 1k enough?

      My second question is I'm using a 12V 2A power adaptor as my power supply and a L7805 voltage regulator to provide a 5V power for my ATtiny84. However when I connect it I do not get a stable output and its value is around 5.3V. According to some videos I should attach a 0.1 microFarat electrolit capacitor to the input and a 22 microFarat electrolit capacitor to the output in parallel, however when I do so my output is still not stable and is around 5.8V which is too high for the chip as the max Vin for the chip is 5.5V. So what should I do?

      My third and last question is my power adapter heats up when its powered but not connected to the circuit. Why is that? And my MOSFETS and voltage regulator gets hot occasionally. Should I attached a heat sink? Is this circuit possible to be left on 24/7? and how much power will it consume?

      Sorry for the long post, I'm fairly new to electronics and I'm just a student  who is trying to learn electronics on my own. I have been working very hard on this project and I hope I get the best out of it. Sorry for the bad english too. Any help and comment will be much appreciated.

Thank you very much!!


If you confuse a transistor with a mosfet I think you need to check what you are actually doing.

Your code is the bare minimum required in a perfect world but for the real world you have to adjust it or adjust your circuit.
1. Make sure the base of each transistor has the same voltage with the potentiometer at the same value (so better check with fixed resistors).
2. Make sure the output voltages correspond to the potentiometer setting.
This means checking and if in doubt adjusting the base resistor or code.
3. Change your idea and use PWM signals to drive the LED ;)

Firstly, I'm very sorry about the MOSFET mistake as I said earlier I'm very new to this. Based on this link I assumed it was the same thing but I am clearly wrong so I'm sorry about that. https://learn.adafruit.com/rgb-led-strips/usage

I am using PWM and analog inputs for all of it. I connected my potentiometers to a simple serial program that prints its value and i got a decent stable reading from 0 to 1023. So thats y i mapped that to 0 to 255 and used PWM doesnt that make the voltage be the same? And isnt the current there for limiting the current only not affecting the voltages. Secondly, how do I adjust the code exactly that it correspond to the potentiometer. Is there a term I can look up or a link? tq very much for the help

Just start with a simple test:
Do this for each color.
Set the potentiometer to full and measure the voltage on the LED strip - it should be 12V- This is only to confirm full brightness and that the transistor is giving the full output.
Now turn the potentiometer down until the LED goes off - measure the voltage again here and note the value.
With the green you should see the voltage is not going down to zero.
In the example you linked mosfets are used, if you use the same resistor on your transistors it can't really work that well.

Here you can see the same problem:


So basically you have to calculate the resistors based on the max current your LED's need and best to use a small drive transistor between arduino and TIP120 as the signal output is quite weak and you don't want to draw too much power from them.

Okay I will try this right away. thank you very much for your help. It is really appreciated.

Okay I have read a few articles and the link you have send me. So from I understand I need to recalculate my base resistor to suit the circuit. But also from some other articles I see that this problem can be easily solved with replacing it with a MOSFET. So I think I will try both and see how it goes but what MOSFET would you recommend? Will STP16NF06 do the trick like the link I sent earlier?

This Mosfet would be a bit of overkill unless you want to run a few hundred LED strips at once.
But it does not really matter either, you can take what it is available.
You might also want to look into gate drivers for the mosfet if you notice problems driving them directly with the Arduino.
Keep in mind that for PWM to work properly the mosfet needs enough power on the gate ;)
The goodthing about using these electronics instead of directly connecting the LED's to the Arduino is that you can use as many lights as you wish as long as mosfet and power supply can handle the curent.
You might also notice that for low amps you won't need a heatsink on your mosfet.

So im guessing that a MOSFET is way more expensive than this BJTs? I'm only using 1m of RGB strip with a total of 60 leds which is approximately 1.2A when max brightness for all. So divide it by 3 for each colour each transistor will only need to pass through 0.4A which is fairly low compared to the example in the link u gave me. So is a drive transistor still necessary?

The price is relative depending on what you look at:


That's just an example and there are plenty of mosfets you can use in low amp range, just select them for at least twice the power you need and add a little eat sink - for those tiny one in the link you can solder the back onto a little copper cheet for example.
If you select a mosfet that has a low gat current (should be no problem with the small ones anyway)you won't need a driver for them - they are onl required for mosfets that really have to do hard work.
As you can see in this example below a simple resistor does the trick for most mosfet configurations.


If you use the smaller mosfets you can even solder them directly onto the strip after removing the coating from the copper strips.
Just pay attention to the polarities and where the 12V comes in so the mosfet goes between the power cord and LED's.
If you take the above example you would cut the copper on the ngative rail and "bridge" the gap with the mosfet to act as you controlled switch.

Hey, thanks for the help, sorry for a late reply I was busy preparing the schematics that i just uploaded. Unfortunately, the place I live in have a very limited shops and online shops that sells electronic components, so none of them had any low power MOSFET in stock and the rest was too expensive. So I'm sticking with the TIP120 and I bought those driver transistors you recommended and will do the calculation on the resistor and stuff soon and hopefully it works. Thanks for the help and guide. =)

It is hard to see how your circuit is configured. In general, if you are just starting out with electronics, I suggest you make or acquire shorter jumper cables and get rid of the quick connectors - they are unstable and components are likely to become dislodged if the circuit is moved/transported.

Also, can you attach a circuit diagram/schematic and post your full Arduino sketch? Will do my best to help out when we have more information.

Sorry it took me some time to reply as I was working on the schematics and stuff that I just uploaded. Its very basic and simple. I hope you can understand from what I have drawn there. The basic idea of the program for this project is, there are two modes where one changes colour with a pot that can adjust the time delay and the other mode is a fixed colour which I control by adjusting the intensity of each colour with each pot. The program pretty much serves it function as it works with a single RGB LED.As Downunder35m advised, I think I'm going to add a driver transistor and recalculate the current limiting resistor. What is your opinion on this? Thank you.


3 years ago

One of the things that could be throwing you a curve is that LED dimming or intensity is not achieved by lowering the voltage to the LED's. I was surprised when I learned this since that is the way every other kind of light is controlled. But LED's use something called pulse width modulation. In effect the power to them is not steady but is pulsed much like an unfiltered rectifier voltage. It has a square wave power. So the LED's blink on and off but it is so fast that you cannot detect it. The shorter the blink, or time with no power, the brighter they appear to be. A dimmed LED is actually still running at its full voltage but it has long breaks in the power so it appears to be dim. This is possible to do because their response to power and production of light is so fast. Other light sources, analog if you prefer, don't respond to pulsed power in the same way. You can actually see this effect if you take a lot of pictures of dimmed LED's. Some of the pictures will show the LED's as off. Other pictures will show them as on. But no pictures will show them as dim. If you put a meter to a LED controller and dim it, it will appear to have a lower voltage. This is because the on off switching is happening so fast the meter just gives you an average. If you used an oscilloscope you would see the actual power blink pattern.

A second point with RGB LED's is that the three LED's are not the same brightness. If they were they would not be capable of producing white. Some colors (green I believe) have to be brighter to achieve the proper color balance. If you get a magnifying glass and look closely at the three chips you can see the difference. By the way, I am not completly positive about this point, its an observation. But it does also explain why, when set to white different RGB strips have different hues when all connected to the same controller.

Yes, I am using PWM and I do get the concept of it. And your point on the RGB may be right, I will try to look up to it more and calibrate it accordingly then. Thank you very much for your time opinion, much appreciated. cheers =)

TIP120 isn't a mosfet, its a bipolar transistor.

Words don't work for circuits, show a circuit diagram