Mountains

Mountains

Sunday, October 30, 2011

DC from AC... Without a transformer...

I recently started a project at work that uses momentary push button switches to activate a device. The switches I ordered came with 5V status LEDs built in. Being one to not let capability go to waste, I wondered if I could light the LED to signal the device was on. The major problem was that the rest of the system is based on 120V AC, while the LED needs only 3-5V DC. The project did not warrant the purchase of an expensive transformer.

I began to wonder if there was some other way to light an LED with 120V AC. Unfortunately, one cannot simply place a large resistor inline with a diode bridge and call victory. The amount of energy dissipated would be quite substantial.

I turned to the internet for answers. There's lot of interesting circuits out there. Some of them really good, others, not so much.

http://www.qsl.net/: Scroll down a bit
Forum Discussion: nbuska's circuit


A common theme in the circuits for low current DC from AC is to leverage the charge-discharge characteristics of a capacitor across the AC power supply to step the voltage down. This is an impedance property of a capacitor called reactance.

The impedance of a capacitor is given by Xc=(2πfC)-1 .
Where C is the capacitance of the capacitor in farads, f is the AC frequency (in hertz), and Xc is the impedance of the capacitor in ohms.

Using Ohm's law for the reactance (E=IXc), a voltage of 120V (from the AC input), 10 mA current for the LED, we get a reactance of about 12 kOhm. Solving the impedance-capacitance relationship, we get C of 0.221 μF.

I built a breadboard test circuit using a 1.8 kOhm resistor (R1; to control capacitor inrush and avoid blowing a fuse or a circuit breaker), a 0.221 μF capacitor (C1), some 1N4004 diodes (L1; for the diode bridge), and the LED in question.
To my surprise, it worked without releasing smoke. It was kind of creepy to see the circuit attached to AC without a transformer.


I used a variac to slowly ramp the voltage with the hope I could quickly turn the power off if something bad started happening (sparks, smoke...).

Testing across the LED leads showed a voltage of 2-4 volts (depending on the LED used).

Having successfully prototyped the circuit, I then transferred the components to a soldered breadboard to be incorporated into the final device. It was essentially cost-free as the components were all on the shelf, so no new purchases were needed.



This circuit is so fascinating that I ended up wondering if there was a deeper way to look at it. Instead of using the impedance relationship, another approach is to explicitly look at the charge/discharge characteristics of the RC circuit when connected to an AC input. This system can be broken into two modes:

Charging: When the input voltage (Vin) is greater than voltage of the capacitor (Vc).
Discharging: When Vin is less than voltage of the Vc.

Charging:
In a DC circuit, the Vc at a given time (t) is given as:
Vc=Vin*(1-e-t/RC)

Since an AC input is increasing during the charging part of the cycle, Vin is some function of t [that is: Vin(t)]. To obtain Vc, we need to break t into many small steps and numerically integrate in order to determine Vc:

Vc=(Vin(t)-Vc')/t*(1-e-t/RC)

Where Vc' is Vc at the previous time step.

Likewise, the charge on the capacitor from a DC input can be determined from:
 qc=CVin*(1-e-t/RC)

substituting for an AC input, we get
qc=C(Vin-Vc')*(1-e-t/RC)+qc'

where qc' is the charge accumulated at the previous time step.

 Discharging: 
After the input voltage drops below Vc, the capacitor starts to discharge. In order to effectively model the system, the continuously dropping voltage across the circuit must be accounted for.

To solve the system in the discharge scenario, the qc must be determined first, as Vc .
 The charge of a capacitor acting across a resistance without a bias voltage is:
qt=q0*(e-t/RC)

Since the voltage is constantly dropping in the AC circuit, the apparent charge on the capacitor increases even as it is discharging.
qt=(qt'-VcC)(e-t/RC)

where qt' is the charge on the capacitor at the previous time step.

The voltage of a capacitor discharging across a resistance as a function of time is:
Vc=-qc*(e-t/RC)

To account for the changing input bias from the decreasing AC voltage, we substitute in the expression for qc from above:
Vc=-(qt'-VcC)/RC*(e-t/RC)

Summation:
When this is all put together and solved with time steps (t) of 1 μs (to avoid integration errors), a resistance of 3220 Ohms (sum of the LED, inrush resistor, and diode resistances, and the capacitance discussed above), we get the following result: 


Now we have a much clearer view of how the system works than the impedance relationships provide. The capacitor voltage trails the input voltage from the line very closely, so the measured voltage of the circuit is very low, just a few volts, thus not destroying the LED. The measured voltage stays positive in this case because of the diode bridge. I mathematically modeled this by taking the absolute value of the difference between voltages. Notice that the measured voltage is 0 when the AC voltage has just crossed it's apex and is equal to the capacitor voltage, so it effectively out of phase by 180 degrees. Also note that the capacitor is nearly fully charged by the input.


My original design notes. Much less clear...


No comments:

Post a Comment

Leave a message after the tone...