Maker Pro
Maker Pro

Evaluating a cap. power supply in LTSpice

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
I need to run a LED as an indicator light when a switch is thrown by a irrigation control system. The switch shows 10VAC when closed. Would using a capacitor power supply be my simplest way of powering the LED off of the 10VAC? I tried to evaluate the system in question on LTSpice, but the reading's I get when I probe across various nodes doesn't make sense.. i.e. - voltage to the LED shows 10VAC, where I had expected the voltage to be attenuated by the circuit. Does anyone know what I am doing wrong?

Thanks in advance!

capacpowersupply_zps13fcf7ae.jpg
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Here's about the simplest way to power an LED from 10VAC.

simplest led from 10vac.gif

V1 is a 10V AC source. "10V AC" means 10V AC RMS, which is actually a peak voltage of 14.14V. (This value is sqrt(200).) That's why the voltage is shown as 14.142V. And you can ignore the + and - symbols in the circle.

R1 limits the current drawn from V1. On half-cycles when the top wire from V1 is positive, current flows through R1 and LED1. On the other half-cycles when the top wire from V1 is negative, current flows through R1 and D1. D1 is needed to protect the LED from reverse voltage; a reverse voltage above about 5V will damage an LED.

With R1 = 330 ohms, the average (mean) LED current is around 10 mA. This will give a moderate brightness. If you need higher brightness, you can use a more efficient LED. If you want to run the LED at a current much higher than 10 mA you should probably use a different circuit; this circuit has a peak current about 3.5 times the average current, and high peak current can damage LEDs as well.
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
You can replace D1 with another led. Make sure it is connected the right way round and each led will protect the other. Two for the price of one!
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thanks Kris!
V1 is a 10V AC source. "10V AC" means 10V AC RMS, which is actually a peak voltage of 14.14V. (This value is sqrt(200).) That's why the voltage is shown as 14.142V. And you can ignore the + and - symbols in the circle.
Understood :)

R1 limits the current drawn from V1. On half-cycles when the top wire from V1 is positive, current flows through R1 and LED1. On the other half-cycles when the top wire from V1 is negative, current flows through R1 and D1. D1 is needed to protect the LED from reverse voltage; a reverse voltage above about 5V will damage an LED.
I completely followed that! Being able to visualize the path of current is very exciting for me, I have always wanted to understand "how" these circuits worked, understanding that most discretes are little more than switches, being able to follow the path starts with how the "flow" goes. Thank you!!


With R1 = 330 ohms, the average (mean) LED current is around 10 mA. This will give a moderate brightness. If you need higher brightness, you can use a more efficient LED. If you want to run the LED at a current much higher than 10 mA you should probably use a different circuit; this circuit has a peak current about 3.5 times the average current, and high peak current can damage LEDs as well.

Alas, I am lost again - I take it that you meant the average common LED uses about 10mA. With that in mind, using Ohm's Law I=V/R 0.01=14.14/R R would equal 1414 ohms using peak voltage or 1k ohms using RMS.

Why was 330 ohms used?
How is the peak current about 3.5x the average current?
Most LED's spec sheets that I have seen like between 2-2.6v - How is the volt potential being maintained between the cathode of the LED and the resistor?
What is the voltage between those two points?

Sorry for all the questions, but I need to start analyzing simple circuits if I ever hope to comprehend more complex ones!

TIA
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, here's the full LTspice simulation.

10vac led simulation.gif

