Go Down

Topic: arduino+18 led's+darlington array+potentiometer (Read 1 time) previous topic - next topic


Hi there,
Could anyone send me a circuit diagram for arduino running 18x 5V 3mm led's via darlington array +resistors and all connected to potentiometer to enable me to control brightness of led's?
I've got a basic idea how to do it but don't want to blow up my arduino so if anyone could help me please do so.
:D cecylia


As I understand it you dim LEDs by PWM (pulse width modulation) not by varying the voltage you apply. So I would connect the pot to an analog input, read that and use it to set the duty cycle (on and off times) of the LEDs.



Do you mean that all 18 LEDs are at the same brightness at the same time? Or do you need to switch them on and off individually?

Assuming the former... I'm at work and can't draw diagrams, but...

As Andrew says, connect the potentiometer to an analogue input - the ends go to 5v and ground, the middle to an analogue pin - one of the basic example sketches will show you how to read that value off with analogRead (giving values in the range 0-1023)

You can then write a corresponding value (not as fine grained as analogRead; 0-255) to one of the PWM pins using analogWrite.

You can only draw about 40mA from an Arduino pin. Normal LEDs should generally receive about 10 to 20 mA, so your 18 LEDs should not draw more than 360 mA. Hence the need for a transistor. You might not even need a Darlington pair for that much current gain - a Darlington just "counts as" one big transistor, but many ordinary single transistors can give you enough on their own. See here
for a tutorial (nb - seems sound - not checked every detail). You need a resistor between the Arduino output and the transistor base, but it will depend on your transistor so I can't really help you with a value.

However, that normal LED current draw usually needs about 2v - not 5v! Very few LEDs should have 5v put across them, unless they're the (not very common, rather more expensive) kind that have a built in resistor. Unless you're really totally sure you have this kind, each LED needs a 330 ohm resistor in series with it if it's being driven by 5v.

Hope that helps.


not as fine grained as analogRead; 0-255

analogRead returns 10 bit values, 0..1023.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


not as fine grained as analogRead; 0-255

analogRead returns 10 bit values, 0..1023.

I think he meant the value you use with analogWrite (0..255) is not as finegrained as that from analogRead (0..1023).



Andrew - yes, that's what I meant exactly, thanls.

AWOL - sorry I was blindingly unclear there!

Apologies for any confusion caused.

Go Up