Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Channels ▼

Al Williams

Dr. Dobb's Bloggers

Pump It Up

November 02, 2012

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.

More Insights

White Papers

More >>


More >>


More >>

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).

Tools like this are a great way to get a feel for how circuits will work and what changes will do. There are also a few online choices (Circuit Lab and the Falstad simulator).

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.

Related Reading

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.