From level zero : lightning a lot of leds

Hi everyone.
I now I should have read a lot on the forum before posting this, but I even don't know where to look and what to search for, as I am an absolute beginer.
I can write Arduino programs, I bought the beginers manual, and I managed to use leds, servos or sensors with my duemilanove, it's fun but... I don't understand a lot about electricity.
My actual problem must be ridiculously basic, and here it is : I'd like to use, for instance, nine leds at a time. Nine leds with only one output pin of my arduino card. Or a hundred. I already noticed that with 5 leds, there is quite no power, the leds are quite off. So I guess arduino musn't be the power supply but just the switch of a power supply. What I don't know - told you I'm an ignorant - is what kind of configuration I should use, what device, to switch the power on and off ? And what if I want this power to be analog ? (256 levels for instance).
I'll be grateful for any hint, any track...

You can use the PWM pins and analog write to get 256 levels of intensity.

To drive many LED's you need some extra circutry because Arduino pins can only source 40mA. You also need an external powersupply

depending on how many LED's (how much current) you could use a suitable transistor driven by an Arduino PWM pin to dive a number of LED's powerd by a wallwart of some kind.

But more info is needed to give more specific help. (number of LED's, voltage, and forward curren of the LEd's)

Each LED must have it's own resistor to limit the current, unless you put LEDs in series then they all come on at the same time but only need one resistor.

It is quite common for a beginner to ask about lighting hundreds of LEDs, start of with just a few, scaling up is not easy and often requires extra hardware like driver chips.

Use Google and prefix what you want to find with the word 'Arduino'

Thank you. It's not really that I want to light thousands of leds, but I need to light more than the board supply can

This is where multiplexing comes in :slight_smile:

Or some heavy duty driver chips...

When you say you want to power several leds from a single pin, do you mean you want all the leds to light up at the same time? Or do you want to be able to control them all individually? These are very different problems and the first one is fairly simple while the second is fairly complicated.

but I need to light more than the board can supply

One way of having full brightness control over 16 independent LEDs is to use the TLC9540

http://www.arduino.cc/playground/Learning/TLC5940

You can chain these chips together to control many LEDs.

@scswift: Well my problem is the quite easy one : I want all leds to do exactly the same at the same time. I have not the slightest idea about electricity but I guess what I need is to have my arduino board controling some kind of switch that has the ability to link the power supply to the leds.

I have not the slightest idea about electricity

I would recommend that you start to learn by doing some simple projects before you try projects that are not copies of some one eases.

You can do this with a single transistor or FET. Take the first circuit here and replace the relay coil with the LEDs in parallel but all having their own current limiting resistor.
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html

Mike:
Don't you mean replace the motor?

Jean:
That transistor he has there in the schematic is an NPN. He's also got a protection diode across the motor that you won't need for the leds. The base of the transistor is connected to a pin on the arduino via the 3K3 resistor (3.3K ohms). The collector is connected to GND. +Ve is connected to the battery positive I think. And where motor is you put your leds, making sure you've got the short (+) lead (anode) on the + battery side with the resistor and the long (-) lead (cathode, flat side of led) on the transistor.

You can use this wizard to calculate the size of the resistors you need on each led:
http://led.linear1.org/led.wiz

The forward voltage you'll find on the specs of the led you bought. That is how much the voltage from your source is reduced by the led when it passes through it. Forward current is probably 20mA, but again it's in your spec sheet. Source voltage will be your battery voltage. If you don't get a resistor value of 150mA or so in your resistor calculation then unless there's two leds in series in the circuit the wizard suggests you may have entered something wrong.

If you don't get a resistor value of 150mA or so

If you get a resistor value of 150mA, then you've definitely done something wrong ;D

What have you never come across 150mA resistors, try teaching some first years, they are quite common. Along with the 15 volt currents and the 20 ohm voltages.

Don't you mean replace the motor?

yer I was thinking of the relay circuits later on.

Har har! :slight_smile:

150 Ohm resistor.