Pages: [1]   Go Down
Author Topic: A few LED's from one pin  (Read 755 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I think I'm heading in the right direction with this one but could do with a few pointers to check I'm not missing anything obvious and to sort out the details.

I need to power 4 RGB LED's. Each of the LED's will only show one single colour at any time. I have this working with one led by putting the resistor on the common cathode then making the r, g or b pins high as and when necessary.

When the led is on red, however I want all four of the LED's to be on. If i put all 4 LED's from one digital pin, I understand that this would draw too much current. Now I am only making a small circuit with plenty spare pins so I could just use 4 individual pins but I would need to turn all four on and off every time I needed them. I would prefer to run them all from one pin, (times 3 for each colour), at some point I will run out of pins and this is useful stuff to know.

I suspect the answer is to use a transistor, with the base connected to the digital pin, when set to high, this should allow flow through the transistor which can then drive the LED's..... RIGHT?

If there are other options out there, please let me know, I'm sure there are many.

If a transistor is the best way to go, please could you let me know if I need any protection resistors / diodes (other than for the LED's) and how on earth do i go about specifying the correct values for the transistor etc.

If all this is covered elsewhere, just point me in that direction. Many thanks in advance.

Dave.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Simplest solution is a PNP transistor such as BC327 with emitter to +5v, base to the Arduino pin through a 4k7 resistor, collector to the LED anodes. This will turn the LEDs on when the output pin is low, so you will need to drive the pin the other way round.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Southern California
Offline Offline
God Member
*****
Karma: 5
Posts: 539
I like blinky lights
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Any special reason to use a PNP transistor to turn the LEDs on when the output low, as opposed to a NPN transistor that would turn them on when the output pin is high?

Thanks,

Chris
Logged

http://en.wiktionary.org/wiki/magagna <-- My last name.  Pretty apt.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Any special reason to use a PNP transistor to turn the LEDs on when the output low, as opposed to a NPN transistor that would turn them on when the output pin is high?

Thanks,

Chris


Yes, he's using RGB LEDs with common cathodes.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As opposed to refined cathodes  smiley-wink
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks for the help guys... I will need to get hold of some transistors but will give that a go.

Where is the best place to learn, (in very basic terms), what the transistors do..... i would be interested to understand why that one makes a good choice.... what considerations do I need make?
Logged

Texas
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
Lost in SPI FADE land
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This will give you alot of info on transistors and which you should use depending on your end goal for the circuit.

http://en.wikipedia.org/wiki/NPN_transistor#NPN
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33375
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Where is the best place to learn, (in very basic terms), what the transistors do
Also this might be helpful:-
http://www.kpsec.freeuk.com/trancirc.htm
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Where is the best place to learn, (in very basic terms), what the transistors do
Also this might be helpful:-
http://www.kpsec.freeuk.com/trancirc.htm
Cheers Mike, this is exactly the info I was after.....
I'm happy at some level just to be told which components to use but I know I will be asking the same question again for the next application. I now know how to work it out for myself..... onto the calculations!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Any special reason to use a PNP transistor to turn the LEDs on when the output low, as opposed to a NPN transistor that would turn them on when the output pin is high?

Thanks,

Chris

Yes this is right.... sorry but I thought it made no difference until I tried to draw a schematic! Makes perfect sense.

Yes, he's using RGB LEDs with common cathodes.
Logged

Pages: [1]   Go Up
Jump to: