DC current measurement

A number of the projects we are involved with require accurate monitoring of DC currents. Here we explain the numerous techniques for measuring DC current flowing in a line, highlight some of the multitude of integrated circuits available and list the pros and cons of various techniques. This is an on-going work – please post comments with your ideas and techniques.

Background

DC current measurement is required for power measurement, as power = voltage x current. 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 current 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). I may write another piece on voltage measurement.

Measuring the waveform

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. We can say something about changes through the year, though. So it depends on what kind of data trend you are interested in.

The same is true for monitoring current. If we take one sample every day, it might be at the time when nothing is switched on. Hence we could look at this for a year and conclude that no power was drawn. Obviously this is probably not the case. Maybe 10 mins later someone turns on some huge load for 5 hours then switches it off again. So the rate at which we sample is important.

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.

This is important with DC power systems. There are components, such as inverters, which switch on and off very high currents at very high rates (10’s to 100’s kHz). Generally this is internal to the unit and capacitors on the input smooth this frequency, hence we do not need to look quite at that high frequency, but we definitely need to think about it. If we can take lots of samples and then average them then that is best. This is especially true when we are measuring energy into and out of the battery, where any inaccuracy could mean the device does not know what has gone into the battery and hence looses track of the energy balance.

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 have lot a lot of 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.

In this article I will be using the ADC within the micro-controller (I use both PICs and Atmels) – usually a 10 bit ADC.

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.

Methods to measure current

There are two main methods of measuring DC current: invasive and non-invasive.

Invasive

Invasive methods, as the name suggests, means you must place something in the actual current path. We usually use a low value ‘shunt’ resistor. As V=IR, current flowing through a small resistance will mean that a small voltage drop will occur. We can then read this voltage, which will be proportional to the current flowing.

The shunt resistor can either be in the high-side path (the positive wire) or in the low-side path (the negative wire).

We must be very careful with the resistor value selection as a high resistance will mean a high voltage drop, which also means a high power loss.

Typical shunt resistor values are from 0.01 milli-ohms to around 1 ohm (dependent upon the current range). They come in many different forms. The classic design is quite large, as shown here:

They are good as they are usually quite accurate and also do not get too warm, so the resistance is not affected by temperature. But they are expensive (around £10-50 each).

The voltage can be interfaced directly to a micro-processor, but generally some form of amplification is required to the the shunt voltage to be within the input range of the ADC. An op-amp is usually used to perform this function.

Pros

Simple

Cheap

Easy

Can be accurate

Cons

Low-side current measurement is easiest, but it can introduce a voltage drop where it is not desirable

High-side current measurement is difficult, and requires careful thought or a specific IC

Shunt resistor requires careful design

eg: measure 100A in a 12V system. With a 1ohm resistor you will get 100V voltage drop (i.e. it would not work) and that resistor would be dissipating 100W (Power = VI) which would be a massive waste.

For reasonable power dissipation (of under 5W), the resistor must be (Power = I2XR) 5/(100×100) < 0.5milli-ohms

Sometimes requires a high impedance buffer – the ADC might not have a very high impedance (in a lot of micro processors this is true) and hence measuring the signal will change it. An additional op-amp buffer is required to stop this error.

Non-invasive

Non-invasive techniques generally use a hall-effect sensor. The hall effect is a transducer whose voltage varies in response to a magnetic field. Current traveling through a cable will set up a magnetic field which is proportional to the current flowing. Hall effect sensors generally have a hole through them where a single current-carrying cable is passed through. Sometimes they can open out to clip around large cables. The main companies producing hall effect sensors are LEM and Honeywell. Sensors are in the range of £5 to £80.

Pros

Do not need to disrupt the wires or cabling

Total electrical isolation (galvanic isolation) of the measuring device

Wide range of currents – including very high currents

Usually on-board processing of the signal to output a useful range for a microcontroller.

sir.., i have something to ask about… according to my understanding about this post.. if i choose to use hall effect(ACS) sensor. I dont have to use a shunt resistor right? because if i i use shunt resistor, i need to use ad8211 ic for analog measurement right?. I am about confusing to use this 2 method invasive and non-invasive method.Second one is, for the analog conversion.. for arduino ..it is the same for ad8211 and ACS sensor according for your gifthub pv iv curve tracer?because i had run the code that you give but i had replace ad8211 with ACS in proteus it seem that the current does not read by the arduino.

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

Comment

Name *

Email *

Website

Re-Innovation

Renewable Energy Innovation specialise in electrical and electronic systems for renewable energy projects, mainly solar, wind and micro-hydro. We focus on renewable energy based stand-alone power supply systems (off-grid systems). This includes power and energy monitoring, battery charge control and wiring systems. Please contact us to talk about your project. If you require consultancy, design and implementation services for your renewable energy project please contact us.

Curious Electric Company

The Curious Electric Company specialise in creating electronic kits that help you monitor and measure the world around you, with clever data loggers and sensors you can take the pulse of your planet, collect and share data and knowledge with the world. Be informed - stay curious!

Bespoke Gear

Our sister business, Bespoke Gear have been building interactive pedal-power systems for over 15 years. Doing events and selling equipment to a wide variety of customers in that time we have learnt what works. We design and build high-quality, robust pedal-powered equipment and bespoke, interesting and interactive displays. If you are trying to promote environmental awareness, energy efficiency, getting people fit or just want something thats a bit different for your event then we might have something for you.