[SOLVED] Controlling LED arrays - Not sure where to start

I've got it in my head to do an Arduino project, and it seemed (in theory?) simple to make one just light up an array of LEDs... until I realized that...

  1. I only know a little about Arduino (enough to be dangerous?)
  2. I know that driving and dimming LEDs isn't exactly straightforward, and it and gets harder when you start driving a bunch of them at once. I've burnt LEDs out accidentally messing around with batteries and I don't want to burn these out.

Given that, here's what I'm trying to do... I want to power a strip of inter-connected leds like these: Page not found ... I have many questions about this.

There are projects out there for doing the same thing with IKEA DIODER, and there are IR-based projects with these (they come with an IR controller), but I'm more interested in driving these LEDs without the built-in IR controller, and the more research I do, the more I feel like I don't know. On the DIODER projects, some are driving the LEDs directly from (what I think are) the GPIO pins on the Arduino board, others use a secondary LED controller. This controller is $100, and I'm not sure that I want to pay that much money for something like it, but I'm not opposed to the idea of having two boards, Arduino and LED controller. I'd like to be able to control them (brightness, fading, etc...), so I'd assume they're using PWM to do this? But, if they're using the PWM pins, I'm not sure how that can provide enough power (again, I need some fundamental education here). The most I've seen on a PWM Arduino board is something like 50ma at 3.3v, which should be good for one LED (AFAIK??), but not for an array of them, which (I'm assuming) will want more like 150ma?

Technical details about the LED strip
The LEDs are (as far as I can tell) wired in parallel, as you can cut it at certain spots to shorten the length. It has four leads, one for each of R, G, B, and + ... I'm assuming that the + is the common/return for all three lines. Each strip has something like fifteen LEDs, and interspersed throughout them are little banks of what look to be three surface mount ... things ... I suspect they're resistors, but I suppose they could be diodes. How can I tell? Each strip has a four pin male connector on one end, and a four pin female connector on the other end, and you can (according to the product specifications), chain up to ten strips.

My end goal is to have these wired into some Arduino to allow for either network control (via wifi or ethernet shield?) and/or better IR control -- the controller/PSU it comes with lets you select one of sixteen colors and four animations but does not let you blend them yourself or make your own animation patterns.

In any case, this is where I'm at, and I have so many questions, as well as things to do/buy

Current Shopping List

  • Arduino DUE (? Uno? Micro?)
  • Breadboard
  • Jumper Wires
  • Other things that I don't know about yet?

To Do

  1. Test voltage/current on stock PSU/controller unit to determine power needs
    ...
    ?. Buy stuff and begin building

Questions!!

  1. Is this the right forum to post this kind of question?
  2. Can/should I drive these directly with the Arduino, or would it be better to get an LED controller of some sort? I'd like to have several of these chained together and powered by a single unit, but from what I've seen so far, I'm afraid that the Arduino won't be able to push that kind of current.
  3. How do I regulate the LED brightness... PWM?
  4. What should I have on my shopping list to get started?
  5. Is there a good (or common) box to use to contain these lil controllers once they're built?
  6. Would the Arduino Mini/Micro be a good fit for this if I'm not looking at reprogramming it often once it's installed and set? Do I need an Uno, or Due (or something else) to program a Mini?

Thanks.

Hi enigma_oz

Can/should I drive these directly with the Arduino ... I'm afraid that the Arduino won't be able to push that kind of current.

You're right that the Arduino cannot switch enough current to drive the LEDs directly. Plus the strips run from a 12V supply. But you can use the Arduino to control logic-level MOSFETs (one for each RGB colour) which in turn drive the LEDs.

PWM will let you vary each colour, as you suggest.

To program a Mini, you need a serial adapter. Another option is a Nano, which has built-in USB.

Regards

Ray

Take a look at this link.

HazardsMind:
Take a look at this link.
Usage | RGB LED Strips | Adafruit Learning System

This is good, but start from the overview page.

Also, their NeoPIxel guide is great. NeoPixels has made controlling LEDs easy.

Wow!

All of you, thanks, that's precisely what I needed to know.

It's funny for me, looking up info on MOSFETs, as I've only really seen them in context of guitar effects pedals and audio equipment. It's interesting to now see and learn what they're really designed for... that is, not mangling/amplifying an audio signal (which they do well though!)

https://learn.adafruit.com/assets/2692
So looking at the diagrams on the example linked above, this is what my understanding is of what's going on... (is this correct)

Starting with the MOSFETS (which each of the three is set up the same, with a different signal/output line), and going top to bottom, the first (gate?) pin would be the PWM signaling from the Arduino, the second (drain?) would be the "output" of the MOSFET, and the third is the ground (source??????) pin. On the Arduino, the 9v (+ or - ?) is connected to the 12v pin on the LED strip, providing 9 volts (of pull or push? I know direction matters for LEDs & the "+12v" on the strip has me a bit confused)...

IF that whole mess is correct, then I'm also assuming that the ground pin on the Arduino is ground for everything on the Arduino, both signaling and power supply (this makes sense to me anyway). So then, when you apply current to the gate on the MOSFET=, it closes the circuit between the Drain and Source pins to allow current to flow out of the 9v, through the channel on the strip, and back to ground, and allows the LED to light??

If that's the case (and I miraculously have all of that right... or I guess even if I don't), then how do I actually regulate current output to the LEDs... not to modulate them, but so I don't burn them out? Do I do it with straight PWM? Is the MOSFET voltage/amperage sensitive on its gate signal? Do I just use a straight-up resistor as in the second diagram?

