Pump It Up
Supposedly you can build any software you like with a Turing machine. That doesn't mean I want to recreate the GCC compiler suite using one, though! By the same token, I suppose you could — in theory — build everything in hardware with no software involved. For example, I once had an answering machine (many years ago) that used motors and cams to time the operation. Solenoids and relays controlled the phone and tape decks. Of course, that was expensive and inflexible (and bulky) so I don't think I want a pure hardware word processor any time soon.
- Five New Laws of Anti-malware Protection: Keep Up with Evolving Threats
- Can Your Organization Brave the New World of Advanced Cyber Attacks?
- Intrusion Prevention Systems: What to Look for in a Solution
- Asset Management For Electronics Industry
The best designs, in my opinion, fuse hardware and software in cooperative ways. That's why I try to straddle that line between electrical engineer and software engineer. Hardware designers should understand what software can do and programmers should know what is possible in the hardware they are using (or what hardware to ask for during a design phase).
I was thinking about this a few weeks ago when explaining the operation of a MAX232 level converter to a student. You've probably used these handy chips. They provide an RS232 to TTL-level conversion in both directions and you commonly see these in serial ports. These chips use "magic" to convert a single 5V supply into a +/- supply of around 8V or so.
If you are focused on software, this may seem like a magic black box. After all, why should you care how that works exactly? There are other cases where you might need a higher output voltage though. One that comes to mind is driving the high side of an H-bridge. If you are using MOSFETs, you don't need a lot of current, but you do need a voltage higher than the motor supply voltage. Generating programming voltage for other chips is a similar situation: not much current, but a higher voltage than your CPU will produce.
It is easy to punt to hardware. You could build a higher voltage supply and use any of a number of switching techniques to control the higher voltage. That's going to be a challenge — especially in a device with a battery or a wall transformer. Of course, you can use a DC to DC converter. But if you know how these "magic" devices work, maybe there is a compromise. Add a little hardware and do a little in software and wind up with something that is more affordable.
One technique (probably the one used on the MAX232) is a Dickson charge pump. The idea is simple: Use a switch to charge up a capacitor to the supply voltage (literally pump charge into it) and then switch it in series with the supply voltage. That means you get (in theory) double the voltage out — at least until the capacitor discharges. So you flip the switch many times per second and use a second capacitor to smooth out the resulting voltage. In real life, you get somewhat less than double the voltage, depending on certain circuit elements.
Naturally, when I say "switch" I'm not talking about a physical toggle or push button switch. A diode, however, will do the trick nicely and a Schottky diode (like a 1N5817) is best because it has a low voltage drop (one of the things that will prevent the circuit from being a true doubler).
I will confess that although I started my career as a hardware guy, I am pretty clumsy at actually building things. I think that's why I like software and software-like hardware (like Verilog) — because I can transform my vision into reality without having to stumble through the physical process. By the same token, I like to use simulation tools to at least get an idea about how something like this will work. I used Linear Technologies LTSpice (running on Linux using Wine).
You can see a representative circuit from LTSpice below. V1 is the pulse train coming from the microprocessor. This might be a clock output from the onboard oscillator, a PWM output, or just a digital I/O pin being toggled. R2 is the load resistance. In the case of an H-bridge high-side switch, this is probably much higher, and you can easily adjust the values in the simulator.
The result? You can see the simulated output in the figure below. Intuitively, you'd expect the voltage to be double 5V less two times the diode drop. The 9.8V observed on the simulation isn't that far off and accounts for other circuit effects.
In case you want to try your hand at simulating the circuit, you can download the circuit in several formats. In particular, there is an .ASC file for LT Spice, and links for Circuit Lab and Falstad. If you want to dive more into the actual analysis of the circuit, there is a National (now TI) application note that is fairly readable. The circuit is simple enough to breadboard in a few minutes if you want to test it in the real world as well.