The green trace relates to the voltage markings on the left side of the graph, and shows the voltage at the top of R1 relative to the bottom line of the circuit (that's connected to the downwards-pointing triangle).

As you can see, the voltage at the top of R1 changes continuously between a positive peak of about 14.14V, through 0V, down to a negative peak of about -14.14V, then back again.

The blue trace shows the LED current, and it relates to the current scale at the right side of the graph. The shape of this waveform is important.

You can see that the peak LED current is about 37 mA, but the LED spends more than half its time OFF. That's during the negative half-cycles, when current flow is in the wrong direction for the LED, and D1 conducts.

Even during the positive half-cycles, the LED current rises and falls with the waveform, as you would expect. Also, it doesn't reach zero when the AC voltage crosses the 0V threshold, because the LED needs typically 1.5~2V (for a red LED) across it before it lights up.

LTspice has a useful feature where you can Ctrl-click on the graph heading (the blue "I(Led1)" text right at the top of the graph) and it will show you the average and RMS values for the trace. You can see these figures on the dialog box to the right of the schematic.

LTspice tells you that the average (mean) LED current is 10.814 mA. The mean current is what determines the apparent brightness, and a standard LED at 10 mA is only moderately bright.

The peak current is about 3.5 times the mean current. This is because (a) the LED spends more than half its time completely OFF, and (b) when it's ON, its current does not jump right up to the maximum; it's curved on the way up and the way down.

So the LED is subjected to a peak current of about 37 mA but it only generates light equivalent to a current of 10 mA.

You can use Ohm's Law to calculate that peak current. The peak voltage is 14.14V, and let's assume the LED forward voltage will be 2.14V, so there will be 12V remaining across the resistor. V=12, R=330, so I=V/R = 12/330 = 36.36 mA which fits pretty closely with the graph.

I hope that answers all your questions. If not, please ask again.
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
The positive half cycle starts at 0V and peaks at 14.4V Edit 14.14V
The led needs a voltage of say 2.5V to turn it on so the current starts when the input is 2.5V and peaks when the input is 14.4V. At the peak there is 11.6V to drop across the resistor. If 330 ohm is used, the peak current will be 35mA but the mean will be much less than this. If you know calculus, you can use integration to find the mean or get LTspice to do it for you.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
The positive half cycle starts at 0V and peaks at 14.4V Edit 14.14V
The led needs a voltage of say 2.5V to turn it on so the current starts when the input is 2.5V and peaks when the input is 14.4V. At the peak there is 11.6V to drop across the resistor. If 330 ohm is used, the peak current will be 35mA but the mean will be much less than this. If you know calculus, you can use integration to find the mean or get LTspice to do it for you.
LOL calculus was some ages ago, you are more likely to find me with a sheet of graph paper shading in triangles under the curve :eek::rolleyes::D
 
Last edited:

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Thanks Kris!! I had the wrong settings for the simulation, I just redid the schematic and was able to see the different nodes and play with the resistance variables. Very cool tool :)

As for brightness, I see why you said to use a higher efficiency LED, within the limitations of this circuit, if you allow more current to flow by using a lower value for R1 you exceed the LED's max continuous current carrying capacity. So you are locked into a very narrow range of values for R1. Narrow enough to make the tolerance between resistors a factor?
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
No, I wouldn't worry about resistor tolerance. How accurate is your 10V AC anyway? If it's derived from the mains, it won't be better than ±10% or so anyway. That's why it's normal to choose components conservatively. For that circuit, with a 330 ohm resistor, I wouldn't use an LED with a peak current rating less than 50 mA.

If you want to play around with improving the circuit, here are some ideas.

First, if you use a bridge rectifier, you can use both halves of the cycle. You can make a bridge from four 1N914 diodes, and connect it with its AC connections to the bottom end of the resistor and the bottom side of the AC input, and its DC connections directly onto the LED. You don't need the reverse voltage protection diode now, because the bridge ensures that the LED voltage is always positive. So effectively you're adding three more diodes to your components list.

This will nearly double the efficiency, but not quite, because the bridge itself adds a voltage drop of 1.5~2.0V, so although you're using both halves of the waveform, you're missing more of the middle part (around the zero crossing, where there's not enough voltage to do anything useful) and your peak voltage is less as well.

The next thing is to put the bridge before the resistor, and put a smoothing capacitor across the output of the bridge. For this case you should use bigger diodes such as 1N4001~4007 for the bridge, and your smoothing capacitor can be around 100 µF - there's not much point going higher than that because you won't be drawing much current out of it.

When you do this, move the downwards-pointing triangle so it's connected to the negative output of the bridge. When you run the simulation, you'll see that the smoothing capacitor charges up to about 12~13V DC. So you can't use a 330 ohm resistor because that would give a continuous LED current of around 30 mA, which is a bit too high for most LEDs.

I'm sure you can calculate the right resistance using Ohm's Law, and check the current in the simulation.

Yes I agree, LTspice is a great piece of software, especially for the price!
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
Ok, here is what I got:
I used the formula R = (Vs - Vf)/If to come up with a 410 ohm resistor. At one point I had an average v.pot. reading of 10.4 and I used 2.2 as my v. drop across the LED divided by the 20mA continuous current required for the device. For some reason when I refreshed the schematic, my avg. volt reading is now 11.9, which yields a 490 ohm resistor, which gives me about 17mA avg current. Strange...

The design looks successful according to how much current is being driven through the LED, however, isn't the v.potential across the LED too high at 12v?
I also found interesting that if you put the resistor before the capacitor, the circuit displayed different behavior in the waveform - the variance in the current was greater.

Thanks again for all your help and instruction :)