Thanks again.

Depends on the LEDs. Single LEDs can use a current limit resistor per LED (3 resistors for an RGB LED). "dumb" LED strips powered from 12V have a resistor in series with 3 LEDs. "smart" LED strips have an IC built in to control the current of the LEDs they control.

High power LEDs need constant current driver as the Vf of the LED can change as the LED heats up, so smarter current control (i.e. with internal feedback) is used.

I can't tell if those have a chip or not.

On the Arduino, the 9v (+ or - ?) is connected to the 12v pin on the LED strip, providing 9 volts (of pull or push? I know direction matters for LEDs & the "+12v" on the strip has me a bit confused)...

That pin is now called Vin on the Uno. From the Uno page on this website ...

VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

On a Pro Mini, the equivalent pin is RAW ...

There is a voltage regulator on board so it can accept voltage up to 12VDC. ... be sure to connect to the "RAW" pin

For the LED strips, you should use a 12V regulated supply that can provide enough current for the strips. If you want to power the Arduino from the same supply, you connect the +12V to Vin / RAW and GND to GND. On a Uno, you can achieve the same thing by connecting to the DC jack socket.

how do I actually regulate current output to the LEDs... not to modulate them, but so I don't burn them out?

The strips are designed to work from a (max) 12V power supply. They have current-limiting resistors built in (see earlier diagram in that Adafruit tutorial).

Do I just use a straight-up resistor as in the second diagram?

Those resistors are to limit current flowing out of the Arduino into the transistors. For MOSFETs, some people say that a similar resistor is needed between Arduino and gate. Others seem to get away without them. Might be safer to include them.

I realize I'm probably just repeating a lot of what you've all said, but I want put it into my own words to be 100% sure that I understand what I'm getting into here. Thanks again.

Hackscribble:

On the Arduino, the 9v (+ or - ?) is connected to the 12v pin on the LED strip, providing 9 volts (of pull or push? I know direction matters for LEDs & the "+12v" on the strip has me a bit confused)...

That pin is now called Vin on the Uno. From the Uno page on this website ...

VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

On a Pro Mini, the equivalent pin is RAW ...

Thanks. I was just looking at the Uno and others and realizing this now. Dur.

Hackscribble:
For the LED strips, you should use a 12V regulated supply that can provide enough current for the strips. If you want to power the Arduino from the same supply, you connect the +12V to Vin / RAW and GND to GND. On a Uno, you can achieve the same thing by connecting to the DC jack socket.

So then, to be clear, the voltage regulator regulates the raw voltage out, controls what voltage is being used internally, and makes the signaling pins 5v or 3.3v or whatever, but because we're supplying 12v, then 12v is accessible through the Vin / RAW pin? So then, I use do something like a 12v/1.5A wall wart (into the DC in on the arduino) and then have the full 12v/1.5A on the RAW pin? And... to extend this line of thinking, that 12v RAW is wired into the power input on the led strip and controlled by the MOSFET? That's actually brilliant.

