Resitor divider. Preventing overvoltage

OK if I want to measure 0 to 50 volts with analog read I can use a voltage divider to cut it by 10 and measure with 1V = 10V resolution. No problem

If I want to measure 0 to 500 volts, I can do the same with 1:100 and get that resolution. No problem.

What if I want to use three resistors and measure with 1:10 when voltage is low and 1:100 when voltage is high. For low voltage it's easy since the low resolution side will have even lower voltage.

But for high voltages, the 1:10 tap will have very high voltages up to 100V on it in this example. If I have that wired to my board I'm gonna fry it. How can I prevent that overvoltage from getting to my Arduino? I don't want to do it with code because I'm afraid of spikes in voltage while I'm doing something else. What's the hardware solution? How do I allow connection to my analog pin only when voltage is below 5V and cut it off if it's over that.

Can I do that with a transistor?

Delta_G:
OK if I want to measure 0 to 50 volts with analog read I can use a voltage divider to cut it by 10 and measure with 1V = 10V resolution. No problem

If I want to measure 0 to 500 volts, I can do the same with 1:100 and get that resolution. No problem.

What if I want to use three resistors and measure with 1:10 when voltage is low and 1:100 when voltage is high. For low voltage it's easy since the low resolution side will have even lower voltage.

But for high voltages, the 1:10 tap will have very high voltages up to 100V on it in this example. If I have that wired to my board I'm gonna fry it. How can I prevent that overvoltage from getting to my Arduino? I don't want to do it with code because I'm afraid of spikes in voltage while I'm doing something else. What's the hardware solution? How do I allow connection to my analog pin only when voltage is below 5V and cut it off if it's over that.

Can I do that with a transistor?

One idea that comes to mind immediately is have the 1:10 line disconnected via a relay. When the 1:100 line gets a voltage, if the (calculated) voltage is under 50 then close the relay on the 1:10 line and use that for the reading, if it is greater than 50 then you already have your reading. When the voltage goes low, disconnect the relay again to protect the circuit. Unless the voltage can move from <50 to >50 without going to zero first (this is for some sort of probing instrument, right?), this should protect the circuit.

For v2 of your instrument why not get a nice 24 bit ADC and do this with even better precision?

Check out this post about interfacing such an ADC to the Arduino. The ADS1213 is available as a DIP and is cheap on eBay.

You can do it with a 5V1 Zener diode across the analogue input.

Its a little tricky - sharing one divider chain (lets say 10k, 91k, 910k) can't work as the 1/10 tap will have a zener limiting it to 5V, so the 1/100 tap will never see more than 0.5V.

Suggest using two dividers, one is 1M / 10k (divide by 101) and 910k / 100k (divide by 10 approx, with zener).

The latter has too high an impedance for accurate ADC reading unless you take two readings in a row from the same pin (due to the time needed to charge the sample/hold capacitor). At 500V it will draw 0.5mA and dissipate 0.25W. Be sure to use 1M and 910k resistors with a high voltage rating (or use smaller value resistors in series) as 500V is a higher voltage than many resistors are designed for.

If the values of the resistors are high enough then the protection diodes in the Arduino offer adequate protection. I suggest using 2 dividers: 1M and 100K for the 0-50V range (ratio 11:1), and 1M and 10K for the 500V range (ratio 101:1). With 500V input, the 1M resistor in the 11:1 divider will limit the current through the protection diode to 0.5mA, which is low enough.

If you are paranoid, you can connect a Schottky diode (e.g. BAT43 or BAT85) between the input pins and +5v. I wouldn't recommend a zener, the leakage current of the zener may affect your reading.

The 11:1 divider provides an input resistance to the ADC of nearly 100K, so you get accurate readings you will need a 10uS delay between switching the multiplexer to the input channel and starting the conversion. I usually insert a delayMicroseconds call into the wiring_analog.c source file.

Thanks for the replies.

I didn't know if the zener would cut it at that voltage. So it's the current spec I need to look at? Is there a maximum voltage I can put on that zener?

A simple model of a Zener has no conduction until its rated voltage is reached. I don't understand what you mean by minimum voltage.

Grumpy_Mike:
A simple model of a Zener has no conduction until its rated voltage is reached. I don't understand what you mean by minimum voltage.

Sorry, I wasn't very clear there.

What I meant was once you go over the threshold voltage, is there a maximum before you do any damage. For example, if I have a 5V zener with one end at ground. I apply 4V, no conduction. I apply 10V, I'll measure 5V across the Zener right?

Well my question is if I have a 5V Zener with one end at ground and the other end at 100V, or 1000V, am I going to blow the zener with voltage?

What about current? In the application I am describing, current should be very low. But what if it wasn't? If I have the high voltage situation above, do I need to think about limiting current through the zener?

Sorry if that's really basic, I'm a real beginner when it comes to hardware.

Delta_G:
Well my question is if I have a 5V Zener with one end at ground and the other end at 100V, or 1000V, am I going to blow the zener with voltage?

What about current? In the application I am describing, current should be very low. But what if it wasn't? If I have the high voltage situation above, do I need to think about limiting current through the zener?

Yes, you need to have enough resistance in the circuit to limit the current through the zener diode, so as not to exceed its rated power dissipation.

Once above the voltage threshold a Zener looks like a short, so you simply can't get 100V across a 5V Zener because the current you need to do this will be almost infinite. The diode melts with the current first.

What if I want to use three resistors and measure with 1:10 when voltage is low and 1:100 when voltage is high. For low voltage it's easy since the low resolution side will have even lower voltage.

Very easy:

  1. Let's say that your 100:1 resistors are 100k:1k (they are a little bit too big but let's assume we are dealing with dc signals here).
  2. Tie the 100k resistor to your voltage source, and 1k to a pin (PIN_HIGH) on the mcu; the junction to your adc pin.
  3. Tie another 10k resistor from another pin (PIN_LOW) to the junction.

Your measurement procedure starts with clearing PIN_HIGH, and making PIN_LOW an input. If your reading is small enough for the 10:1 divider, clear PIN_LOW and make PIN_HIGH an input.

Essentially you are selecting which "lower" resistors are switched into the circuit to change the divider ratio.