Picture_zpsd6dcd79a.png
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Ok, here is what I got: I used the formula R = (Vs - Vf)/If to come up with a 410 ohm resistor.
Great!

In the real world, resistors aren't available in all possible values. There are several series, called E6, E12, E24, E48, E96 and E192, that define what values are available. The E-number is the number of different values in each decade; E12 uses twelve values: 10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82, then repeats for the next decade; E24 adds another twelve values in between those ones: 10, 11, 12, 13, 15, 16, 18, 20, 22, 24, 27, 30, 33, 36, 39, 43, 47, 51, 56, 62, 68, 75, 82, 91. And so on for the higher E-numbers, except that starting at E48, numbers resolve to three digits, not two, and are recalculated, so many E24 values don't have exact matches. Generally, more accurate resistors are available in higher E-number series. Capacitors, and off-the-shelf inductors, also use E-series numbering.

So in the E24 series, your closest options (closest to 410 ohms) would be 390 and 430 ohms. Or you could go to an E48 resistor and get a nominal value of 412 ohms. But the nearest E24 (even E12) value is close enough for this application.
At one point I had an average v.pot. reading of 10.4 and I used 2.2 as my v. drop across the LED divided by the 20mA continuous current required for the device. For some reason when I refreshed the schematic, my avg. volt reading is now 11.9, which yields a 490 ohm resistor, which gives me about 17mA avg current. Strange...
The average capacitor voltage will vary slightly depending on how much current you draw from it. Have a look at the capacitor waveform with different resistor values and you'll see that lower resistances (higher currents) cause deeper ripple, and therefore a lower average voltage. That's because the peaks are almost entirely determined by the AC input, which is constant, but when you draw more current from the capacitor, it discharges quicker, so it discharges further in between the peaks, making the mean voltage lower.

You can use the .step command in LTspice to do it for you - change the value field of R1 from "410" to "{R}" (without the quotes) and add a directive (not a comment; it must appear in black) that says ".step param R list 330 470 560" (without the quotes). Use whatever values you want in the list.

When you run the simulation, LTspice will run the simulation once for each value in the list, and when you click a node to graph its voltage, or Alt-click a wire to graph the current through it, LTspice will show the graphs for all of the simulations, overlaid on top of each other, so you can see how varying the resistance affects any aspect of the circuit you're interested in.
The design looks successful according to how much current is being driven through the LED, however, isn't the v.potential across the LED too high at 12v
No; the voltage across the LED isn't 12V. LTspice will tell you what it is; it will be around 2V for a red LED. The 12V is applied to the series combination of the resistor and the LED, and the resistor acts as a spring, and "takes up the slack" in terms of voltage, while limiting the current.
I also found interesting that if you put the resistor before the capacitor, the circuit displayed different behavior in the waveform - the variance in the current was greater.
Right. With the AC going straight into the bridge rectifier, feeding straight into the capacitor, the peak voltage on the capacitor is almost entirely determined by the AC voltage, so changing the load current only affects the troughs in the capacitor voltage waveform. If you insert a resistor between the AC and the bridge, or between the bridge and the capacitor, the peak voltage on the capacitor will also be dragged down by the load current.

I came up with an analogy for voltage, current, resistance and capacitance that I call the "DTS model". One day I want to make a nice animated demo for it, but in the meantime you can check out https://www.electronicspoint.com/threads/.248766/#post-1470672 for a crude explanation. I hope it helps; please let me know what you think of it.
Thanks again for all your help and instruction :)
No problem! It's nice to work with someone who listens, learns, and takes some initiative. It's not as common as you'd think.
 

chopnhack

Apr 28, 2014
1,576
Joined
Apr 28, 2014
Messages
1,576
There are several series, called E6, E12, E24, E48, E96 and E192, that define what values are available.
I found it cool how they derived the values - I thought they were arbitrary, but it turns out its based on the tolerance. i.e. E6 has 20% tolerance so the difference in steps of value is determined by 20% of the preceding value. Very cool!

