LED Strip Controller W/ LED Amp + Arduino

165,964

501

60

Published

Introduction: LED Strip Controller W/ LED Amp + Arduino

About: IT-professional by day, DIY hobbyist (among other things) on my free time. I always have one or more projects going on. Usually something to do with home improvement or a tech project or a combination of the...

Forget about DIY LED drivers with mosfet transistors! It is extremly simple to drive high powered LED-strips with Arduino at low cost without getting into too much circuitry. The secret is cheap mini LED Amplifiers.

This instructable is just about driving LED strips. If you want to see an application, see this Instructable: Arduino Helipad for mini Quad Copter

*** A word of warning - some people have had problems with overloaded/fried Arduinos using this instructable. Please read the comments before deciding to try it for yourself. If you come up with a more robust twist to the project, please comment below! ***

Step 1: Background and Circuits

See pictures for three circuit examples. The first picture reflects the implementation in this Instructable. The second circuit is for two RGB strips (uses all 6 PWM out on the Nano). The third circuit is for six single color strips (all Nano PWMs). Each mini LED amp can put out up to 12 amps. You can put more in parallell or at the end of a strip light as many meters of strip you want, provided you have a good 12v power source.

Each LED "pixel" on a strip consists of three light emitting diodes (LED). Most LED Strips are common anode. This means that the positive end of the diodes are connected at +12v at both ends of the strip. Connect +12v to the anode and 0v to B, R, G to light each circuit up. Single color strips and RGB look the same to the naked eye. Even single color strips have copper connectors which are labeled +12v, B, R and G even though all LED's are the same color.

LED Amplifiers/Repeaters are sometimes called RGB amps. Don't let that fool you. They work just as well for single color strips. A LED Amp is fed by 12v and has inputs/outputs labeled +12v, B, R and G just like the strips. The inteded use of the device is to take the input voltage potential, which can be considerably lower than 12v at the end of a long strip, and boost it back to 12v by feeding more power. I have discovered that a 5v voltage difference on the input is enough to get the LED amp to boost the signal to 12v on the output which means that we can toggle the Amp 12v outputs by means of Arduino digital pins. Arduino digital outputs operate at 0 or +5v.

The circuits connect 5v out on the Arduino to 12v on the LED Amp input (common anode). This may seem wierd. I'll try to make some sense of it. The R, B, G inputs of the amp are attached to Arduino digital out. Setting a pin to 0 creates a 5v potential to the common anode which will result on a 12v potential on the corresponding output which will light up the LED. In other words, a digital 0 turns the light on. A digital 1 turns it off. Or, when using PWM duty cycles, 255 is off and 0 is on.

Step 2: What You Need

Go shopping (probably ebay) for:
  1. 5050 SMD LED Strip
  2. Mini LED amplifier/repeater(s)
  3. Arduino Nano (or other preference)

Step 3: Wire It Up

Wire the Arduino to the input and theLED strip to the output of the LED Amp seen in the picture. You can power the Arduino from +5v or +12v (not some versions of Arduino. Check the spec). Your choice.

Step 4: The Software

Download Arduino IDE from http://arduino.cc/en/main/software and flash the following sketch to try it out. The sketch was used on the RGB strip as seen in clip in step 5. It fades each color up/down then white up/down.

int ledPinR = 3;
int ledPinG = 5;
int ledPinB = 6;

void setup()  { 
} 

/* Note:
When driving LED's using common anode LED AMP's you have to inverse the duty cycle,
i. e. 255 is off and 0 is full power.
*/

void loop()  { 
  // Red
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    analogWrite(ledPinR, fadeValue);         
    delay(30);                            
  }
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    analogWrite(ledPinR, fadeValue);         
    delay(30);
  } 
  // Green
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    analogWrite(ledPinG, fadeValue);         
    delay(30);                            
  } 
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    analogWrite(ledPinG, fadeValue);         
    delay(30);
  } 
  // Blue
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    analogWrite(ledPinB, fadeValue);         
    delay(30);                            
  } 
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    analogWrite(ledPinB, fadeValue);         
    delay(30);
  } 
  // White
  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) { 
    analogWrite(ledPinR, fadeValue);         
    analogWrite(ledPinG, fadeValue);
    analogWrite(ledPinB, fadeValue);
    delay(30);                            
  } 
  for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
    analogWrite(ledPinR, fadeValue);         
    analogWrite(ledPinG, fadeValue);
    analogWrite(ledPinB, fadeValue);
    delay(30);
  } 
}

