How to wire up an simple LED with ever changing voltage

Heavydoody

Joined Jul 31, 2009
140
>
Regulating the current to a set value (in this case, 20 mA) is exactly what
we want to do here in order to have the LED work properly. The point is
that, since the current through a diode depends exponentially on the
voltage drop, the only reliable way of running a LED is via a current
source, such as a constant voltage source plus dropping resistor or a
current limiting diode or a regulator IC hooked up to regulate current.

No, if 20 mA are flowing through the diode, the voltage drop across the
diode will be 3.3 V, so the LED will dissipate 66mW, which is just fine.
240 mW is the dissipation across the whole circuit --- the remaining
174 mW will go into heating the dropping resistor.
Thanks for the explanation. I never thought about it that way. So the LED is like any other diode and it will always (within reason) drop the same voltage, similar to a Zener. This creates a basic voltage regulator circuit in conjunction with the current regulator to prevent overall circuit overload. The load is also the voltage regulator. That's pretty cool. Thanks again.
 

jj_alukkas

Joined Jan 8, 2009
753
LED's are sometimes used in circuits for voltage reference instead of zenners. But they cant be used as zenners because of their delicacy only to stand a few mA's.
 

Thread Starter

princess blacklung

Joined Aug 13, 2009
7
Sorry for my late reply - I had a family emergency to attend to.
Well, I have purchased the previously suggested components and have decided to build my little LED lamp. But before I do that and destroy everything I thought I'd whip up a little schematic and show it to you guys first. (Like I said before, I am a total amateur, but I have started reading all the documentation on this site to bring myself up to speed)

just to recap in case you missed it, I want to connect an LED to my tattoo machine, but since the voltage changes as the machines power is manually adjusted up and down, there is no one resistor that will fit the bill... which is why a voltage regulator (in a transistor case) was suggested... however, I am unsure how this is supposed to work, where to wire the 'ground' on the transistor.

I'm sorry if my questions are really elementary, I am an admitted n00b way out of my element, but I do want to learn from this project and appreciate any and all advice.

 

hardsoft

Joined Sep 7, 2009
13
princess blacklung, which pieces did you purchase exactly, the lm317?

The best thing to do in these types of situations is make love to the datasheet. I'd reccomend going to www.national.com and downloading their copy of the lm317 datasheet.

There's a section in the datasheet labeled "typical applications" which contains a configuration for a "precision current limiter" which is essentially a constant current source. It is a very simple circuit and I highly recommend it for your application. LEDs are current driven devices. The brightness is directly effected by the current flowing through them. As they heat up and under varying conditions their voltage drop will change effecting the current flowing through them (and their brightness) when voltage regulation is used. The brightness of an LED can change a lot even with a steady voltage, and you can potentially overdrive the LED if you don't choose a conservative current limiting resistor. This is why I'd recommend current regulation. It will help insure steady brightness regardless of a changing voltage drop across the LED or a changing voltage of your power supply (which you'll obviously have).

Here is another website that describes how to use the lm317 as a current regulator
http://users.telenet.be/davshomepage/current-source.htm

The resistor is pretty easy to calculate. R = Vref / I
Vref for the LM317 is 1.25
I is the current, you say 20mA, if that is the max for the LED I'd suggest a little less, say 18mA to play it safe and guarantee long life (maybe I'm being anal)
1.25 V / 0.018A = 62.5 Ohms or something close. You can see the resistor goes between the OUTPUT and the feedback pin.

You can use a pot (like shown in the National datasheet) to adjust the brightness but just make sure you don't overdrive the LED. A pot in series with a 62 Ohm resistor would prevent overdrive, and allow you to dim the LED as desired from no current up to 18mA. Just make sure the pot or resistor you use can handle the power. P = V * I. The voltage drop across the current sense resistor is 1.25 volts and the current is whatever you set it to. So for 0.018A * 1.25 = 0.023W so nevermind, almost any resistor will be able to handle that small amount of power no problem.

