Help needed to wire up an LED

Thread Starter

big10p

Joined May 25, 2013
35
Hi

I'm working on a simple project but, alas, my knowledge of electronics is pretty poor, so I'm hoping to be able to pick a knowledgeable person's brain. :)

So in my project, I have a 30mm 5v PC case fan which I'm powering by plugging it into a USB hub - using the black and red wires in a USB cable.

I have a green power LED (taken out of an old PC case) that I would like to wire up so that it illuminates when the fan is plugged in. I originally thought I could just wire the LED directly into the circuit, but it seems I need to add a resistor?

Is someone able to tell me how I should wire the LED and resistor correctly, and what 'size' resistor I need?

I'm afraid I'm not sure of the voltage rating etc. of the LED, but as it's a PC one that plugs directly into the standard motherboard socket found on all PCs, I'm hoping someone here will know?

Thanks in advance.
 

wayneh

Joined Sep 9, 2010
17,498
The LED and resistor (in series) will go in parallel to the fan. They will see the same power whether the fan is present or not, just as the fan sees the same power whether the LED is there or not.

The voltage drop across the LED is ~3V but the real value depends on color. I believe green is about 3.4. That means you need to drop 1.6V across the resistor. The LED is likely a standard 20mA LED, which will look fine with as little as 5mA. Dropping 1.6V carrying 5mA requires, per Ohm's law, 1.6/0.005 = 320Ω. A standard value is 330 but I'd look at a 270 or even a 220 (still only 7.3mA).
 

Thread Starter

big10p

Joined May 25, 2013
35
The LED and resistor (in series) will go in parallel to the fan. They will see the same power whether the fan is present or not, just as the fan sees the same power whether the LED is there or not.

The voltage drop across the LED is ~3V but the real value depends on color. I believe green is about 3.4. That means you need to drop 1.6V across the resistor. The LED is likely a standard 20mA LED, which will look fine with as little as 5mA. Dropping 1.6V carrying 5mA requires, per Ohm's law, 1.6/0.005 = 320Ω. A standard value is 330 but I'd look at a 270 or even a 220 (still only 7.3mA).
Thank you for your quick reply!

I think I understand everything you're saying, but to be certain, can you confirm that the (crude) diagram below is correct, please?



I read that a USB socket outputs 5v 500ma - will this be OK?
 

kubeek

Joined Sep 20, 2005
5,795
500mA is the max current you are allowed to draw from the port. The current drawn is dictated by the load - fan current plus led current. It does not mean the port outputs 500mA constantly so it can´t destroy anything on its own.
 

Thread Starter

big10p

Joined May 25, 2013
35
500mA is the max current you are allowed to draw from the port. The current drawn is dictated by the load - fan current plus led current. It does not mean the port outputs 500mA constantly so it can´t destroy anything on its own.
I see. Thanks.
 

wayneh

Joined Sep 9, 2010
17,498
Diagram looks good, and it's very unlikely that fan draws more than even 100mA. Should be fine. (It should have a mA rating on the label?)
 

Thread Starter

big10p

Joined May 25, 2013
35
Diagram looks good, and it's very unlikely that fan draws more than even 100mA. Should be fine. (It should have a mA rating on the label?)
There's no mA rating on it but it is rated at 1.2w - using an online converter, this equates to 0.24 amps, which is 240 mA, yes? So it should be OK.

Thank you all, for your help! It's much appreciated. ;)
 

Thread Starter

big10p

Joined May 25, 2013
35
Hi, I'm back with another question. :)

I now have the circuit working, as shown in the diagram I posted above. However, I would now like to be able to manually adjust the fan speed via a knob on the outside of the project's case. I would like to be able to adjust it from OFF to FULL SPEED.

To achieve this, it seems I need to use a potentiometer (linear?) but don't know what resistance rating I need, and am not sure exactly how to wire it into my existing circuit, so that it works in the way I described in the previous paragraph.

Is anyone able to help?

Thanks in advance.
 

wayneh

Joined Sep 9, 2010
17,498
You may be disappointed if you try to use a pot. You would need one that can handle at least 240mA and 1W. It would need to be low resistance, maybe 0-50Ω or 0-100Ω. I'm thinking log taper would be better, because 90 vs 100Ω will hardly matter compared to the difference between 10 vs 20Ω.

A better strategy for fan speed control is PWM and many folks resort to the venerable 555 timer IC to get the job done.
 

Thread Starter

big10p

Joined May 25, 2013
35
You may be disappointed if you try to use a pot. You would need one that can handle at least 240mA and 1W. It would need to be low resistance, maybe 0-50Ω or 0-100Ω. I'm thinking log taper would be better, because 90 vs 100Ω will hardly matter compared to the difference between 10 vs 20Ω.

A better strategy for fan speed control is PWM and many folks resort to the venerable 555 timer IC to get the job done.
Ah, right - this sounds like it's not going to be as straight-forward as I'd hoped, and beyond my abilities.

Thanks.
 

wayneh

Joined Sep 9, 2010
17,498
Ah, right - this sounds like it's not going to be as straight-forward as I'd hoped, and beyond my abilities.

