Maker Pro
Maker Pro

Newb needs help with LEDs thru USB

Lasher

Dec 30, 2014
4
Joined
Dec 30, 2014
Messages
4
Hello there!
Being fairly nifty at getting computers to do what I want them to do I decided to give myself a headache by branching into a bit of work on the electronics side. Unfortunately this is where my lack of knowledge starts to bite so thought I'd pop on here and hopefully get a bit of advice.
I'm working on a head tracking system which requires me to mount 3 IR LEDs onto the headset I use so I thought I might be able to power them through the USB port.
The LED's specs are as follows...

IR LED - 5mm 940nm
Forwards Voltage 1.5 - 1.6v
Forward Current 60mA

Having done a bit of searching around and a bit of calculation it seems to me that if I take a line off the USB port (5V Output)
and I place 3 of these LEDs in serial The numbers seem to come out about right. It looks like I might need a 10 Ohm resistor at the end of the chain but from what I understand LEDs are pretty hardy anyway so that might not even be necessary.

Could someone just check my thinking on this and make sure I'm not just getting something fundamentally wrong here?
Many thanks in advance.
 

garublador

Oct 14, 2014
111
Joined
Oct 14, 2014
Messages
111
Your calculations give 20mA for the diodes, which is below the 60mA's that is specified. This may be on purpose if you don't want them to be at maximum brightness. A series resistor is almost always a good idea.

The calculation is to take the source voltage (5V), subtract the total drop (1.6*3=4.8) to get the voltage across the resistor (0.2V). To get the resistance you divice the voltage (0.2V) by the desired current (60mA) to get the desired resistance (3.33 ohms). You then find the closest resistor that's greater than that value. Once you undertand that, you can just use this site:

http://led.linear1.org/1led.wiz

It has a handy tool for deciding on a series/parallel arrangement.

One issue I see is that, 3 LED's in series gets you 4.8V of drop, which is pretty close to 5V. In fact, USB specs allow the voltage to be as low as 4.75V at the far end of the cable (where your device will be). So there's a chance that your device won't work correctly with all USB ports if you wire them that way.

Also, to comply with the USB spec, you have to only draw 100mA initially and negotiate with the host system (giant PITA) to see if you can get more (usually 500mA). If you are just making this as a project for yourself, you can probably just rely on always getting 500mA. If you are planning on supplying your own power supply (wall wart) you can find some that will supply up to 2A.

With all that in mind, the first question is: is there anything else in this system that will be drawing current from USB? If not you could do two in series and one in parallel with the other two. Or just all three in parallel. If you really only want 20mA per LED then you'll be safe with the 100mA either way assuming you aren't drawing any other current from USB. You can get away with 50mA per diode if you do the two in series in parallel with the third and still comply with the 100mA requirement, again, if you aren't pulling current elsewhere.
 

Lasher

Dec 30, 2014
4
Joined
Dec 30, 2014
Messages
4
Thanks for your reply Garublador.
I think I used a similar site to get the calculations I did so that kind of makes sense.
All of this will be running off the USB of my home PC system - there are other devices connected to the machine that use a little power from the USB but not from that port - this will be the only device plugged into the port and it only needs to power the LEDs - nothing else.
Maximum brightness is again not an issue - this is purely so the camera has an IR source to lock itself onto.
Would you still recommend that I place a resistor at the end of the series?
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Thanks for your reply Garublador.
I think I used a similar site to get the calculations I did so that kind of makes sense.
All of this will be running off the USB of my home PC system - there are other devices connected to the machine that use a little power from the USB but not from that port - this will be the only device plugged into the port and it only needs to power the LEDs - nothing else.
Maximum brightness is again not an issue - this is purely so the camera has an IR source to lock itself onto.
Would you still recommend that I place a resistor at the end of the series?
Yes. Always add a resistor in series to the string of LEDs. LED 'forward' voltage is presented as a range, and is not constant. Not using a current limiting resistor could very well allow the LEDs to draw too much current which could burn them out.
 

garublador