Step 5: The Result


2 People Made This Project!

Recommendations

  • Water Contest

    Water Contest
  • Oil Contest

    Oil Contest
  • Creative Misuse Contest

    Creative Misuse Contest

60 Discussions

Don´t connect the arduino 5v with the 12 vdc input of the mini lead repeater/amplifier, this cause you will burn the arduino.

SOLVED - TL;DR place a 10-20k resistor between your output and the input; this works with logic level signals at 5v ** and 3.3v signal too!! **. I too struggled with these pesky amplifiers and finally opened one up to see what's happening on the inside. Here's the synopsis: An op amp (operating as comparator) drives the FETs. It compares to 4.7v for the switching. Each of the inputs has a 110k pull-up to high side (12v). Setting reference voltage equal (tying ground together) allows 5v Arduino to drive the amp. For the case of driving from a 3.3v micro you would run into the issue that neither 0v nor 3.3v are sufficient to switch the output.. however when you place a resistor in the middle it allows the input to be pulled up slightly - then you are toggling between.. let's say 3v and 6.6v which allows you to switch!! Note that nothing is tied to the "reference" in the input ( the one with the arrow ). In fact BE SURE NOT TO CONNECT TO REFERENCE because you are really just connecting to 12v from the power source - don't fry your board. Cheers mates! Happy hacking.

3 replies

Where exactly are you saying the resistor should go?

The resistor simply goes from the output of your Arduino (or ESP8266 or similar device) to the input of the LED amplifier. Be sure to tie the grounds together.

Be aware this is 'active low' as in feeding in 3.3V will yield the lights off, and ground will yield lights on.

I personally used a 3.3V device (Raspberry Pi) and I played around with the resistor values. 1 single 10k resistor didn't work (couldn't turn the lights off), but 20k worked. I found a 33k resistor worked best for my application of using PWM to change the intensity of the LEDs. (I found values over 50k didn't work either. Try 20-30k)

IMG_0829.JPG

Ditto!?! I tried putting a resister between 12v power input and the amplifier reference input to provide a 3.3v amount without frying the board (killed one Wemos). Light turns on, but control signal isn't working.

The original setup does work fine with a 5v Arduino.

Were you intending to loop a resister between the reference input and output of the amplifier to "fool it" with it's own output? That didn't seem to work.

0
user
gtoal

1 year ago

perhaps a naive question, but... these LED strips have +12V and RGB signal pins. They don't have a GND. How can there be a circuit? There's nowhere for the electrons to go! Also I would like to try this myself but have a different style of amp (looks like this: https://www.flexfireleds.com/rgb-signal-amplifier/ ) - putting a meter on it shows that it does *not* feed back 12V to the input side. Will that affect how to hook it up?

1 reply

to answer my own question - this amplifier does *not* connect the input +V to 12v so it is safe to drive the amp directly from the +5V and GPIO pins (4,5,6) of the Raspberry Pi! I'll be posting an instructable shortly after I've found the answer to a driver issue. ( https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=176740&p=1126989 )

The LED amplifier I've got is a RF (radio frequency) controlled board. It even comes with a remote control. It only has anode and cathode from the DC adapter. Anyone has any ideas on hacking it?

I reverse engineered the amp's circuit to understand why it was frying the Arduino. Here's the circuit:

As you can see, the 12V input from PS is connected to BOTH 12V strip sides, probably so that a single PS supplied the power to BOTH strips. Obviously, if Arduino's 5V is connected to the 12V amp's pin it would fry the Arduino.

Other than that, and assuming the Zener is indeed 4.7V, it should be possible to control the amp from Arduino. Note that Arduino doesn't sink the LEDs' current, but only a small current through 100K resistor.

As others have stated, a '1' from Arduino turns LEDs OFF and a '0' turns them ON.

Hope this helps

RGBamp.jpg

Your diagram shows you hooking the 12v and Ground pins to the side of the mini amplifiers and the photo shows the 12v and Ground lines going mysteriously under the RGB LED strip connector to the mini amplifiers.

I can't find amplifiers that have connection on the side and I can't figure out from your photos how you made the connection.

Can you please clarify?

Thanks

2 replies

I won't clarify this particular circuit but I have a better one in the works. Please bear with me!

When do you expect your new circuit to be published? No hurry, just interested. Thanks for all your hard work!

*** NEW CIRCUIT ON THE WAY ***

I have come to realize that this circuit has been involved in harming some of your Arduinos (sorry!). I leave you with a teaser - I have a new improved circuit that even works for the admittedly delicate ESP8266 prototype boards. I will do a little more testing and measurements before sharing but I am confident that the new circuit is much safer.

I will put it in a new instructable. I have a little too much at work this week to publish but I will be with you shortly!

0
user
HaoH2

2 years ago

i follow the same setup, but it ended up frying my arduino uno's COM port, can someone tell me what's wrong? below is the battery i'm using

2015-11-18 22.01.43.jpg

Thanks for pointing out these amplifiers - very handy for the strips. BUT the way of using them described here is fundamentally wrong. It seems to work, if with some glitches - at least, my lights did shine on Christmas, but really, I was inexperienced and in a hurry. Now I had time to dig a bit deeper.

Here, the insides of the amplifier. It doesn't measure any voltage potential difference or such, it just tries to sink 12v (11v in fact, after resistors) in the input channels, namely in 5v inputs of Arduino. It successful - the LM124 chip on the right opens the corresponding mosfet, sinking current from output (LED strip). If not - mosfet stays closed, no light. Simple and good: the amplifier actually handles all the ampers in the strip! So:

1) do not connect 5v to 12v input. Even if it doesn't fry your Arduino, there's no sence: all 12v ins and outs of the amplifier are directly connected.

2) Arduino seems to be rather abuse-friendly, but still, it's a very bad idea (and practice) to abuse it. Don't sink 11v in 5v pin. In my case, this worked until I tried to send 0,0,0 (or even 5,5,5) to the strip - Arduino gets overloaded with overvoltage and shuts down.

