Running an Arduino with many LED's

As this is my first post I'd like to introduce myself a little.
I got into the fantastic world of Arduino because I'm a roller coaster fanatic, I build model roller coasters and I wanted a way to automatize them. Arduino seemed like a good solution. I currently own an Arduino Mega and an Arduino Duemilanove.

I'm using the Arduino Mega for my current coaster project, this left me with an Arduino Duemilanove. I decided to make light patterns to display a sign on the coaster.

The sign is basically a series of 8 led's displaying a pattern. Every 8 led's the pattern repeats until they made a circle around the sign.
However, my current calculation is that I would need 80 led's. I don't know what would be the best way to power those led's.

From a calculation having 5 rows of 2 led's each with a resistor after each 2 led's, I'm drawing out 150 mA. Doing a quick lookup this is way more than an output pin on the Arduino board can handle. What would be the best way to operate this LED mayhem? Using a couple of relays and an external power source or using a transistor?

If using a transistor, how would I hook those up? I've looked at wikipedia and many other websites but I can't get how they actually work.

I myself prefer working with relays, but as some of the patterns include fast blinking lights, I have my doubts if the relays can keep up with the flashing.

Thanks in advance :slight_smile:

Just to make sure I understand. There 8 strings of LEDs, 10 LEDs on each string?

If that is the case, use something like a ULN8023. It is 8 Darlington transistors, and so can drive 8 independent circuits.

Each Darlington acts like a switch which connects the output-side pins (pins 11 to 18) to ground, when you apply HIGH to the input side pins (pins 1-8).
If the voltage is big enough (a parameter called Vf), you can put LEDs in series which reduces the amount of current you need. Further you drive from a higher voltage than 5V if that's convenient.

[edit] I hope this is a bit clearer:

So, you could drive 5 series-connected pair of LEDs from each output of a ULN2803.

The ULN2803 has two constraints, each Darlington pair can handle a maximum of 500mA. While each Darlington transistor can dissipate upto 1W the power dissipation for the whole device must be under 2.25W.

So I read the graphs "Peak Collector Current as a Function of Duty Cycle" (in the datasheet) as saying, for 8 Darlington transistors, conducting 100% of the time, the maximum current though each is about 150mA.

I am quite conservative, so I would limit myself to 75mA/Darlington if all Darlington transistors are conducting, which is about 15mA/series-connected pair. That is still bright for modern LEDs.

It sounds like you are going to do 'walking lights' which I infer to mean that LEDs will only be on for part of the time. If this is the case, you could push more power though each Darlington transistor.

So, for example, if each LED string is only on for 50% of the time, the graph says the maximum current is doubled to 300mA. I am still conservative, and so would limit the current to 150mA, which is what you calculated the LEDs would need.
[/edit]
HTH
GB-)

Thanks for the reply.
The ULN8023 seems like a good alternative, as I was close to buying old fashion relays.

Here is a video of the current patterns I have.

This was supposed to be a repeating pattern. However I changed my mind and decided to make letters with LED's so I now have 11 Letters spelling the word "Looping Star". The maximum amount of LED's per letter is 10 however most of them contain less LED's

I'll still use the patterns seen in the video, which is only a few of the ones I currently have. Including the blinking one where they all strobe. I think that even though they are only on for 0,1 second they can draw a huge current from the Arduino.

I'm currently having a chat with a mate of mine, and following his advice I'll probably buy 11 Transistors and put the LED's in series. I'll use a 500mA 12V powersupply which should be enough for the LED's to work all at the same time.

However I'm not entirely sure if this will work, looking at the Arduino Duemilanove datasheet it doesn't say anything about the current coming from the Vin pin. Is this one also limited at 40mA or would it be the same as the power supply, capable or 500mA?

Thanks in advance.

Arduino - Lightpatterns 1 - YouTube

Nice.

However I changed my mind and decided to make letters with LED's so I now have 11 Letters spelling the word "Looping Star". The maximum amount of LED's per letter is 10 however most of them contain less LED's

That's okay. It's the total current per 'string' (all controlled by one pin) that matters.

11 Transistors and put the LED's in series.

That would work, be careful that you don't try to put too many LEDs in series. It's a bit of a pain to wire up transistors compared to anything in a DIL socket, but once done, it's done, so "have at it" and have fun.

I'll use a 500mA 12V powersupply which should be enough for the LED's to work all at the same time

Not sure exactly what you mean.

The foward voltage drop of ordinary LEDs is about 1.7V.
The transistor will drop about 0.7V too
So the maximum number of LEDs you could drive from 12V is
(12-0.7)/1.7 = 6
It gets worse for other LED colours, so check that it's okay.

