Pages: [1]   Go Down
Author Topic: arduino+18 led's+darlington array+potentiometer  (Read 781 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Thanx
 smiley-grin cecylia
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Andrew
Logged

London, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://www.kpsec.freeuk.com/trancirc.htm
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.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 239
Posts: 24371
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
not as fine grained as analogRead; 0-255
analogRead returns 10 bit values, 0..1023.
Logged

"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.

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Quote:
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
Logged

London, UK
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

AWOL - sorry I was blindingly unclear there!

Apologies for any confusion caused.
Logged

Pages: [1]   Go Up
Jump to: