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 (http://www.fairchildsemi.com/ds/BS/BS170.pdf)
Thanks for your time.
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.
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!!
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 ....
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?
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 (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.
Remember if you are going to use RGB LEDs then you can't put the resistor in the common line.
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?
Yup, that work too. Electrons don't really care.
What's the part number of the RGB LED with the seperate sets of leads?
Hi again CrossRoads,
The Led's I'm gonna be using I found on Ebay Here:
But I actually bought them cheaper here:
They took about a week to arrive.
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 (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.
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.
Well, those will be bright at 20mA!
Will have to adust resistors for the colors not only for even current draw, but perceived brightness
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!)
The 2nd link shows different specs
Not nearly the brightness, probably why they are less expensive.
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?
Looks like you have a maximum current consumption of 10 x 20mA per colour per board, total 200mA (which is just fine for a BC337 to switch). Times 3 for the colours and you have 600mA total per board. Multiply that by 14 and you get 8.4A. So yes, you will need a high current power supply. One possibility is a standard ATX computer supply.
It would be easier to use higher voltage and lower current. If the LEDs drop 3.2v each, then instead of 10 led/resistor combinations in parallel, you could have 2 sets of (5 leds in series + one resistor). This would drop around 16v, so you would need (say) a 20v supply to drive it, and drop 4v in the series resistor. But it would consume 40mA per colour per board instead of 200mA. That brings the total power requirement to 1.68A at 20v, which is more manageable than 5v 8.4A.
Another option is 5 parallel groups of 2 leds in series, which would need about 9v @ 4.2A. If your boards had 12 leds instead of 10, you would have even more options, i.e. 12x1, 6x2, 3x4, 4x3.
Thanks dc42, I think a big revision is order, but its good to learn. I do have a spare ATX power supply but it is a little unsightly, so maybe a trip to Ebay is order to source a possible supply.
Can't thank you enough for your help.
The transistors just switch. The power supply gives them something to switch.
Hey Grumpy_Mike, yeah felt a little stupid after asking and not thinking about it properly lol. Thanks.
Edit: So been thinking about what dc42 said and rummaging through my box of hoarded power supplies I have found an old laptop power supply rated at 20V 3.25A DC does anybody think this might be ok?
Edit 2: Final circuit being added below! (hopefully!!!!lol)
Add up the volts drop, I think there are too many LEDs. Anything with a current limiting resistor under 50R is pushing it for constant current like behaviour.
Ahh ok so green and blue look ok but red need a rethink?
No other way round, green and blue have bigger forward volts drops so you reach 20V with less LEDs than the red.
Awww man thought I had it!
Ok so the LEDs in my circuit:
Blue Vf = 3.1V:
So 3.1 x 5 = 15.5v
Green Vf = 3.07V:
So 3.07 x 5 = 15.35V
What am I missing?
What am I missing?
The fact that on that schematic you showed 10 LEDs in series not 5. This changes the maths. :)
Oh I thought I had done the red as 10 in series and the blue and green as 2 x 5 series each, I will check!
Edit: I've check my circuit and the red led's have 10 in series and the blue and green have 2 x 5 led series in parallel each.
The green and the blues look ok, but the voltage drop across 10 red LEDs is too close to 20v for the series resistor to regulate the current well enough. Go for two chains of 5 red leds too.
Thanks dc42 so should be good with this final schem!
Yes looking good. :)
Okey dokey, off to produce a few pcb's. Can't thank everyone enough for your patience and help.