If there are 11 letters, with say, 2 sets of series-conneted LEDs each, then the total current the LEDs can draw is:
500mA = (11 * 2 sets of LEDs)
so one set of LEDs could draw:
500mA / (112) = 22mA
If you are running the Arduino from the same power, allow (guess) 100mA
(500mA-100mA) / (11
2) = 18mA
I'd be conservative and reduce it by 50-100% to make sure everything is well within safe limits.

So, as long as you don't have more than 6 LEDs (or whatever the forward voltage drop is) in a series it'll be okay. It's okay to drive several series-connected sets of LEDs from one transistor. You should protect each Arduino output pin with a small resistor between it and the transistors base. That is the another nice thing about the ULN280x family, that is already implemented internally.

However I'm not entirely sure if this will work, looking at the Arduino Duemilanove datasheet it doesn't say anything about the current coming from the Vin pin. Is this one also limited at 40mA or would it be the same as the power supply, capable or 500mA?

I'm not sure I understand.

Is the plan to plug the 12V 500mA power supply into the external power socket?

Then take the Vin to the LEDs and transistors?

You can connect power to the external power socket (best as it is protected by a diode) or the Vin pin (not as good as a reversed voltage may damage the board) to power the Arduino.

If you also take the power from Vin to the LEDs+resistors, you'll be going through the Arduino's reverse voltage protection diode. It depends a little bit on the board. AFAIK, most are rated to handle more than 500mA (I use 1A or more on my designs because diodes are very cheap, and who knows what folks will hang on Vin :slight_smile:
But you might want to double check.

Vin is not restricted in the way a digital output pin from the Arduino. So it is only the diode and electrical properties of the Vin pin that should matter. Ordinary pin headers and pins should be okay with more than 0.5A.

So, if I have understood, you should be fine.

HTH
GB

Have you tried flashing the led's independent of each other fast enough so that it looks like they are all on at the same time?

After looking at the various LED Datasheets, I decided to buy myself an Multimeter and measure it myself. I also bought ~100 led's red and yellow. Shockingly they needed a much higher voltage than I expected, around 1.7 as you said.

I'll be buying the ULN2003 16PIN version and use 2 of them.

The Adapter I bought is capable of 500mA and 12V, I will be plugging it into the external power connector on the Arduino board, then use the Vin pin and connect it to the Collector on the ULN2003.

Im gonna do a couple of calculations real quick, and look at the datasheet. And determine if I can run them in parallel or series.

if I can run them in parallel or series.

Remember if you run them in parallel you will need one resistor for each LED, where as in series you will only need one resistor.

I'll be buying the ULN2003 16PIN version and use 2 of them.

Good idea. You could change the word, and have more letters without needing more electronics. Also you could divide the load, so they can run cooler or at a higher current.

Im gonna do a couple of calculations real quick, and look at the datasheet. And determine if I can run them in parallel or series.

You should be able to run a chain of (approximately) 6 Red LEDs in series, with a single resistor to restrict current through the chain.
You'll need to look at the datasheet or do some measurements for the yellow LEDs. The ones I am familiar with like 2V, so that would allow for 5 per chain at best.
You'll be able to run several chains of from each Darlington transistor in your ULN2003. How many you can run depends on the current through each chain. Three chains (i.e. 15 yellow LEDs or 18 RED) should be fine.

A ULN2003 datasheet says that the DIL plastic package can run all 7 Darlingtons at 100% on at a current of a little over 100mA.
I'd reduce that to 50-60mA so that everything is well within specification.

If you divide the load so the most heavily loaded is only running 6 sets of chains, the datasheet graph says it could supply a bit more current, but hardly worth exploiting as I think this will be bright anyway.

With 3 chains at 15-20mA each, they should be bright. It might be so bright that you want to use a larger value resistor to dim them! You could also drive them with PWM which turns them on for part of the time, so that you can dim them.

HTH
GB

I'm going to solder the first letters. Since I received my ULN2003 I hope to get at least 1 letter running somewhere today :slight_smile:

I'll let you knowhow it turns out if I get one working.

Hello again,

I think I ran into some serious trouble now, I got the letters soldered. I got everything connected. Yet when I apply 3V (using a resistor), or 5V without a resistor to pin 1(Base) (the one right under the little notch, right?) on the ULN2003, the Emmiter only gives me 0.6V at pin 16. I got pin 8 hooked up to ground and pin 9(Collector) hooked up to Vin (RAW on the Protoshield). I'm running the Arduino at 12V from an external power supply.

Strangly, all the lights do light up when I connect the directly to Vin and ground. I measured the power coming from Vin using this method and it gave me a reading of 14 V :o

It has to be something in the ULN2003 acting up.

Any ideas? I doubt they are corrupt or broken since this is the first time I turn them on, and they are all doing the same, I got 2 spares I never even took out of their little plastic container in which they were shipped.

Edit:

I made an schematic so you know how I wired it up.

Any clues what is wrong?

Edit again, I did a massive amount of research all day long and found out how this is used, and it works perfect!

And here is the result! Sorry for the triple post though.