# Resistor calculator program

• posted

Adding to my enquiry about how to determine the value of a resistor, here is a small program I wrote to calculate them.

Please let me know if I have screwed up somewhere.

Thanks Nigel

-- Redline Race Controls

Western Pacific Model Railways

• posted

hehehe John

I thought about it actually. I'll put some thought into it.

Nigel

• posted

I tried your program with a 12volt input, 3.5 LED voltage, and 3ma. The result was 2833 ohms, which can't possibly be right. The same LED came with a 476 ohm resistor...

• posted

I don't think you would get much light out of a LED operating at 3 ma. The calculation is correct BTW for 3 ma. If I check the current for the 470 ohm resistor in the same circuit it is a more realistic 18 ma. Now you may see some light.

I'm using Rob Paisley's calculator at:

I make my "test lamps" using any old LED and a 1k resistor in series. They work on 12V DC and DCC. Why 1k? Cause I have a bunch of them bought surplus.

• posted

It is right. Most of the LEDs that come with resistors are meant for computer usages, where the supply voltage is 5V. With a 5V supply, the dropping resister is calculated as 500 Ohms -- 476 is probably a 'close enough' stock value for a 5V supply. 3K Ohms is about right for a 12V supply.

"E> "E> -- "E> Frank Eva "E>

"E> "E> "E> "E>

\/ Robert Heller ||InterNet: snipped-for-privacy@cs.umass.edu

|| snipped-for-privacy@deepsoft.com
/\FidoNet: 1:321/153

• posted

OK - I tried this page and entered 12 volt input, 8.5 volt drop and 18ma current. I get 194 ohms and almost 3/4 watt. Still doesn't seem right. I picked up a supply of 1/4 and 1/8 watt resistors varying between 470 and 740 ohms. Nothing here would seem to work...

• posted

Hmmm.... I have never bought anything but LEDs marketed specifically for model railroad applications - from Miniatronics and Richmond Controls. The ones I got with Richmond Controls Golden Whites were 470 ohms.

• posted

: > I'm using Rob Paisley's calculator at: : >

: OK - I tried this page and entered 12 volt input, 8.5 volt drop and 18ma : current. I get 194 ohms and almost 3/4 watt. Still doesn't seem right. I : picked up a supply of 1/4 and 1/8 watt resistors varying between 470 and

740 : ohms. Nothing here would seem to work...

Frank, there may be a misunderstanding here - you don't want to drop 8.5 volts across the LED - more like 3.5 volts - which brings up 472. ohms and

0.153 watts. Your parts are right in the ballpark with Rob's calculator.

73, Bob

• posted

I thought the voltage drop would have to be higher in DCC, since that would still leave 8.5 volts going through the LED???

• posted

The volt drop depends on the LED, approx 1.5 for standard LEDs, 3.5 for 'white' LEDs. Put those values in the calculator, not the volt drop across the resistor, it works that out from the supply voltage. Keith

Make friends in the hobby. Visit Garratt photos for the big steam lovers.

• posted

Note that Rob includes voltage drops for the various colors of LEDs on the bottom of his circuit diagram. 3.5 volts applies to blue or white LEDs while

2 volts applies to red ones. These voltages are the voltages dropped across the LED junction itself and create the light. If you exceed this voltage (which can happen if the resistor is too small, making the current too high) the illumination can be quite bright but only for milliseconds while the LED blows... sometimes with a small bang.

Bob

• posted

"E> > It is right. Most of the LEDs that come with resistors are meant for "E> > computer usages, where the supply voltage is 5V. With a 5V supply, the "E> > dropping resister is calculated as 500 Ohms -- 476 is probably a 'close "E> > enough' stock value for a 5V supply. 3K Ohms is about right for a 12V "E> supply. "E> "E> Hmmm.... I have never bought anything but LEDs marketed specifically for "E> model railroad applications - from Miniatronics and Richmond Controls. The "E> ones I got with Richmond Controls Golden Whites were 470 ohms.

It would NOT suprise me if the MRR supliers that sell LEDs are just getting them from the same sources as companies like JameCo or DigiKey, who both are mostly dealing with computer people, not MRR people. Computer people deal with 5V supply voltages, since this is the TTL, CMOS, etc. supply voltage.

It is also likely that the original makers of the LEDs (eg Panasonic, etc.) publish data sheets and/or application notes aimed toward computer people and are again thinging in terms of 5V supplies, so these documents will talk about dropping resistors for 5V supplies. The MRR

