# Automatically measure voltage over a wide range

There are voltmeters that can measure voltage over a wide range without the need to switch the range manually.
I'm quite curious how do they do it, because I'd like to make a tiny device capable of the same, up to 1000V. I was thinking about utilising a capacitor - if you connect it to voltage on one side, you'll get opposite voltage on other side, but high current will not flow.

simulate this circuit – Schematic created using CircuitLab

The change in potential should be measurable, shouldn't it?

If that's not the way, what is?

• Please elaborate on ...you'll get opposite voltage on other side, but high current will not flow. Oct 1, 2014 at 12:25
• My idea is, that the capacitor will create a charge and this will be detected on ADC. Oct 1, 2014 at 12:27
• I think you got the concept of a capacitor wrong. A capacitor does not create a charge, it can merely store it. I'd suggest doing some circuits simulations/breadboard tests. Oct 1, 2014 at 12:28
• But if you put potential on one side of a capacitor an opposite potential will form on the other side. Don't electrons attract "no electrons"? Oct 1, 2014 at 14:37

As a alternative to the common approach that clabacchio has already explained well, you can use very high resolution A/Ds that require 10s of ms per reading when the result is only to display to a human. You generally want to update a digital display in the 2-4 Hz range, so you have at least 250 ms per reading.

There are delta-sigma A/Ds available that claim over 20 bits. Let's say 8 real bits is good enough, which gives you 1/2 percent resolution. If you arrange the highest voltage of interest to maximize the output of a 20 bit A/D, then you can read a voltage 1/212 lower and still get 8 bits. For example, if you want the meter to read up to 1 kV, then it will still be able to read 1/4 volt with 1/2 percent resolution. If that's good enough, then no range switching is required. The only "auto ranging" would be in how the result is displayed to the user.

• Why does 8 bits mean 1/4 resolution? Oct 1, 2014 at 14:36
• @TomášZato 1/4 percent means 0.25%, or 0.0025 (1/400) of the maximum value Oct 1, 2014 at 14:40
• @Tomáš: Oops, I was thinking .4% and somehow translated that to 1/4%. I have fixed it to say 1/2% now. 1/256 (8 bits) = 3.9%, so 1/2% is close enough. Oct 1, 2014 at 16:06

The way instruments can measure various ranges of a certain quantity is through amplification. If you put aside automatic range adjustment for the moment, it gets conceptually much simpler.

Say that you have a knob, and each position of the knob activates a different amplifier: x1, x10, x100 etc. Typically, one of these values will be optimal to make the best use of the ADC, while the lower settings will give too small output (therefore higher measurement error) and higher amplification will cause the signal to saturate and put the instrument out of scale.

You can of course go the other way around and use different types of attenuation, to use signals of amplitude greater than the range of the ADC.

Note that you can achieve the same effect by chaining amplifiers (e.g. 10x) and reading the signal at various stages (again, using switches), instead of having different ones in parallel.

Now, regarding the automatic switching, it gets more complicated because you have to add some intelligence to assess which is the best amplification to get the best measurement. The simplest way (at least conceptually) is to read the ADC and compare the output value with thresholds: if it returns the highest value you can assume it's saturated, therefore you can activate a lower amplification; if it's lower than a certain threshold, you can assume that amplifying the signal will provide a better reading.

Of course you'll have to digitally multiply the ADC reading to compensate for amplification.

There is also a use for a serial capacitor (AC coupling), but it's not related to signal amplitude and I'd like you to disregard it for now, else it would complicate things.

There is an interesting article describing the exact same concept, but using resistors (voltage dividers) as attenuators, instead of amplifiers.

• But if you start from the lowest setting, how does the chip survive the high voltage? Oct 1, 2014 at 14:34
• Of course protection is something to consider, but don't mix things too early. You can always start from the highest attenuation and amplify, but if you want to measure 1000V you'll have to go a bit further with protection. Oct 1, 2014 at 14:39
• If it was 100V, would that make any difference? Chips are usually constructed for 5 or 3.3V. Oct 1, 2014 at 14:40
• Of course. If your instrument is rated (!!!) for 100V you'll have made a smart design that protects it from that voltage, for instance by using a 20x voltage divider. Note that beyond a certain voltage you also need galvanic insulation for safety. But don't expect an answer that covers all the design of a multimeter. Oct 1, 2014 at 14:44

I'd like to add an other option, that's certainly the cheapest (but clearly not the most accurate) : instead of measuring the voltage itself, measure its logarithm.

## Here is the basic idea:

simulate this circuit – Schematic created using CircuitLab

The principle is the following (left schematic) : the voltage across a diode is the log of the current flowing through it (I=Is*(exp(V/Vth)-1), where Vth~25mV at room temperature). So what you have to do is make a current flow through it that is proportional to the applied voltage : that's what resistors do ! The output voltage will stay below 0.7V at 1kV input voltage, which is perfect to measure with the arduino internal 1.1V reference.

## Let's improve it (but keeping it simple)

The circuit on the right is basically just the same, but

• I split the 1M resistor in 4 series resistors (so that 1kV applied voltage is OK with common 1/4W resistors)
• I replaced the diode with a diode-connected transistor (whose voltage is much more accurately the log of the current).

What are the drawbacks?

1. The current flowing through the diode will be proportionnal to the voltage across the resistor, Vin-Vout, not Vin itself. However, that's easy to compensate for in software (and that can also be corrected in hardware, look for "transdiode amplifier" op-amp circuit).
2. The coefficient Vth is proportionnal to temperature (in kelvin) so expect ~0.3%/°C change.
3. This circuit won't measure well very low voltages (when input voltage gets close to thermal voltage)
4. Finally, the input impedance of this arrangement is only 1MOhm, much less than ADC input. This may load unacceptably the circuit you're trying to measure.

All of those can be somewhat mitigated (1. is easy to do in software, 2. can be compensated for example using a second transistor in a transistor array IC, like LM3046...) but it gets very complicated very fast if you want really high resolution.

## So, finally...

If you want the most simple circuit possible, without any (potentially unreliable) gain switching algorithms or special parts, and if the input voltage doesn't go very low, and if you're OK with limited accuracy, then this might be an option.

And above all don't forget... take extreme care, high voltage IS lethal !