And then getting back to the LEDs... Assuming they're designed to work with a given voltage (12v)... do I even care then about regulating amperage? I'm assuming I could just supply 12v at any available amperage (within logical reason... I don't need 1000 amps or anything stupid) and have the thing "just work" setting aside any fancy colors or other cool Arduino-based stuff? In theory (?) the resistors limit the current to a specific load / amperage at 12v, so as long as we have 12v in, we should be good... right?

Hackscribble:
Those resistors are to limit current flowing out of the Arduino into the transistors. For MOSFETs, some people say that a similar resistor is needed between Arduino and gate. Others seem to get away without them. Might be safer to include them.

So that the 3.3/5v signaling doesn't burn out the MOSFET?

Are the MOSFETs then, essentially high speed on/off switches? (I realize this sounds really dumb now knowing what a transistor is, but I'd still like to be sure).

You're on the right track now.
How many strips do you want to control, and do they +12 and R-G-B pins, or someething else?

So that the 3.3/5v signaling doesn't burn out the MOSFET?

No, to protect the Arduino. Those who recommend resistors say that the capacitance at the MOSFET gate may lead to a rush of current into the gate when the MOSFET is being switched. Only a short rush but possibly enough to exceed the current limit of the controlling device, in this case the Arduino.

I use do something like a 12v/1.5A wall wart (into the DC in on the arduino) and then have the full 12v/1.5A on the RAW pin?

So long as it is regulated to not exceed 12V - if you use a Pro Mini, 12V is the maximum - the Uno can tolerate more.

If you are using a Uno, there is no need to go through the Uno - connect +12V direct from power unit to LED strips, with a separate connection to the Uno. Make sure all the grounds are connected.

CrossRoads:
You're on the right track now.
How many strips do you want to control, and do they +12 and R-G-B pins, or someething else?

Awesome. As far as what wiring and how many... it depends. If I stick with the Sylvania ones I'm using, or go with the bulk analog ones on adafruit, then yes the wiring is +12 and RGB. If I'm just doing ambient lights, and don't intend on doing a major lightshow or something with them, I don't see much reason to go with anything fancier. For how many... I haven't really considered that at all. The Sylvania kit says I can hook up to ten of the four-pin strips in series without issue, but I suppose we're looking at more amperage to drive the whole thing as we reach it out further? Ten of these things would be 20 feet, and I don't see me wanting to do anything larger yet. I believe the numbers are similar for the adafruit one... possibly with more reach.

For the next (perhaps fancier) project, if a neopixel, that's a whole different thing because the serial signaling with regulation on-chip for that one. I guess I may want to in the future do that as it's not that cost prohibitive ($17/m vs $16/m), but at the moment, I like what I've got... and I suspect that the analog ones may possibly be brighter??

If you are using a Uno, there is no need to go through the Uno - connect +12V direct from power unit to LED strips, with a separate connection to the Uno. Make sure all the grounds are connected.

Okay. That makes sense. I'm just thinking from a simplicity's sake, I'd want to go through the Uno since it already has the DC input connector on it, but I suppose it doesn't matter if I can do it either way. If this thing works out, I'd want to put it in some kind of a box and be able to just plug it into the wall wart and LED strip directly.

if you use a Pro Mini, 12V is the maximum - the Uno can tolerate more.

Barely. NCP1117 shows 15V as input max with 5V outout, best results for 800mA output is not to exceed 12V tho, and lower is much better.

Output Current Limit (Vin?Vout = 5.0 V, TA = 25°C, Note 6)
6. The regulator output current must not exceed 1.0 A with Vin greater than 12 V.

What would you have the Uno do with these? I offer a card with 32 high current sinks that you could drive these strips with.
Connect up +12/Gnd to the board, connect strips to the screw terminals, little jumper cable to the Uno, off you go.
Shown here with Duemilanove, has 4th hole for mounting Uno as well.
http://www.crossroadsfencing.com/BobuinoRev17/

CrossRoads:

if you use a Pro Mini, 12V is the maximum - the Uno can tolerate more.

Barely. NCP1117 shows 15V as input max with 5V outout, best results for 800mA output is not to exceed 12V tho, and lower is much better.
http://www.onsemi.com/pub_link/Collateral/NCP1117-D.PDF

Output Current Limit (Vin?Vout = 5.0 V, TA = 25°C, Note 6)
6. The regulator output current must not exceed 1.0 A with Vin greater than 12 V.

What would you have the Uno do with these? I offer a card with 32 high current sinks that you could drive these strips with.
Connect up +12/Gnd to the board, connect strips to the screw terminals, little jumper cable to the Uno, off you go.
Shown here with Duemilanove, has 4th hole for mounting Uno as well.
Cross Roads Electronics

Basically, I’m looking to light up small numbers of these strips (around 4 to 10 feet) and control them with the arduino. The idea is that I would learn the necessary parts of circuitry, electronics, and microcontroller programming through this process.

As far as the 32-sink board you’re describing… that may become part of phase 2…? Wo we’re looking at basically 800ma max through the Uno or else I need to power the LEDs separately. How does that look for wiring? Do I have two wall warts, or could I power the Uno through whatever’s needing the higher power by using some kind of converter circuit?

You can get by with one 12V wallwart.
Use a splitter to feed 12V to the arduino, it can make 5V to power itself and the logic chips. That won't take much current, and the onboard regulator can handle that.
Power the LED strips with 12V directly. If you try and take 12V from Vin, you lose voltage across the reverse polarity protection diode, and the diode is only rated for 1A anyway. Better to just not go thru the board for that.
LED strips draw around 20-25mA for every 3 LEDs. 3 LEDs about every 3"? So 80mA/foot, 800mA/10 feet, x "a small number", way more current than you can get thru any Arduino board.
But using Arduino to control current from common cathodes of the strip with N-channel MOSFET, that is very easy.
This a youtube video of 8 9-LED strips (longest I had on hand) being faded up & down.

Two these for example, connect the loose ends together and connect to your 12V source. Or however you need things.

enigma_0Z:
It's funny for me, looking up info on MOSFETs, as I've only really seen them in context of guitar effects pedals and audio equipment. It's interesting to now see and learn what they're really designed for... that is, not mangling/amplifying an audio signal (which they do well though!)

It's actually much more interesting than that. :astonished:

MOSFETs are actually the transistor of the 21st century (and much of the 20th actually), outnumbering the use of bipolar transistors, not by a few times, but by many thousand millions of times over!

They are the only form of transistor presently used in computer and logic chips, contained in almost astronomical numbers in each, particularly CPU and memory chips. So just about every technology you own contains huge numbers of them, and a very few "ordinary" or bipolar transistors for more mundane tasks such as power control and radio frequency amplification, and even then many of those functions are also performed by FETs.

CrossRoads:
You can get by with one 12V wallwart.
Use a splitter to feed 12V to the arduino, it can make 5V to power itself and the logic chips. That won’t take much current, and the onboard regulator can handle that.
Power the LED strips with 12V directly. If you try and take 12V from Vin, you lose voltage across the reverse polarity protection diode, and the diode is only rated for 1A anyway. Better to just not go thru the board for that.
LED strips draw around 20-25mA for every 3 LEDs. 3 LEDs about every 3"? So 80mA/foot, 800mA/10 feet, x “a small number”, way more current than you can get thru any Arduino board.
But using Arduino to control current from common cathodes of the strip with N-channel MOSFET, that is very easy.
This a youtube video of 8 9-LED strips (longest I had on hand) being faded up & down.
Arduino Power! - YouTube

Ohh-kay, now that make sense. So I just basically split the power off before it touches anything rather than running it through the arduino. As long as we’re not going through, there’s no risk of blowing that output diode, and then current shouldn’t be an issue. The problem isn’t a large current into the arduino, but through it… it’ll only draw as much current as it needs… but the circuitry will only support so much going out.

Given the option, I think I’d almost rather use the female version of that those pigtails and get a matching wall wart. I could (in theory?) wire that into the + and - rails on my breadboard and then jump that off to the Arduino, as well as the test circuit as I’m prototyping…?

(edit)

Thanks again everyone for your help. This has been very informative for me. As an aside, I also just got my UNO and kit so here we go!!