A number of our projects require accurate monitoring of voltages. Here we explain the numerous techniques for measuring voltages, both DC and AC, highlight some of the multitude of integrated circuits available and list the pros and cons of various techniques.

To measure power (and hence measure energy) within electrical systems, we need to know the voltage and the current. Power equals the voltage multiplied by the current (P=V x I). We have written information on measuring DC current, in this post we will be writing about measuring voltage, both DC and AC.

Background

Accurate measurement is obviously beneficial, but higher accuracy comes with a higher cost and there are also some fundamental limits and hardware limitations to how accurate we can measure.

In this page I’m hoping to describe the main requirements for reasonably accurate voltage measurement and also a number of techniques to do this and a number of components and integrated circuits which are used to perform this function. I am assuming that this data will be read by a micro-controller (a digital device).

Methods to measure voltage

Voltage is sometimes called ‘potential difference’, and corresponds to the ‘potential’ or ability for electrons to flow around a circuit. So measuring voltage always requires direct connections to the two terminals we are trying to measure.

Often (especially with high voltage systems – above 55V DC has the potential to provide a dangerous electric shock) we require ISOLATION, hence I will break these methods down into non-isolated and isolated.

Non-Isolated voltage measurement

Non-isolated means that the input and output voltages are referenced to each other in some way. Generally they share the same ground connection. While simple to implement, there are over-voltage and safety issues for higher voltages.

Direct connection

We could measure the voltage by directly connecting it to the input of an Analogue-to-Digital Converter (ADC), such as those within microcontrollers. These have a maximum input of 5V or 3.3V, hence why we cannot directly attach the 20V signal, or else we would overload and damage the measuring ADC.

This method is only useful for low voltages and is not really the subject of this article.

Potential divider

A potential divider is a simple way of measuring voltages. The input voltage is measured between ground and the top point of two resistors in series. The output voltage is measured across the bottom resistor. This reduces the voltage of the output by a factor which relates to R1 and R2, the top and bottom resistors.

For example:

Voltage divider

Let’s say the input voltage is 20V. The output voltage will be:

Vout = Vin (R2/(R1+R2)

So in this example the output voltage will be:

Vout = 20V x (100k/(680k+100K) = 2.564V

  • Simple
  • Inexpensive
  • Dangerous overvoltage possible
  • Damage to measurement device possible
  • Problems with resistor variation with temperature

On the circuit diagram above we can see two additional elements. These are C1 and D1.

C1 is a filter capacitor. This will remove high frequency ‘noise’ in the signal. It might not be required.

D1 is a zener diode. A zener diode will short when a voltage greater than its rating is applied. This is protection to stop any over voltage problems. This is done to protect any equipment downstream of the zener diode, such as the microcontroller. The resistors in the potential divider mean that only a very low current will flow, even when shorted out, hence this will limit the voltage. (This is not done to stop any dangerous high voltages for the safety of people, as these voltages could still appear if, say, R1 failed to short circuit). In this case a 5.1V zener diode is used to protect a 5V input to a microcontroller.

Isolated voltage measurement

If we are measuring relatively high voltages it is much better to have a totally isolated signal. This stops any problems with over-voltage being applied to our measurement device.

Also, 55V is known as the voltage above which dangerous current can flow through the skin. Hence anything above 55V is potentially dangerous. Both PV (photovoltaic) voltages greater than 55V and AC voltages from standard AC plug sockets have the potential to be dangerous.

There are a number of ways to implement isolated voltage measurements:

Transformer

Transformers consist of two electrically isolated coils. Any magnetic flux is linked via the ferrite core. These provide electrical isolation, but only for AC signals.This was my first idea when I needed to test an AC mains voltage. I decided to test using a small transformer to measure AC mains voltages.

I used these 240V input 6V output transformers. I applied 240V AC mains to the inputs, which was measured using a high voltage scope probe.I also measured the output of the transformer. It was not quite what I hoped.

The transformer used is above. It is a 1.5VA rated unit. I was expecting a 6V AC waveform output. 6V is the rms (root mean square) output voltage, so I was expecting a peak of 6 x √2 = 8.485V.

I measured the input AC voltage waveform, shown in blue. With no load, the output voltage is shown in yellow. This output voltage is +/- 6V AC, but it can be seen that it is slightly out of phase and slightly distorted compared to the input.

These are screen shots of my digital oscilloscope. The yellow line (output) is not a perfect version of the blue line (input).

This shows more detail of the voltage with the time series expanded. We can see the phase change (the zero crossing is not in the same place) and the flattened output waveform.

This waveform shows a close up of the peak, to show the difference between the input (blue) and output (yellow) waveforms. This shows the waveform flattening.

In order to compare these results with other methods, I rigged up an isolation amplifier (more details below) to measure the AC waveform. I used exactly the same measuring devices (a low-end RIGOL digital scope). The results can be seen in the following graphs – again the input AC waveform is blue and the output waveform is yellow.

The input (blue) and output (yellow) waveforms are exactly in phase. These is no flattening of the waveform. The output waveform is an identical version of the input, apart from the magnitude.

This shows that the input and output waveforms are identical.

To conclude these tests, when I was first looking to provide an isolated output voltage from an AC mains waveform, my first thought was to use a transformer. These tests show that there are issues with non-linearity and phase change when measuring with a transformer. Hence I cannot use a transformer to accurately measure AC voltage.

My magnetic theory is not good enough to explain exactly why there are these differences. It could be due to magnetic saturation, parasitic capacitance and inductance in the coils or problems with the test equipment. I tired to exclude test measurement problems by comparing using the same test equipment. If you have any ideas on this then please add to the comments section.

Hence I looked for other methods to measure voltages…

Hall-effect voltage measurement

Another technique is to convert the voltage into a current. We know that V=IR, so using measuring the current through a known resistance will give us the voltage. This current can be measured using the hall-effect.

One problem is that to get a decent current signal, we need a relatively large current to flow, which means relatively high power dissipation. This is in the region of 3W, which, for a renewable energy system, is a high energy loss, if it is constantly being measured.

Only a handful of manufacturers and hence relatively high cost.

One example of hall-effect voltage measurement is the LV-25-P transducer from LEM, which provides 2500V DC isolation between input and output.

Isolation amplifier

The last form of isolation considered here is the isolation amplifier. This is a special type of integrated circuit which has two electrically isolated sides. The input voltage is scaled to suit the isolation amplifier (2V and 250mV maximum in the cases below). This input voltage is passed from one side of the isolation amplifier to the other via an optical connection. The optical output is received on the output side and converted back into a voltage signal. This output voltage is linearly proportional (around 0.1% non-linearity) to the input voltage, but electrically isolated.

  • Accurate and isolated voltage measurement
  • Very low input power
  • Requires an additional isolated supply voltage (for the input side)
  • Relatively expensive (some are extremely expensive).

Isolation amplifiers can be very expensive. I searched for various different devices and concluded on the following (although I am sure there are many others):

For DC measurements I found the ACPL-C870 device from Avago Technolgies. This costs around £5.43 + VAT from RS. This device requires a 5V isolated supply for both input and output stages. The input is in the region of 0-2V (using a potential divider) and it has unity gain, hence the output is an isolated 0-2V output. It works with DC voltages, although the input cannot go below 0V, hence is not easy to use with AC input voltages.

For AC measurements I am using the AMC1200 from Texas Instruments. This is harder to find, but is available from DigiKey at £4.84 + VAT. This can be used to measure AC waveforms as the input voltage can go + or – 250mV. Hence the input AC voltage can be reduced to +/-250mV using a potential divider. There is a x8 gain within the device and the output is 2.55V +/- (the input signal x 8). This means the output can be measured using a single side referenced DC ADC.

Both of these devices require an isolated 5V voltage supply for the input stage. This can be provided from the waveform under test, as shown in the data sheets, but I prefered to provide and isolated 5V supply using a DC/DC 5V to 5V converter with >1000V isolation. These are now relatively easily and cheaply available. I used the MEE1S0505DC from Murata technologies. This costs around £4.00 + VAT from Farnell. Lots of other version are available.

The waveforms from using an AMC1200 can be seen above in the comparison with the transformer voltage measurement.

Measuring the waveform

As mentioned in the DC current measurment article, There are two main aspects to accurately measuring a varying signal, no matter what the signal. These are the sampling frequency and the resolution:

Sampling frequency

The sampling frequency is of great importance if we are to accurately monitor a waveform. For example if we took only one temperature measurement a day, at 7.47am, we could not say anything about the changes through the day. If we measure on the same day for 100 years, though, we might be able to say something about changes through the year. So it depends on what kind of data trend you are interested in.

The mathematics of this were done by Harry Nyquist and hence we have the Nyquist rate. This states that, to get all the information from a waveform, we must sample at a frequency at least twice that of the waveform. For example – we want to listen to music, which has audiable frequencies up to 20kHz. To cover this we must sample at a frequency of at least 40kHz. Those who have recorded music into a computer will know that the sample frequency used is generally 44kHz. Any less and you will loose information.

Voltage can generally be measured at all times. If we were to measure the voltage at a plug socket we will be able to measure 240V AC, but zero current if nothing is plugged in. When a load is switched on then the current will flow and hence power (V x I) is drawn. We generally see the voltage drop slightly (due to cable voltage drop) when supplying a load.

For some basic electrical systems we can assume that the voltage is constant, and then just measure the current. But this does not give very good accuracy. The voltage will vary quite considerably as loads are varied. In a typical 12V DC lead acid battery system, we will definitely see a voltage range of 11-14V DC, possibly more. Hence to make accurate power measurements we must take accurate voltage measurements.

To get good power information we must also take the voltage measurement at exactly the same time as the current measurement. This is especially true in AC systems, which also have power factor (which is out of the scope of this article).

Resolution

This relates to the fact that we are converting an analogue signal into a digital signal. (This is sometimes called quantization). Digital signals can either be on or off. Analogue signals can be anything at all and can vary infinitely within their range. We are trying to get this varying analogue data into our digital device (the micro-controller). In order to do this we use the concept of levels (also called quanta).

Say we have a sine wave signal varying from 0 to 5V. Lets say we only have one bit resolution. The digital representation can only be on or off. If we set the level at 2.5V then we will see the digital signal to be 0 then 1 then 0 then 1 as the waveform goes above and below 2.5V. You can see that we do not get much detail from the signal. This might be enough data to do what we want, but generally we use more levels. The more levels, the higher the resolution and hence the better data accuracy.

Adding an extra bit to the resolution increases the resolution by a factor of 2. Hence 1 bit = 2 levels, 2bits – 4 levels, 3 bits = 8 levels. This quickly multiplies up and at 8 bits we have 256 levels or at 10bits we have 1024 levels. A typical micro-controller (such as a PIC 18 series, or the Atmel chip in an Arduino Uno) has 10-bit accuracy. Some have 12, 14 or even 16 bits. If you go to higher numbers of bits this puts more work onto the microprocessor, so you can also use special analogue to digital chips (ADC) which process the data and sends it to the micro-controller.

Ensuring the waveform stays accurate

When measuring current, we are usually measuring very small voltages. These have the potential to be corrupted by other very small parasitic signals. These can be broken down into offsets and noise.

Although converting the signal from analogue to digital will mean a loss of information, it also means we can apply techniques to ensure the signal does not get corrupted by noise. Hence I try to convert to digital as quickly as possible.

Noise

Noise is everywhere. It comes from the physics of electrical devices and from interference of the many different man-made and natural electrical and magnetic waveforms. There is lots of information about noise and reducing noise levels, although it is sometimes a bit of a dark art.

I try to keep noise to a minimum by:

  • Keeping signal paths as short as possible
  • Shielded cable or additional metal shielding can be used around parts of the circuit affected by noise.
  • Reduce the number of components the signal travels through – this will reduce the potential for noise to interfere

This is a complex area, so I will not go into too much detail here. Generally good layout and circuit design will ensure relatively low noise.

Offsets

Offsets are when an additional signal is added to the waveform we are measuring. They generally occur when the signal has passed through some other active component, such as an op-amp. Lets say we are measuring a 0 to 5V analogue signal using a 10 bit ADC. This gives us 2^10 levels = 1024 levels. Each level equals 5V/1024 = 0.00488V, or 4.88mV. Hence any offset greater than 4.88mV will change the signal enough to change the number read by the microprocessor. The main reason this might be a problem would be if the signal is taken through an operation amplifier and the operational amplifier has some offset, or cannot get all the way to the ground rail. You can check out the offset voltage using the op-amp data sheet. For example, the offset voltage on a standard 741 op-amp is +/- 15mV, which could give an inaccuracy of over 3 levels. (Note: there is the option to null the offset on lots of op-amps, but this needs individual calibration and additional components). I try to use single supply rail to rail op-amps with an offset of less than 3mV.

14 responses to “Voltage measurement

  1. Great explanation! I was wondering, for measuring higher voltages (~150V DC), are there ideal types of resistors to be used in the voltage divider? (Types of resistors, wattage/heat dissipation, smd/through hole, sizes, etc)

  2. Quoting Moe:Great explanation! I was wondering, for measuring higher voltages (~150V DC), are there ideal types of resistors to be used in the voltage divider? (Types of resistors, wattage/heat dissipation, smd/through hole, sizes, etc)

    Hi, Thanks for your comment.
    With regards to measuring higher voltages – you do need to think about power dissipation. The problem is that, even with a very small current through the divider, there could be some power dissipation due to the high voltage.
    Eg:
    Lets measure 200V to give a 5V output with a 1k lower resistor. The upper resistor will be: 200*(1k/1k+Rupper) = 5, so Rupper = 195k/5 = 39k.
    The current will be:
    V = IR, so 200/40k = 5mA
    This means the power in the lower resistor is:
    P = I^2 * R
    P = 0.005^2 x 1000 = 0.025W = 25mW
    And power in the upper resistor is:
    P = 0.005^2 x 39000 = 0.975W = 975mW
    General through hole resistors are maybe 125mW or 250mW, which means that they would NOT be suitable for this resistance range.
    The easiest way to solve this would be to use higher resistances, so lets use a 10k resistor in the lower and then 390k in the upper. Power dissipation is now 2.5mW or 97.5mW, which means the 125mW rated resistors can be used.
    SMD components usually have lower power ratings. Generally its best to use higher resistances to reduce the current through the network and hence reduce the power, but these calculations should be performed.
    Hope thats some help,
    Regards,
    Matt

  3. I’ve seen similar projects but some of them when measuring voltage they take four samples using four amplifier and four ADC chips. What’s the point ? Thanks

  4. Quoting R Moe:I’ve seen similar projects but some of them when measuring voltage they take four samples using four amplifier and four ADC chips. What’s the point ? Thanks

    Hi. I’m unsure what you mean as I’ve not seen this before. There are tecchniques for oversampling which increase effective resoultion of the data, but that would only use 1 amp and 1 ADC.

    The only thing I can think of is that each set of amplifier and ADC will have slightly different offests/gain factors. To minimise these different effects, more than one circuit could be used to measure the voltage and then the average used (or discard anything away from the others by 1% or so).
    That would only be in high-end expensive stuff though, I’d say.

    Please link to an example if you have one so I can have a look at the technique.

    Thanks and regards,

    Matt

    1. Hi,
      This was measuring standard 240V AC from the UK.
      The peak to peak voltage is around 340V so the rms value is 340V / (square root 2) = 340/1.414 = 240 V AC.
      Hope that answers your question.

      Matt

  5. Sir matthew in the application for measuring the volt measurement using voltage divider for mosfet?. Where did you put the voltage divider?.it is in the Incoming for G pin or in the outgoing of S pin?. Because I confuse that if u use potential divider in the S pin.. It might intrude the vgs value.. Because we applied Vin between Pin G and S right?. I hope you reply asap.thank you

  6. Just a little note, you mention ferrite when talking about the transformer, mains transfomers(50/60Hz) doesn’t use ferrite but instead silicon-steel, silicon-steel transformers can operate with far higher magnetic flux density than what ferrite transformer can. I can’t recall more than that though.

    Also you where not clear about what load you had on the transformer while measuring, the load on the transformer may change the output of it in pretty substantial ways.

  7. Great article, A+++
    Im considering using a 0.5VA step down TX for isolating the mains voltage. Looking at the data from manufacturers i see there is a phase change of <10 degree's between IP/OP. So knowing this is a constant then it will be easy to add to the equation when calculating power from V+I.

    Also regarding your measurements on the transformer, did you have any load on the Tx? Will an open circuit on the secondary cause saturation of the core?

    http://www.zntar.com/wave-recording-voltage-output-voltage-transformer/747-tr1143-1g-voltage-output-voltage-transformer-used-for-wave-recording.html

Leave a Reply

Your email address will not be published. Required fields are marked *