*sales* people probably not really up on Omhs Law... That is, the MRR LED supliers are just re-packaging parts meant for a computer.

Note: in some cases the 5V supply is proper. I can easily imagine a MRR control panel fronting a TTL logic system using a 5V supply and using indicator LEDs tied to this 5V supply.

"E> "E> -- "E> Frank Eva "E>

"E> "E> "E>

\/ Robert Heller ||InterNet: snipped-for-privacy@cs.umass.edu

|| snipped-for-privacy@deepsoft.com
/\FidoNet: 1:321/153

• posted

"E> > I don't think you would get much light out of a LED operating at 3 ma. The "E> > calculation is correct BTW for 3 ma. If I check the current for the 470 "E> ohm "E> > resistor in the same circuit it is a more realistic 18 ma. Now you may see "E> > some light.

Not if the LED really is a low-power device!

"E> >

"E> > I'm using Rob Paisley's calculator at: "E> >

"E> "E> OK - I tried this page and entered 12 volt input, 8.5 volt drop and 18ma 3.5 is what you want! "E> current. I get 194 ohms and almost 3/4 watt. Still doesn't seem right. I "E> picked up a supply of 1/4 and 1/8 watt resistors varying between 470 and 740 "E> ohms. Nothing here would seem to work...

The form at

might be a little confusing to people who are not up on electric circuit design and the terminology used. The 'Voltage Drop Across LED' is the LED's rated voltage, not the voltage drop across the resistor! It is common to think of the resistor as a voltage dropping resistor, since that is what it is really doing. Actually, both the resistor and the LED are dropping voltage and are voltage dropping devices! Now I know you are totally confused! The idea is that they are each dropping a *part* of the 12volt supply. The trick is to get them to drop the proper share.

How much voltage a resistor will drop is a function of how much current is flowing. This is where Ohm's Law comes in. A resistor will drop a voltage (V) equal to the product of its resistance (R) and the current (I) flowing through it:

V = IR (1)

LEDs don't have the same flexibility. They will drop a specific voltage across their junctions, irrespective of the current. Extra current just makes the semiconductor hotter. Too much current and the semiconductor toasts. Ouch! So we need to adjust the resistor to 'balance' the load at a specific current. The first step is to determing the shares. We know the supply voltage (12) and the drop across the LED (3.5). The rest is dropped by the resister: 12 - 3.5 = 8.5 Volts.

We also know the desired current (the current rating of the LED), which is said to be 3 mA (.003A). Rearanging (1) above to solve for R gives:

V R = - (2a) I

8.5 R = ---- (2b) .003 R = 2833.3333 (2c)

So we want a 2833.3333 Ohm resistor (or there about).

The power (P), in watts, disipated by the resistor (or any load) is:

P = IV (3a)

P = .003 * 8.5 (3b)

P = .0255 (3c)

So, what you want for a 3.5V, 3ma LED using a 12 supply voltage is a

2833 Ohm resistor. The closest stock 5% resistor will be 3K (orange-black-red-gold). 1/8 (.125) Watt is more than enough, since the power disipated is small. Using a *larger* value resistor will *reduce* the current slightly. It is generally better to run the LED at a slightly *lower* current than at a slightly *higher* current. If we 'back solve' for current:

V I = - (4a) (rearranged from (1)) R

8.5 I = ---- (4b) 3000

I = .0028 A (2.8 mA) (4c)