As a side note it's usually a good idea to put a capacitor in front of the LM317. Something like a 0.1uF from the Input to ground will help insure stable operation.
 
Last edited:

CDRIVE

Joined Jul 1, 2008
2,219
Connect the GND terminal of the regulator to the negative terminal of the supply. Also move the resistor. It belongs between the Output terminal of the regulator and the Anode of the LED.

Notes: Since your tattoo machine drives, what I believe to be a buzzing solenoid, there's a very good chance that it's not filtered and therefore delivers pulsating DC to the solenoid. If so, the regulator won't like that at all. Here's a way to compensate for that by adding a diode and a filter cap. The C value of C1 is not critical but should be at least 100uF or greater.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Just a quick re-cap...
In your very first post, you mentioned that the specifications for your LED were:
Vf:3.2-3.4, If:20mA

An LM317 when used in current regulation mode has a minimum "drop" across itself of 3v.

So, the minimum voltage on the power supply to ensure that the LED will light is the Vf of the LED, plus the drop of the regulator, or 3.4v+3v = 6.4v.

If you operate your power supply at less than about 6.4v, then using the LM317 as a current regulator will not work very well. If you always use it at >= 6.4v, then it should work just fine. If lower, then you'll need to use it in voltage regulator mode similar to what CDrive posted.

If it is a fixed 5V regulator like a 7805, then you will need at least 7v input to the regulator, because 78xx series regulators have a 2v "drop" from input to output. [eta] CDrives' schematic will require an extra 0.7v supply to the 1N4002 diode in the path, but if your power supply is at least 7.7v, that won't be a problem. The value for R1 should be (5v-3.4v)/20mA = 80 Ohms; since 80 Ohms is not a standard value, use an 82 Ohm resistor.

It's pretty easy to use the LM317 regulator in current mode.
1) Connect a 62 Ohm resistor between the LM317s' OUT and ADJ terminals.
2) Connect the anode of the LED to the LM317s' ADJ terminal.
3) Connect the LM317s' IN terminal to the V+ output of your supply.
4) Connect the cathode of the LED to your power supply return (V-)

Note that LEDs have to be connected so that their cathode (the shorter lead) is at a more negative potential than the anode (longer lead). If the leads are trimmed already, the cathode is the lead connected to the internal part of the LED that looks like an anvil.
There is a drawing on this page: http://www.bcae1.com/led.htm that more clearly illustrates what I'm talking about.
 
Last edited:

Thread Starter

princess blacklung

Joined Aug 13, 2009
7
Thanks again for the all the helpful replies! Just a few quick notes: They didn't have anything by National (LM317) at the shop I went to, but sold me the Toshiba equivelent. I got the data sheet for it just in case, but of course it's all in Japanese.

As far as voltage, I never run my supply under 8 volts... and typically never over 12 volts. (without boring you about the specifics of my job, different applications of ink in different areas of the human body require that the machines run fast, slow, smooth, heavy, light, etc... much of which is directly affected by voltage - like an old Edison engraving machine)

I've been learning so much from this thread, thanks again for all the help.
I think I'm going to just order a few LM317s on the net so I can be on the same page as everyone else (and have the datasheet)

PS - here's the datasheet for the Toshiba current regulator
http://www.*****************/node/69642

(Edit - wonder why my datasheetpro link is turning into asterisks?)

I'll post a followup!
 
Last edited:

Thread Starter

princess blacklung

Joined Aug 13, 2009
7
Ok, here is the prototype. I tried wiring it up via the example on the aforementioned link regarding "Current Source with LM317."
(remember, this is the toshiba equiv. but I compared the data sheets and they should behave the same from what I could see)

Anyway, the long and the short of it is that it worked great. As predicted, when the voltage is dropped under around 6v it doesn't light up at all. And if the voltage starts escalating upwards around 13 volts or so (I never run my machine that high anyway) it keeps the light at an even unquivering brightness.

