1 - Beginnings
3 - Hello World
4 - More On GPIO
5 - Interrupts
7 - Timers
10 - Buttons and Bouncing
Would you like to be notified by email when Jason Sachs publishes a new blog?
In part 1 we talked about the use of a MOSFET for a power switch. Here's a different circuit that also uses a MOSFET, this time as a switch for signals:
We have a thermistor Rth that is located somewhere in an assembly, that connects to a circuit board. This acts as a variable resistor that changes with temperature. If we use it in a voltage divider, the midpoint of the voltage divider has a voltage that depends on temperature. Resistors R3 and R4 form our reference resistance; when the P-channel MOSFET switch Q1 is off, the reference resistance is R3, and when Q1 is on, the reference resistance is the parallel combination of R3 and R4. The microcontroller can turn Q1 on and off using a digital output (the pin marked GAIN). Resistor R1 is used to keep Q1 off when the microcontroller is in reset. Capacitor C1 is used as part of a low-pass filter with R2, which also serves as a current-limiting resistor in case of surge voltages on the thermistor connector. An op-amp buffers the filtered voltage and feeds it into an analog-to-digital converter (ADC) input.
Let's talk about component values. Assume this is powered by a single AA cell, with a supply voltage VDD between 1.2 and 1.5V. The low end of this range is a challenge for active devices, but there are still components that are specified to work at such a low voltage. For Q1 we could use a Vishay Si1499DH, which is specified for an Rdson of 0.42 ohms at 1.2V gate voltage. For the microcontroller, there are a few options; some kinds like TI's MSP430 series and SiLabs C8051 series have parts that can run down to 0.9V supply voltage, while others like Atmel's ATtiny43U have an integrated boost converter to create enough voltage internally to run the part. And for op-amps, Linear Tech has the LT1635 that runs off of 1.2V, ON Semiconductor sells the NCS2001 which operates on 0.9V; Touchstone specifies the TS1001 down to 0.65V!
Designs I've worked on that use thermistors typically use NTC thermistors, which have resistance that decreases with increasing temperature, by a significant amount: Quality Thermistor's Z-curve thermistors, for example, have a resistance that increases by a factor of 13 from +25°C to -25°C, and decreases by a factor of about 7 from +25°C to +75°C. This wide dynamic range makes it difficult to sense temperature over a large range, so this circuit has a gain switch. With a 100K thermistor (100K at +25°C), I might choose R3 = 249K and R4 = 49.9K (for switchable resistances of either 249K or 41.6K = 249K || 49.9K). The important idea is to maximize signal swing by making the reference resistor about the same as the thermistor in the range of interest; I'd choose the high-impedance range (R3 only) at low temperatures, with maximum resolution around +5°C, and the low-impedance range (R3 and R4) at higher temperatures, with maximum resolution around +47°C. Both R3 and R4 should be 1% accurate or better.
For the low-pass filter, R2 = 100K and C1 = 0.1uF gives us a 10 millisecond filter time constant. With a decent CMOS op-amp, input bias current is low enough that the relatively high value for R2 won't cause a significant error. (Otherwise, the appropriate thing to do is put an identical resistor in the feedback path of the op-amp, so that identical bias currents cause identical voltage drops.)
Finally, R1 isn't too critical and could be 1M to minimize power consumption.
Well, there's one problem here. We are asking a lot from switch Q1. We want it to be a good short circuit when it's on, and we want it to be a good open circuit when it's off. The on-resistance of a Si1499DH is 0.42 ohms worst-case, which is a tiny fraction of the series resistance R4, so that's fine. But what does the switch look like when Q1 is off?
MOSFETs at low gate voltages look like constant-current sinks, where the current is a function of gate voltage and temperature and device variation. A look at the datasheet under "Zero Gate Voltage Drain Current" shows us the worst-case current that can flow when we pull the gate and source together. The Si1499DH specifies 1uA maximum at 25°C, and 10uA maximum at 55°C. This is pretty typical of MOSFET manufacturers; you will often see numbers like 1uA, 10uA, or 25uA. For one project, I managed to find a few parts specified at 0.1uA maximum current at zero gate voltage, but there aren't many out there. This is a parasitic leakage current: we want zero current, but we have to live with some undesirable current up to the specification.
In any case let's assume we can run our circuit in a controlled environment at 25°C (with our thermistor measuring temperature somewhere else in a hot or cold location) so we get the 1uA maximum leakage -- rather than 10uA if our circuit ran in a 55°C car on a hot day. If our thermistor measures 249K (at about 5°C), and we have the pullup R3, the net parallel impedance is 125K, so 1uA leakage causes 0.125V error in our sensed voltage. Yikes! That's a lot! And we can't calibrate it: the leakage current could be 0, it could be 0.1uA, it could be 1uA, it could vary with time... we don't know, all we know is that we have to live with up to 1uA leakage current.
The zero-gate-voltage leakage current is one of the commonly overlooked problems of MOSFETs that prevent them from being the perfect switch. In low-power or high-impedance analog circuits, it often produces unacceptable errors.
So what can we do about it?
One solution is to use bipolar transistors. Most bipolar transistors, when turned off, have leakage current in the low nanoamp range. The only problem with using a bipolar transistors as an analog switch is that they cannot guarantee zero voltage when on; you are looking at a collector-emitter voltage for a saturated NPN or PNP transistor that is typically in the 50mV - 200mV range. (MOSFETs, on the other hand, look like a resistor when turned on, and can reach on-state voltages of microvolts in low-current situations.)
Another solution is to use dedicated analog switch ICs. The ubiquitous HC4051/4052/4053/4066 series are very inexpensive -- but they all have leakage specs of about 1uA, which is just as bad as our MOSFET. There are a few analog switch ICs that have lower specified currents. Maxim sells a MAX4066 (1nA max leakage), Intersil has their ISL54000 series (20nA at 25°C, 300nA over their temperature range), and Fairchild has several different switches such as the FSA4157 (40nA max leakage over temperature). The tough part here is finding an analog switch IC that works with our voltage range. Most of them need at least 1.8V supply, which is not available. To find one that works down to 1.2V we have few choices. The Intersil ISL43L110 is spec'd down to 1.1V; its leakage current is 30nA max at 25°C, 4.5V supply, 200nA max over temperature with 4.5V supply, and 8nA typical over temperature at 3.3V supply. Intersil's ISL43L series was the only one I could find that worked at such a low voltage; the next closest was NXP's NX3L series (e.g. NX3L4357) with up to around 50nA leakage current maximum at 85°C.
Whew! It's tough to run circuits off of a one-cell battery! This is one reason why most products that do run off one AA cell are supposed to use alkaline cells, with a nominal voltage of 1.5V, rather than nickel metal hydride (NiMH) with a nominal voltage of about 1.2V.
At any rate, aside from the challenges of low-voltage design, the leakage current is the primary reason to be careful about using MOSFETs in low-power high-impedance circuits.
Add a Comment