With a 3K resister the LED will be running at 2.8 mA, which is within its tolerance and close to its max. It will be ever so slightly dimmer that its maximum brightness. Better than every so briefly brighter than its maximum brightness :-(. And a 3K 1/8W 5% carbon resistor is ever so much cheaper than several 1% resistors...

Spec. sheets for LEDs (and for most *passive* devices) rate their devices in 'Volts' -- this really means 'Voltage Drop Across device'. Since only 'active' devices (like batteries and power suplies) can produce a voltage, the voltage rating for all passive devices always means the '[Maximum or Rated] Voltage Drop Across' or else refers to the dielectric strength (the voltage level that will 'jump the gap' -- typically this relates to capacitors). This is universally understood by electric circuit designers. The voltage for any 'load' type device is its voltage drop. Some devices don't have a specific voltage drop (resistors are like this) other devices have a maximum voltage drop or an operating voltage drop (LEDs are like this). Other devices have a dielectric strength, which is the measure of how many volts of electrical presure it takes to jump the gap (this relates to capacitors).

If you used too small a resistor *once*, you could have toasted the LED

-- using the right one later will be no help. Unlike a incandensant lamp, a LED will burnout in miliseconds -- far too brief for you to see the flash of burning semiconductor... *Always* try the largest value resistor first and only start using lower valued ones if the larger values fail to give the desired results. Also, LEDs are polarized. Swaping + and - can make a difference in whether or not the LED lights up. Wiring it backwards with any random resistor value will produce no light at all.

"E> "E> "E>

\/ Robert Heller ||InterNet: snipped-for-privacy@cs.umass.edu

|| snipped-for-privacy@deepsoft.com
/\FidoNet: 1:321/153

• posted

No, DCC is no different than plain DC. DCC just adds a signal in the form of a higher frequency square wave. This signal is not used by any random DC loads across the power bus, just the base 12VDC supply current. You want 3.5 volts across the LED. With a 12VDC supply, the resistor drops 8.5 Volts, but this subtraction is handled internally by the various calculator programs, so you just need to enter the supply voltage (12) and the LED voltage (3.5) plus the current and go from there.

"E> "E> -- "E> Frank Eva "E>

"E> "E> "E>

\/ Robert Heller ||InterNet: snipped-for-privacy@cs.umass.edu

|| snipped-for-privacy@deepsoft.com
/\FidoNet: 1:321/153

• posted

I know you took a LOT of time to explain this, and this is the value I got. Trouble is, I was using ratings that had been suggested by users here... I wonder if the actual ratings for Golden White LEDs are very different from what has been suggested, because Richmond Controls recommended a 470 ohm resistor for nice bright lights!

• posted

It would seem then that there is a lot of disagreement about the current rating - someone suggested 18ma, and that's what I used to verify Richmond Controls' suggested resistor: 470 ohms (the calculator came up with 472.22 ohms)

• posted

OK - Using your program, with a 5V supply, 3.5V across load, and 3ma - I get

500 ohms - not 2833!

Also, the LED I want to try is rated at 30ma maximum current. At 18ma and

12V supply, I get 472.22 ohms. So, a 470 ohm resistor should do the trick.
• posted

So why don't you try it with the 470 as recommended, it will be fine.

The vast majority of LEDs give their rated light output at 20mA. The maximum current will be somewhere between 25mA and 40mA. All these figures can be found in an electronics catalogue, eg Jameco. 'High efficiency' LEDs are rated at 10mA and 'Low current' LEDs at

2mA, even so they still have maximum currents around 30mA so a 470 Ohm resistor will still be OK and you are unlikely to have one of these anyway. All the white LEDs in the catalogues I've looked at are rated at 20mA.

Keith Make friends in the hobby. Visit Garratt photos for the big steam lovers.

• posted

Right. *But* 470 Ohms is also the proper value for a 3ma LED with a 5V supply. The question is this: exactly what is the specification for these LEDs? If they really are 3ma LEDs, then 3K is the proper value for a 12V supply. Running 3ma LEDs at 18ma will most likey toast the LEDs... If you in fact did this, it is likely that your LEDs are dead at this point.

I would go on-line to

and try to find the LEDs there -- DigiKey is very good at listing the published specs for things like LEDs. You should be able to find out what the current rating for the LED is.

Conventional LEDs do have a current rating of about 20ma, but the technology is always changing and it is entirely possible that a more 'efficient' LED technology is emerging, so it is quite possible that these new LEDs will function at 3ma, not 20ma.

"E> -- "E> Frank Eva "E>

"E> "E> "E>

\/ Robert Heller ||InterNet: snipped-for-privacy@cs.umass.edu

|| snipped-for-privacy@deepsoft.com
/\FidoNet: 1:321/153

• posted

"E> > "E> > It is right. Most of the LEDs that come with resistors are meant "E> for "E> > "E> > computer usages, where the supply voltage is 5V. With a 5V supply, "E> the "E> > "E> > dropping resister is calculated as 500 Ohms -- 476 is probably a "E> 'close "E> > "E> > enough' stock value for a 5V supply. 3K Ohms is about right for a "E> 12V "E> > "E> supply. "E> "E> OK - Using your program, with a 5V supply, 3.5V across load, and 3ma - I get "E> 500 ohms - not 2833! "E> "E> Also, the LED I want to try is rated at 30ma maximum current. At 18ma and "E> 12V supply, I get 472.22 ohms. So, a 470 ohm resistor should do the trick.

Ah, so it is 30ma -- earlier in this thread, you said that it was 3ma -- did you somehow misplace a 0?

"E> "E> -- "E> Frank Eva "E>