After discussing my predicament with some friends, it was suggested that I try doing it with a Class D amplifier. Class Ds are often used in audio applications offering cheap and efficient audio amplification. They can distort the audio a bit, so they're not perfect, but I wasn't really looking for a pristine output waveform with this project. Here's an example of a Class D amplifier in an audio application:
There are four switches driving the speaker in this case. Depending on the configuration of these switches, you can drive current through the speaker either way:
So, this is a good solution for me. It's especially enticing because it lets me drive the EL wire at a positive or negative voltage.
Switching transistors back and forth is a piece of cake. I did it before for my wiper driver. The only issue is how to get that +120V Vdd.
If I Wanted My Fly Back...
A flyback converter is a kind of DC-DC voltage step-up converter that is commonly used in applications where you need to get a high output voltage from a low input voltage. They are perhaps most commonly used in the flashes of cameras (that whining sound you've probably heard when charging up the flash on a crappy disposable camera). They're also used in situations where you need an DC supply that is entirely electrically isolated. In my schematic, I ended up tying part of the output to ground, but there are several situations where you would want to remove all current paths between the main circuit and the output current loop, and a flyback lets you do that.
A flyback converter is kind of like a typical boost converter. It stores energy in the magnetic field inside a transformer and then allows it to discharge at a different voltage/current. Here's a simple schematic.
In this picture, the switch would probably be some kind of transistor as it needs to switch very quickly. Let's take a moment to figure out exactly how this thing works and how to determine the input/output voltage.
When the switch is closed, current starts flowing through the primary side of the transformer. This current will ramp up linearly at a slope proportional to the inductance of the primary winding.
Ideally, the secondary winding will induce a current that will fight the change of magnetic field (Lenz's Law). The dot notation on the transformer symbol helps to indicate current direction. As current on the primary ramps up traveling "toward the dot", current on the secondary will ramp up "away from the dot". As you can see, the diode will prevent this from happening.
As a result, the current in the primary winding ramps up and stores energy in the magnetic field inside that winding.
When the switch is opened, the result will be the current on the primary in the "toward the dot" direction ramping down (to zero). The transformer will try to fight this by producing current "toward the dot" to compensate. Because the primary is open, all of this induced current will happen in the secondary winding and toward the output.
The diode passes this current toward the load, and the capacitor smooths that voltage.
Now Some Numbers
So, let's work out some math to figure out exactly what output voltage you can expect for a given input voltage, duty cycle, and winding ratio. This should be fairly easy because there are two very distinct stages of operation and the only thing tying them together is the magnetic flux built up in the core. Let's start with the first stage where the magnetic field is ramping up.
The flux due to the primary winding will be:
Where is the permeability of the core, is the number of windings, is the cross-sectional area of the core, and is the magnetic path length of the core.
Now, to get that flux, we need to let the current ramp up in the core. We will start with the formula I introduced back here:
Let's say that our is equal to the amount of time per cycle that the switch remains closed. This will be:
The inverse of the frequency (F) gives you the total period of the cycle, and multiplying by the duty cycle (D) gives you the portion during which the switch is closed.
So let's solve for current (assuming initial current is zero or ).
So putting it all together, we get:
So we can rewrite the above as:
So, we know that the flux is shared between the two windings. Once the flux is built up by the primary, it's allowed to discharge through the secondary. We can rewrite the above for the secondary winding when the switch is opened:
Remembering that this is the state that takes up the rest of the time in the cycle ().
Also note that because we're considering a "steady state" condition here, all of the flux that builds up in the first part of the cycle must discharge during the second part. Otherwise, you'd have some flux left over and you wouldn't quite end up where you started. Let's set the fluxes equal to each other:
And solve for the output voltage:
Alright, that wasn't too painful. So, as you can see, you have a few options for how to get your output voltage. Ideally, you could get an infinite output:input ratio with a 1:1 turns ratio, but that would require an insanely high duty cycle which is kind of hard to pull off with conventional components (usually don't want to go anywhere past 90%) or so.
Regulating a flyback
Regulating a flyback can be fairly difficult because the output voltage will depend on your load. Keep in mind that we were making the assumption in the above calculations that all of the flux built up in the primary will dissipate in the secondary. If the output load were to suddenly have a larger impedance, the secondary current would decrease, and it would take longer to dissipate the flux. This means that all of the flux might not be dissipated by the end of the cycle.
When the next cycle comes around, this original flux will be added to the new flux and both will be discharged. Because flux is proportional to current in the secondary winding at this point in the cycle, the output current will increase. This increased current through the increased resistance will produce an increased output voltage. To prevent this, the duty cycle must be reduced in an attempt to bring the current ripple back into the "barely touching zero" condition outlined in this section.
This is why it's important to never operate a flyback converter with no load. With infinite load resistance, the output voltage will continue to rise until it eventually breaks something. This is actually how flyback converters in disposable cameras operate, but they depend on the leakiness of their cheap output capacitors to prevent the output voltage from getting too high. Any additional charge will leak through the cap.
So whatever method is used to regulate the flyback converter must keep a close eye on the output.
So, before continuing, let's talk about component sizing.