Electronic Design

# Measuring Mains Current Doesn't Have To Be Difficult

Monitoring the current taken by a mains-powered appliance can be a challenge, particularly if the application demands an inexpensive solution that must provide galvanic isolation for user safety. Common solutions employ either a current-sense resistor or current-sense transformer to convert the line current to an ac voltage that’s then converted into a proportional dc voltage. The dc voltage may then be processed using various techniques to provide a direct indication of the ac current magnitude or to implement a monitoring function that can determine whether the current is above or below a certain threshold.

Current-sense resistors, however, can be problematic. When measuring large currents, the resistance value needs to be very low to avoid excessive power dissipation. This, in turn, often requires considerable gain to boost the sense voltage to a useful level. A simple example will illustrate this point.

Let’s say we need to measure a maximum current of 15 A. A 10-mO resistor connected in a Kelvin-type configuration would generate a sense voltage of 150 mV at 15 A. An amplifier with a gain of, say, 20 would be sufficient to boost this voltage to a useful level.

So far, so good. However, the 10-mO resistor would dissipate 2.25 W at 15 A. We could select a 3-W unit, readily available in surface-mount (SMT) or conventional packages, but the size and cost of a suitably rated unit may prove unacceptable. Furthermore, the heat generated by the resistor might well be a problem, particularly in small enclosures where it may be difficult to apply adequate cooling.

We could minimize the power dissipation by reducing the resistance by a factor of 10. The resulting 1-mO resistor would dissipate just 0.23 W at 15 A—much more manageable. However, we would now require a gain of around 200 to boost the 15-mV maximum sense voltage to a useful level. Even if we could arrive at a resistance value that was acceptable in terms of power dissipation, cost, and the associated amount of amplifier gain, we would still face a significant problem: the sense-resistor technique provides no inherent galvanic isolation whatsoever.

Current-sense transformers, on the other hand, provide the galvanic isolation necessary for operator safety. Generally, these components tend to be available in one of two types. The first consists of a primary winding (the current-sense winding) and a secondary winding, both wound on the same core—much like a conventional power transformer. The second features a secondary winding wound on a toroidal core, resulting in a completely sealed unit. The conductor carrying the current to be measured is passed through the center of this sealed unit, and it therefore functions as a single-turn primary.

In both cases, the turns ratio is usually large, often in the range of 1:50 to 1:1500, so that even relatively small primary currents can generate a large secondary voltage. This obviates the need for high gain amplification.

Current transformers are available to cover a wide range of primary currents, anything from a few amperes up to many hundreds of amperes. However, despite their evident advantages, particularly the inherent galvanic isolation, they’re often bulky and expensive, and certain types suffer from nonlinearities over a wide current range.

It should be clear by now that an “ideal” mains current-sensing solution would be small and inexpensive, and it would feature intrinsic isolation. Furthermore, it should introduce negligible voltage drop into the primary conductor and produce a linear response over the full current range, as well as have power dissipation at close to zero. In addition, it should be possible to fabricate the solution on a printedcircuit board (PCB) using conventional techniques, without the need for any bulky components.

HALL EFFECT
This leads us to the Hall Effect. Working at Johns Hopkins University, Baltimore, in 1879, Dr. Edwin Hall discovered that when a current-carrying conductor was placed in a magnetic field, a voltage proportional to the field was generated. This principle, known as the Hall Effect, is now widely used for sensing both static and alternating magnetic fields.

Furthermore, since a current-carrying conductor generates a magnetic field, a Hall sensor placed in the field can be used to generate a voltage that’s directly proportional to the external current. Combining the Hall sensor with the conductor in a single package results in a current sensor that can be used to measure dc or ac currents.

Allegro Microsystems’ ACS712, an example of this type of sensor, integrates a Hall Effect sensor and low-resistance current conductor in an SO8 package (Fig. 1). Operating on a nominal 5-V dc supply rail and able to sense ac or dc current, it provides 2.1-kV isolation between the sensor circuitry and the current conductor. The current flowing through the conductor generates a magnetic field that’s sensed by the integrated Hall IC and converted into a proportional voltage.

There are three variants of the ACS712, providing sensitivities from 66 mV/A to 185 mV/A with corresponding current ranges of ±30 A to ±5 A. The internal conductor resistance is typically just 1.2 mO, so power dissipation is little more than a watt at maximum current (30 A). Allegro produces a range of larger devices, such as the ACS754, that can handle currents up to 200 A.

Clearly, devices like the ACS712 offer an attractive solution to measuring ac mains current. But priced around \$1.60 for large quantities, the ACS712 could prove too expensive for low-cost applications. Furthermore, although not excessive, the internal power dissipation may be troublesome at the top end of the sensed current range.

GOING LOOPY
Fortunately, there’s an alternative approach available, which again exploits the advantages provided by a Hall Effect sensor. In its basic form, the sensor is mounted on one side of a double-sided PCB and positioned to lie in the center of a loop of track on the other side of the board (Fig. 2).

The principle of this technique is simple: mains current flowing around the loop creates an alternating magnetic field that’s concentrated directly on the sensor. The looped track behaves like the U-shaped conductor shown in Figure 1. Since the low-voltage (LV) tracking to the sensor is located on top of the PCB and the hazardous mains tracking is on the bottom, the insulating PCB material itself provides the galvanic isolation required for safety.

Continue to page 2

Another Allegro sensor, the A1321ELHLT- T, is used in this application. Like the ACS712, the A1321 generates an output voltage proportional to the applied magnetic field. However, the A1321 is considerably cheaper than the ACS712. And since the mains current now flows through the PCB track, not through the sensor package, the power dissipation in the sensor itself is no longer an issue. Housed in a SOT23 package, the small size of the A1321ELHLT-T means that the current loop itself can be quite compact, thereby taking up relatively little PCB real estate.

The quiescent output voltage of the A132x family of sensors is nominally 50% of the supply voltage, and the output sensitivity of the A1321 variant is 5 mV/ Gauss. Therefore, with the sensor powered from a 5-V supply rail, the configuration shown in Figure 2 will produce a small ac signal swinging about a quiescent dc level of 2.5 V. Figure 3a shows the output signal obtained with a sinusoidal current of 4.9 A rms (50 Hz) flowing through the loop.

Clearly, the signal must be amplified and converted to a dc voltage before it can be processed by further circuitry, such as an analog-to-digital converter or comparator. There are many ways in which an ac signal can be converted to a dc level.

One solution combines an amplifier with an averaged absolute value circuit (Fig. 4). The circuit amplifies the ac portion of the signal, strips out the sensor’s quiescent dc level, and then generates a dc voltage proportional to the absolute value of the ac waveform.

The sensor output (pin 2 of IC1) contains significant HF noise (Fig. 3a, again): this is filtered out by R1 and C2 (Fig. 4, again). The corner frequency of this low-pass filter is much higher than the frequency of the mains signal (50 Hz/60 Hz) and, therefore, has little effect on the amplitude of the mains signal fed to the amplifier stage.

The amplifier formed by IC2, R2, R3, and C4 provides high gain for the ac content of the sensor’s output signal and unity gain for the dc content. Consequently, the signal at IC2’s output is an amplified version of the mains signal riding on a dc level of 2.5 V. The ac gain is given by:

ac gain = 1 + R2/(R3 + XC4)

where XC4 is the reactance of C4. With the values of R2, R3, and C4 as shown in Figure 4, the nominal ac gain is approximately 36 at 50 Hz/60 Hz.

The remainder of the circuit functions as an averaged absolute-value converter. The converter comprises two stages, the first being a differential-output absolutevalue converter built around IC3a. The second stage comprising IC3b is a traditional differential amplifier.

The combination of the two stages along with the integrating function provided by capacitors C7, C8, C9, and C11 performs single-ended absolute-value conversion. The result is a single-ended dc output voltage at VO, which is proportional to the peak-to-peak amplitude of the signal appearing at the output of IC2.

The converter is based on a circuit described in Reference 1, but with the important addition of R4 and C6. This low-pass filter entirely removes the ac content of the signal at IC2’s output and leaves only the dc content (nominally 2.5 V), which provides a reference potential at IC3a’s non-inverting input.

This reference potential could have been generated by means of a potential divider connected to the supply rails, but the low-pass filter approach ensures that the reference voltage is always exactly equal to IC1’s dc output level (which can vary from 2.425 to 2.575 V).

OP-AMP SELECTION
When choosing components for the circuit, select op amps with low input bias current. Ideally, IC2 should have a wide output swing, and IC3a and IC3b should be rail-to-rail I/O types. Op amps with low input offset voltage are preferable for IC3a and IC3b to minimize dc offsets. Although IC3 is shown as a dual device, two single op amps could be used just as well.

Figure 5 shows an actual implementation of the scheme. The inner diameter of the mains track loop on the bottom of the PCB (Fig. 5a) is roughly equal to the size of the Hall Effect sensor located on the top of the PCB (Fig. 5b). When implemented with SMT components, the whole circuit occupies an area not much larger than a postage stamp.

The magnitude of the ac signal generated by the sensor is very sensitive to the dimensions and geometry of the track loop. Therefore, when the board tracking is finalized and the first prototype sample is ready, it may be necessary to adjust the gain of the circuit to get the optimum variation in VO for a given range of mains current. The easiest way to achieve this is by adjusting the value of R3 while keeping all other values constant. When laying out the PCB, take care to ensure that the width of the mains tracking is adequate for the maximum current value that will be encountered.

Figure 6 shows the actual response generated by the layout of Figure 5. Note how the circuit produces a perfectly linear response over a mains current range of around 0.4 A to nearly 13 A rms. The sensitivity of the overall circuit in terms of output voltage relative to input current is around 350 mV/A. Other sensitivities can be obtained by changing the amplifier’s ac gain.

Keep in mind that the circuit only generates an average measure of the absolute signal value. This is fine for truly sinusoidal waveforms in which the rms value is proportional to the peak-to-peak value. Certain types of load, though, can distort the current sinewave and produce erroneous results.

Continue to page 3

For example, some appliances, such as hair dryers and fans, feature a control that switches in half-wave rectification of the mains waveform to reduce the power and/ or speed. The resulting waveform usually resembles the signal shown in Figure 3b. To measure the rms value of current signals that aren’t true sinewaves, it will be necessary to couple IC2’s output into an rmsto- dc converter, such as Analog Devices’ AD737 or Linear Technology’s LTC1966.

Note that the scheme isn’t suitable for measuring very low currents where the inherent offsets and nonlinearities in the circuit become significant relative to the very small signal produced by the Hall Effect sensor. Consequently, at currents below about half an ampere, the circuit’s accuracy and linearity start to deteriorate. Also, the circuit isn’t intended for precision current measurement—you may need to consider other techniques if you require accuracy better than ±5%.

Repeatability (in terms of differences in measured sensitivity from one unit to another) is influenced mainly by variations in overall circuit gain and by part-to-part shifts in the Hall Effect sensor’s magnetic sensitivity. (The A1321’s sensitivity is nominally 5 mV/Gauss, but can vary from 4.75 to 5.25 mV/Gauss.) Still, measurements on two prototype boards produced strong results, where the difference in sensitivity was less than 1% of nominal.

REFERENCE:
1. Dobrev, Dobromir, “Two op amps provide averaged absolute value,” p. 98, EDN, Oct. 30, 2003.