I guess I just wanted to make sure that A.) I'm running everything with the right numbers to make sure that I don't cut short the LEDs lifetime. and B.) Make sure I didn't wire something oddly that would make everyone here slap their foreheads (though I'm sure I've caused enough of that by now!)

Again, sorry for my ghetto photoshop action below, but I think it should illustrate adequately what I've constructed. I chose an adjustable resistor so in case I needed more or less I wouldn't have to keep running out to the robotics shop.

I guess now I'll have to get a multi meter to check out all the numbers?

Once again everybody, thanks so much for all your advice. It's been extremely educational and helpful.
 

SgtWookie

Joined Jul 17, 2007
22,230
If you didn't have the value of the pot set close to correct before you turned power on, you may have shortened the life of the LED already by applying too much current through it.

If you don't have a multimeter, Harbor Freight sells them quite inexpensively. There might be one near you. Link: http://www.harborfreight.com/cpi/ctaf/displayitem.taf?Itemnumber=90899
I have several of these; they're surprisingly accurate for the price, and if one gets broken or stolen I'm only out a few bucks. I've given up on paying $200 for a good meter.

To give the pot an initial adjustment:
1) Ensure that the power supply is turned off.
2) Disconnect one end of the pot.
3) Set the multimeter to the Ω 200 scale, and turn it on.
4) Connect the meter's test probes; red to the V-Ω-mA socket, black to COM.
5) Put one test probe on one of the pots' leads, the other test probe on the other lead.
6) Adjust the pot until you read 62 to 63 Ohms on the meter.
7) Turn the meter off.
8) Re-connect the disconnected pot lead.

To measure/set the LED current: (it will help to have an extra set of hands)
1) Disconnect the cathode of the LED from the power supply return.
2) Set the multimeter to the DCA 200m scale, and turn it on.
3) Connect the meter's test probes; red to the V-Ω-mA socket, black to COM.
4) Connect the red meter lead to the LED's cathode, and the black to the power supply return.
5) Turn on the supply, adjust to around 8v-9v.
6) Read the current on the multimeter. If it does not show 20, then carefully adjust the potentiometer one way or the other until it reads between 19 and 20.
7) Turn off the power supply.
8) Re-connect the LED cathode to the power supply return.
9) Turn the power supply back on, check to see that the LED is still working.
10) Set the meter to DCV 20 scale.
11) Measure the voltage across the LED's leads; black test probe on the cathode, red on the anode. This will be your LED's actual Vf with 20mA flowing through it. According to the original specifications you posted, it should be between 3.2v and 3.4v.
12) Measure the voltage across the pot, red test probe on the OUT terminal of the regulator, black test probe on the ADJ terminal of the regulator. This is the regulator's Vref (voltage reference). With the LM317 regulator, Vref is nominally 1.25v, but may range anywhere from 1.2v to 1.3v and still be within manufacturer's specifications. Vref may vary from regulator to regulator.
13) Turn off the power supply and the meter.

Once you have Vref and the current set to a known value, you can calculate what the resistance of the pot is.
Iout = Vref/R1 (pot)
Conversely,
R1 = Vref/Iout
So, if your regulator has a Vref of 1.25v and you have 20mA flowing through the LED:
R1 = 1.25v/20mA = 1.25/0.02 = 62.5 Ohms.
A standard table of resistance values is here: http://www.logwell.com/tech/components/resistor_values.html
E12 (yellow columns) and E24 (green columns) values are typically available at local stores.
The closest standard E24 value is 62 Ohms. Let's see what happens to the current when we use that value of resistance:
Iout = 1.25/R1
Iout = 1.25/62 = 0.0201613A = 20.1613mA. This is less than 1% over the rated current of the LED, which is acceptable.

If your local shop does not have a 62 Ohm resistor, you can use combinations of resistors in series or/and parallel to arrive at the correct value.
Here is an online calculator to determine various values you could use: http://www.qsl.net/in3otd/parallr.html
 
Last edited:
Top