# MOSFET topology to switch between voltage and ground?

What topology am I seeking to switch a load between an arbitrary, positive voltage and ground? I am trying to operate the rungs of an R2R ladder so pull-ups and pull-downs are inappropriate. The circuit is low power (<100 mA), low voltage (<20V) and low speed (<1 Hz).

-
 What resolution are you aiming for? – stevenvh May 25 '12 at 5:05

Most people drive the rungs of an R2R ladder with standard CMOS output pins. The "topology" directly connected to that output pin is generally a static CMOS inverter:

where 'Q', Vdd, and Vss are physical pins you have access to, and 'A' is internal node of the chip.

Some of them use a few CMOS output pins on a microcontroller to directly drive the R2R rungs. The rest generally use a few output pins on a microcontroller to send data to some sort of latch chip or buffer chip, and then the CMOS output pins of that chip drive the R2R rungs. Often the latch chip is the 74HC595 (if their "arbitrary positive voltage" is in the range of 2.0 V to 6.0 V) or the HEF4069 / CD4069 or the HEF4094 / CD4094 (which can handle "arbitrary positive voltage" in the range of 3.0 V to 15 V).

-
 What about the 20V? I think you should solve that too. – Federico Russo May 25 '12 at 7:51

In my other answer I focused on the high voltage, which is a problem for many components (and which David doesn't cover in his answer).

You may also do most of it at lower, logic levels, and only go to 20V at the end. The HCMOS outputs of your microcontroller, or external logic IC, have a complementary MOSFET output, capable of both sourcing and sinking current.

If you don't have enough I/O on your microcontroller a shift register like the 74HC595 David also mentioned, may offer a solution. It gives you 8 output bits, you can cascade two devices if you need more.

This way you'll get an analog voltage between 0V and 3.3V or 5V, whichever your logic runs on. You only have to amplify that by $\times$6/$\times$4 to get a 0 to 20V output. Use a Rail-To-Rail opamp which takes a 20V supply, like the CA3420 as a non-inverting amplifier:

This is a really low-power solution.

You have to use 0.1% resistors for the R-2R network if you want an 8-bit resolution.

-

You need a push-pull stage like David says. Unlike TTL, (H)CMOS outputs are symmetrical and will source or sink the same current. HCMOS and its many variants aren't suitable for your high voltage, though. HCMOS is 5V typical, 6V maximum, and there are variants which only operate up to 3.6V. Even the old CD4000 series is limited to 15V.

You'll have to make a driver yourself. Place a P-MOSFET and an N-MOSFET in series and drive them from an open-drain/open-collector output. Normally you would need low-value pull-up resistor to +20V, so that the N-MOSFET can be switched on fast enough, but at 1Hz that's not really an issue.

For the MOSFETs almost any low-power type will do: you don't need much current, nor high speed, and you have plenty voltage to drive them. The BSS8402DW or the Si1029X, a.o., combine a complementary pair in one package.

Pay attention to the open-drain/open-collector driver. HCMOS devices, like the 74HC07, have clamping diodes, limiting the output to $V_{DD}$. Others have a limited output voltage of 15V. The 74LS07 is specified up to 30V.

Alternatively, just the pull-up may be an option. It depends on the DAC's resolution, and what you'll drive with it. If the resolution is limited to, say, 8-bit, and you'll drive a high-impedance input with it, you can use high resistance value for the R-2R network, and a low value pull-up resistor may not cause a too big error.
If your R-2R uses 1M$\Omega$/2M$\Omega$ resistors, a 4.7k$\Omega$ pullup will only cause a 0.2% error, that's less than 1 LSB in an 8-bit DAC.
This may not fit the low-power you specified; each bit will draw 4mA from 20V, worst case (all zeros) that's 32mA for an 8-bit DAC.

-