Oct 14, 2014
111
Joined
Oct 14, 2014
Messages
111
I'd 100% recommend the resistors. It will not only help protect your LED's from burning up, it will also allow you to change the brightness if needed.

If you're just planning on using it on your home PC you probably don't need to worry about the 100mA limit. I don't know that I've ever seen a USB port that can't supply 500mA and I doubt any of the ones that wouldn't supply that much are still functional. I'd still highly recommend either putting two in series and the other one in parallel or all three in parallel rather than all three in series. You don't want to be stuck wondering if your USB voltage is sufficient when you're debugging this later.
 

Lasher

Dec 30, 2014
4
Joined
Dec 30, 2014
Messages
4
Thanks for the answers guys.
If I understand you correctly Garublador my maths is a bit off and if I have them in series I'll need a 3.33 Ohm resistor.?
I did wonder about putting them in parallel - but them my brain started to explode thinking about having a resisitor on each LED rather than in the series and what the value of each resistor should be.....
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Lasher, There are resistor calculators out there specifically made for LED circuits.
Parallel circuit's are not so bad, and are commonly used when the supply voltage is too small for a string of LEDs.
Series circuit's are usually much simpler, as you only need the one resistor.

Regardless of the method though, it's always a good idea to look at the 'range' of the LED forward drop and the 'range' of the supply voltage.

Ie. for my car, I calculate the resistor based on the higher voltage it would see (14.4V... not the 12V) and the lowest voltage drop across the LED.. This allows me to use a resistor value that will maintain an acceptable current. Worst case, the battery is at it's highest, and the LEDs only drop the minimum expected forward voltage drop and I'll still be fine. If I calculated using 12V for the car instead, I ran the risk of pushing too much current through the LEDs when the motor was running.
Same holds true for your setup.

You will be getting 5V, which should stay pretty consistent, but your LEDs have a small range of forward voltage drop. Calculate the resistor based on the lower voltage drop, then double check the current using the LEDs highest voltage drop.
Once done, this will provide you with the expected 'range' of current that may pass through the LEDs. The highest range should be what the LED is rated for.. ie, 60mA. If the lowest range is too low... it may be time to remove an LED from your series string, and connect it as a parallel LED. This will ensure a more consistent, reliable brightness.
 

garublador

Oct 14, 2014
111
Joined
Oct 14, 2014
Messages
111
Thanks for the answers guys.
If I understand you correctly Garublador my maths is a bit off and if I have them in series I'll need a 3.33 Ohm resistor.?
Yes, but you'll probably find that those are difficult to find. There is a set of standard values used for resistors and you'll probably just want to pick the next one up, keeping Gryd3's comments about the ranges of values in mind.

I did wonder about putting them in parallel - but them my brain started to explode thinking about having a resisitor on each LED rather than in the series and what the value of each resistor should be.....
The parallel calculation is easy. You just use the same method for each path. So for one LED you'll have a voltage of 5V, a drop of 1.5 to 1.6V and you're shooting for around 60mA of current. You'll have three of those identical paths in parallel with one another each drawing 60mA. The total current draw will be 180mA if you put all three in parallel but only 60mA if you put them in series, but current draw doesn't seem like an issue in this case.

FWIW, that online calculator will do all this math for you and even tell you what standard value resistors to use and what sort of power handling they'll need. However, understanding how they got to their conclusion is probably a good idea.
 

Lasher

Dec 30, 2014
4
Joined
Dec 30, 2014
Messages
4
Excellent - and thank you all - I think that gives me the info I need to get the job done.
(If you do hear a loud bang and see a mushroom cloud forming over London though you'll know I got the maths wrong)
;-)
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
Excellent - and thank you all - I think that gives me the info I need to get the job done.
(If you do hear a loud bang and see a mushroom cloud forming over London though you'll know I got the maths wrong)
;-)
No prob.. if you want to increase the life of the device. Add more batteries in Parallel to the original battery (+ to +, and - to -) This will allow the batteries to put out more Amps at a time, and last longer, as the mAh will add with each new battery to the total pack. (Voltage will stay the same as long as it's parallel. You need to redesign your circuit if you connect batteries in Series!)
 
Top