Thanks.
Well, there is another approach that might be OK and is less complex. Some folks use the LM317 variable voltage regulator to do what you're thinking of. You still use a pot, but an inexpensive, low power one to adjust the LM317. With the right arrangement (it might take a little experimentation with resistors), you could probably get acceptable control of your fan speed. If you need good smooth control at the low end, PWM is much better but if you just need quick and dirty, it would work.

And you could still try the direct pot approach you first mentioned. Just be forewarned that it's not the greatest.

[edit] I changed my mind. The LM317 drops voltage - at least a volt or two, I forget the exact number - and since you are starting at only 5V, it won't allow you to ever get to full speed. : (
 

Thread Starter

big10p

Joined May 25, 2013
35
Well, there is another approach that might be OK and is less complex. Some folks use the LM317 variable voltage regulator to do what you're thinking of. You still use a pot, but an inexpensive, low power one to adjust the LM317. With the right arrangement (it might take a little experimentation with resistors), you could probably get acceptable control of your fan speed. If you need good smooth control at the low end, PWM is much better but if you just need quick and dirty, it would work.

And you could still try the direct pot approach you first mentioned. Just be forewarned that it's not the greatest.

[edit] I changed my mind. The LM317 drops voltage - at least a volt or two, I forget the exact number - and since you are starting at only 5V, it won't allow you to ever get to full speed. : (
It looks like the pot approach is going to be the best for me, I think (i.e. simple :p). I'm not bothered about being able to control the fan speed with super accuracy - in fact, something that basically allowed me to set the fan from OFF to HALF-SPEED(ish) to FULL SPEED(ish) would be fine.

Could you (or anyone) recommend a place/website to buy such a pot (in the UK)?

I need a small one that I can fix (bolt?) in place through a hole in my project's case, with a 1-2cm diameter knob.

Any pointers much appreciated.
 

wayneh

Joined Sep 9, 2010
17,498
... in fact, something that basically allowed me to set the fan from OFF to HALF-SPEED(ish) to FULL SPEED(ish) would be fine.
I thought of mentioning that. You could use a switch arrangement instead of a pot. The switches would switch in various resistances in series with the fan. So then your challenge would be to determine the resistor values that give you the speeds you want. Start with Ohm's law but you'll probably want to experiment. Resistors rated to 1W will be a lot cheaper and easier to find than a pot at that rating.

Note that the required power rating of the resistor will depend on it's value. If the fan really draws 0.24A at 5V (you could measure it to verify), you can think of it as a ~20Ω resistor. You'll have peak power dissipation in the resistor when it is also 20Ω (proof left for the reader :p). If, again, the fan is still acting like a 20Ω resistive load, the total current will be 5v/40Ω = 0.125A. Power dissipation in the motor or the resistor will be I^2*R = 0.31W. A 1/2 watt rated resistor gives you a bit of "clearance", but I'd go for a 1W to be safe. At any other value, a 1/2 watt would be fine since the power dissipation will be lower.
 

Thread Starter

big10p

Joined May 25, 2013
35
I thought of mentioning that. You could use a switch arrangement instead of a pot. The switches would switch in various resistances in series with the fan. So then your challenge would be to determine the resistor values that give you the speeds you want. Start with Ohm's law but you'll probably want to experiment. Resistors rated to 1W will be a lot cheaper and easier to find than a pot at that rating.

Note that the required power rating of the resistor will depend on it's value. If the fan really draws 0.24A at 5V (you could measure it to verify), you can think of it as a ~20Ω resistor. You'll have peak power dissipation in the resistor when it is also 20Ω (proof left for the reader :p). If, again, the fan is still acting like a 20Ω resistive load, the total current will be 5v/40Ω = 0.125A. Power dissipation in the motor or the resistor will be I^2*R = 0.31W. A 1/2 watt rated resistor gives you a bit of "clearance", but I'd go for a 1W to be safe. At any other value, a 1/2 watt would be fine since the power dissipation will be lower.
I'm struggling to understand all this, TBH - I'm just a noob at this stuff. :)

Are you saying a 20 ohm resistor would allow the fan to run at full speed? If so, what resistor would I need to run it at about half speed?

I don't have the equipment to measure resistance, etc.
 

wayneh

Joined Sep 9, 2010
17,498
I don't have the equipment to measure resistance, etc.
That's one thing you should fix. You can get one of these for under $5. If you watch, sometimes you can even get one free with another purchase.

Regarding your fan, I was speculating that it resembles a 20Ω load. If that's true - and only a datasheet or your own testing can verify this - then putting another 20Ω resistor is series with it will cut its voltage and speed roughly in half. A 10Ω resistor will cut it less, and a 50 or 100Ω resistor would drop it more, possibly stopping it.
 

Thread Starter

big10p

Joined May 25, 2013
35
That's one thing you should fix. You can get one of these for under $5. If you watch, sometimes you can even get one free with another purchase.

Regarding your fan, I was speculating that it resembles a 20Ω load. If that's true - and only a datasheet or your own testing can verify this - then putting another 20Ω resistor is series with it will cut its voltage and speed roughly in half. A 10Ω resistor will cut it less, and a 50 or 100Ω resistor would drop it more, possibly stopping it.
Thanks for the explanation - I'm clearer now on what's what. I guess I need to get myself a multimeter and do a bit of experimentation. I didn't realize multimeters were that cheap! :)
 
Top