No; the voltage across the LED isn't 12V. LTspice will tell you what it is; it will be around 2V for a red LED. The 12V is applied to the series combination of the resistor and the LED, and the resistor acts as a spring, and "takes up the slack" in terms of voltage, while limiting the current.
Can you show me how? I used LTSpice, but when I probe the anode of the LED, I get the green wave ~12v and ~8v (the blue wave) at the cathode. I assume this is referenced to ground because of the triangular symbol (gnd) connected to the bridge.
Picture_zps75a9804e.png


I came up with an analogy for voltage, current, resistance and capacitance that I call the "DTS model". One day I want to make a nice animated demo for it, but in the meantime you can check out https://www.electronicspoint.com/threads/.248766/#post-1470672 for a crude explanation. I hope it helps; please let me know what you think of it..
I had to sleep on it and come back to it for it to make more sense. I think its well stated and surprisingly well done since it was translated into a mechanical model! Clearly an animation would serve your point well here :)

Again thank you for your continued support and patience!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I found it cool how they derived the values - I thought they were arbitrary, but it turns out its based on the tolerance. i.e. E6 has 20% tolerance so the difference in steps of value is determined by 20% of the preceding value. Very cool!
Yeah :)

Another way of saying this is that the ratio (r) between a value (n) and the value after it (n+1) is equal for every value. So for E6:
start = 10
10 * r = 15
15 * r = 22
22 * r = 33
33 * r = 47
47 * r = 68
and then 68 * r = 100 to get to the next decade.

So you can calculate the ratio r as 101/6, i.e. the sixth root of 10, which works out to 1.4678. So with r = 1.4678, the ideal values for an E6 decade are:
start = 10
10 * r = 14.678 (closest to 15 when rounded to two digits)
14.678 * r = 21.544 (closest to 22)
21.544 * r = 31.623 (close to 33)
31.623 * r = 46.416 (close to 47)
46.616 * r = 68.129 (closest to 68)
and 68.127 * r = 100.000

I don't know why they chose 33 and 47 instead of 32 and 46, which would have been closer. But it's too late to change it now! And there probably was a good reason.
Can you show me how? I used LTSpice, but when I probe the anode of the LED, I get the green wave ~12v and ~8v (the blue wave) at the cathode. I assume this is referenced to ground because of the triangular symbol (gnd) connected to the bridge.
Yes, you're right. I was assuming that you had the resistor on the anode side of the LED, so its cathode would be connected to 0V (the triangle reference symbol). That's the way a circuit like this is normally drawn, by convention, although it will work equally well with the resistor in series with the cathode, the way you've drawn it.

If you swap the resistor and the LED, the voltage you measure at the anode will be equal to the voltage across the LED (the LED's "forward voltage") and this will agree with what I said.

BTW there are conventions that you can follow to make schematics clearer. Here's an example. Unfortunately, LTspice doesn't seem to be able to rotate components at a 45 degree angle, so you can't show the bridge rectifier in its traditional shape (although you can download extra components, including a single component bridge rectifier you can use instead of four separate diodes, which does have the right shape).

tidy schematic example.gif

The important feature is the 0V rail running along the bottom of the drawing. Also I've added some node labels; this is a good idea because the label name appears at the top of the graph, instead of some meaningless node number.

Components that are connected in series across the supply rails (R1 and LED1 in this case) are shown in a vertical line. This fits with the idea of voltage as distance; the 0V rail is at the bottom of the diagram, and vertically higher components have higher voltages. (This doesn't apply to the left of the bridge rectifier unfortunately).

C1 should be shown as a polarised capacitor because you would use a standard electrolytic capacitor and these are polarised. I prefer the European version of the polarised capacitor symbol and it seems to be widely recognised, but I don't see it used much by Americans. The hollow plate is positive.

european polarised capacitor symbol.gif

(re Kris's DTS model) I had to sleep on it and come back to it for it to make more sense. I think its well stated and surprisingly well done since it was translated into a mechanical model! Clearly an animation would serve your point well here :)
Thanks. Yes I agree, some animation would be great. The standard explanation for voltage, current, resistance and capacitance is a hydraulic one, with liquid flowing in pipes. This fits nicely with the idea of current being a flow of electrons, but it doesn't model voltage as distance, so I don't find it very helpful when explaining many of the common ideas in basic electronic circuits such as voltage dividers and capacitor charge/discharge. Thanks for the feedback :)
 
Top