Go Down

Topic: Multiple leds on one arduino pin? (Read 11221 times) previous topic - next topic

dutchboy

Hi all,

I've been googlin' like mad to try and work out a way of running a string of parallel leds off of one arduino pin.

After mucking about with transistors I think what I needed was a FET. I wanted to run 10 leds of the one pin and came up with the circuit attached (hopefully self explanatory) but to be honest I really just had a look at other similar circuits hence the 100R resistor and 10K to ground. I put these in as I have seen them on many other similar circuits but don't understand fully why (apart from limiting the output current of the arduino pin). I figured after a while (and some ebaying!!!) to hook this up and see if i got my desired result and it seems to work with the standard fade example, but was wondering if anyone had any reason why I shouldn't do this, i.e blowing up my arduino, damaging pin etc.

Circuit attached and data sheet for the FET used.

BS170 N Channel FET rated at 500ma - www.fairchildsemi.com/ds/BS/BS170.pdf

Thanks for your time.


CrossRoads

Looks great to me. Gonna be very bright - wear shades!

100R limits current out of arduino into the Gate capacitance of the MOSFET. (Uncharged cap looks like a short circuit.)
10K keeps the MOSFET off while the Arduino resets and all IO pins are inputs, prior to sketch taking over and turning them off or on.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dutchboy

Hey there CrossRoads,

Looks like the research paid off lol. Thanks for your response. Bright is exactly what I was going for. Gonna transfer these to some RGB's and make up some bright strips!!

Thanks again.

CrossRoads

Ok, the Resistors may have to change then. Vf of LEDs varies a lot by color.

I thought I was looking at one of my old posts whenI saw the schematic ....
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dutchboy

#4
Nov 19, 2011, 08:51 am Last Edit: Nov 19, 2011, 09:09 am by dutchboy Reason: 1
Yep, i'm in the process of calculating the correct resistor values for each of the colours right now. Thanks again for your help an of course one more quick question (lol there's always more questions right!!), can I swap the resistors to the Cathode side of the led's (would help when etching up my pcb -no jumpers etc). I've read that it does not matter which side of the led the resistor goes but was unsure in this case if this was ok?

dc42

1. The BS170 isn't a good choice for the mosfet because it isn't logic level. Fig 1 on the data sheet http://www.fairchildsemi.com/ds/BS/BS170.pdf suggests that its performance with 4v to 5v gate drive will be marginal. If you only want to switch up to 500mA, you could use a bipolar transistor (not darlington) such as BC337 instead (use a resistor from Arduino pin to transistor base of about 180 ohms, and you don't need a pulldown resistor). For more than 0.5A, choose a logic level mosfet.

2. Yes you can put the resistors in series with the cathodes instead of the anodes.

3. A minor point: I would connect the 10k gate pulldown resistor from Arduino pin to ground, i.e. connect it to the other side of the 100 ohm resistor. That way, it doesn't reduce the gate voltage drive to the mosfet slightly.
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.

Grumpy_Mike

Remember if you are going to use RGB LEDs then you can't put the resistor in the common line.

dutchboy

#7
Nov 19, 2011, 11:10 am Last Edit: Nov 19, 2011, 11:53 am by dutchboy Reason: 1
Hi dc42 and Grumpy_Mike thanks for the info, I will look into the BC337 as I have a few lying around. The RGB's I have do not have a common anode or cathode, they have 6 pins A & C for all three diodes so I guess i'm good for the resistors as I can treat them as separate leds.

I'll also adjust where I put the 10K as suggested or of course omit it in the case of using the BC337.

Thanks for all your replies.

Update: New Circuit should look like this?

CrossRoads

Yup, that work too. Electrons don't really care.

What's the part number of the RGB LED with the seperate sets of leads?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


dc42

#10
Nov 20, 2011, 10:37 am Last Edit: Nov 20, 2011, 10:41 am by dc42 Reason: 1
The specification of the LEDs on that first link suggests that the maximum continuous forward current is 20mA, and 30mA is the peak rating for short pulses (the second link doesn't give any current ratings). So I suggest you choose the series resistors for 20mA per LED, unless you know that your LEDs are rated at 30mA continuous. The BC337 is likely to drop 0.2v or a bit more and you can allow for this in your calculations. You may find that the red one has a lower voltage drop and needs a higher value resistor.

I have a couple of similar LEDs in 6-pin mini-DIP packages, which I think are probably these http://www.rapidonline.com/Electronic-Components/Full-colour-6-pin-LED-ndash-Chameleon-71502. Unfortunately the lead spacing is 2mm rather than 2.5mm so they won't fit in a breadboard or stripboard.
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.

dutchboy

Hi dc42, yep after even more googlin'  on theses leds i had settled on resistors rated for 20ma I also intend to test a few for forward voltages etc just to make sure. I'll also most likely end up putting a higher rated resistor on the green as it tends to take over when mixing yellow (from experience of other RGB's). I've actually produced my own pcb to put these on (toner transfer method and ferric chloride etch) so they fit beautifully on the board. This was my first first experiment with SMT components and it has worked well in my tests.

Thank you for your help with this I really appreciate it and will post pics and maybe a vid when I'm finished on my blog.

CrossRoads

Well, those will be bright at 20mA!
Luminous Intensity:
RED:6000mcd;
BLUE:5500mcd;
GREEN:6500mcd

Will have to adust resistors for the colors not only for even current draw, but perceived brightness
RED:1.8-2.4V;
BLUE:3.0-3.6V;
GREEN:3.0-3.6V

Figure on calculating current based on the lower voltage drop too, for example with 5V source, 0.5 across a transistor, and 120 ohm resistor:
(5-2.4-.5)/120 = 17.5mA
(5-1.8-0.5)/120 = 22.5mA  << so a higher value resistor is needed

Similarly for a 50 ohm resistor:
(5-3.6-.5)/50 = 18mA
(5-3.0-0.5)/50 = 30mA  << so a higher value resistor is needed

and the data says that at 30mA
*Pulse width?0.1msec duty?1/10

Also, many datasheets (not found for this one) say that the life expectancy of LEDs drops when they are driven at the  higher currents.

Looks like 1.8mm pitch on the pads, very workable by hand (vs 0.5mm on the FT232RL chips!)
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

The 2nd link shows different specs




Quantity:50pcs

Emitting Colour:Red/Green/Blue

Forward Voltage:3.4~3.6V

Luminous(MCD):
Red 1000~1200
Green 3000~4000
Blue 1000~1500

Not nearly the brightness, probably why they are less expensive.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dutchboy

Hey CrossRoads, great info thanks. I'll get calculating straight away.

I'm not overly worried about the brightness especially with 10 on each board.

I'm looking at running around 12 to 14 of these boards using shift registers. Am I gonna need a high current power supply or am I right in thinking that the transistors are doing the work?

Go Up