What to do? Well, I think one can find the right combination of zeners/resistors to sink excess voltage from the amp. I didn't. I used a cheap Darlington array (ULN2003a to be exact) between Arduino pins and amplifier inputs (plus a ground connection). Basically, such an array can be used even without the amplifier, but you'll have to worry about power ratings - each led of the array can sink up tp 500mAs, so for the full strip you'll need 12 legs in 3 groups of 4 connected in parallel. With the amplifier I used 6 legs for two strips. Good!

Another possible good use of the amplifier is with LED drivers like TLC5940, that will happily sink 12v, but you'll have to get the PWM frequency right. I tried with DM631, that has in-built PWM generator, it seems to be too fast for the mosfets.

And, by the way, I tried removing the 100k resistors connecting 12v to inputs from the amplifier - no luck, 5v from Arduino is just not enough to switch mosfets. I guess one can remove everything except mosfets and then patch inputs right to their gates, but it's a bit too drastic for me.

Thanks again for the idea!

IMG_20150314_123121.jpg
5 replies

Wow, that was a thorough analysis. Thanks for that! Admittedly the project was derived from trial and error in combination with basic assumptions. Having said that, I have been using it successfully for a year for some of my lighting. Perhaps I have been lucky and got my hands on a couple of pristine Ardu's. I will post a note/warning at the top of the instructable.

I think I have an idea of how you hooked the darlington array up but if you have a circuit drawing, I (and subscribers) would certainly like to see it.

As for the TLC5940s, you are right. That is the best option, especially for ambitious projects. I have first hand experience. I use two daisy chained chips giving me 32 PWM pins of which I am using 21 pins to power 7 LED amps which power 7 2,5m RGB strips (17,5m tot). Works great! I haven't had the time to make it into an instructable yet though.

I'm not that good at drawing circuits, but thankfully with Darlington arrays it's rather easy - lower leg just controls upper leg, + 2 contacts for Vcc and Gnd.

Can you tell, please, did you use the TLC5940 library by Alex Leone? Did you change anything in it - especially the PWM freq generator?

ULN2003a.jpg

Is there a +12VCC on the ULN2003 or is you circuit drawing correct ?

Thanks

The drawing is correct, no +12v goes to the ULN2003

Tried this out today, worked great. I ended up going with a Photon (by particle,) along with their Shield Shield, which has a voltage regulator, and a 3.3v->5v voltage translator built in, which seemed to work just as well as the ULN2003a to trigger the RGB amp. The Shield Shield and Amp use the same power supply, and fit very neatly into a small project case. I'll post pics soon. I do NOT have anything going to the 12v pin on the input side of the RGB amp.

For code, I started with what I found here to get started, then re-wrote it to suit my goals:

https://www.hackster.io/plaetzchen/a-30-00-led-str...