AC Current Sensing Part 2

I am going to follow-up my last post on current sensing with a real world example. I am going to set up an example circuit designed to sense current flowing from a 24V 60Hz AC Source using a 5V instrumentation amplifier. Before we do that, however, I want to illustrate the relationship between the ground in a circuit that has been rectified into DC and its original source. Note this example set-up:

Rectified Ground Relationship

An exaggerated sense resistor is used for clarity. Here we examine the sense voltage relative to rectified ground. This is the oscilloscope result:

Sense Resistor Voltages

Sense Resistor Voltages

As you can see, we have an ugly waveform on the top. Sometimes pin 1 (blue channel) of the sense resistor is at a higher potential, sometimes pin 2 (yellow channel) is. The red waveform is the difference between the two channels, it represents the sense voltage, and of course, is perfectly sinusoidal. The scope is set up for DC coupling here. The key point here is that the AC voltage is always positive with respect to your rectified ground. This will always be the case as long as a pin of your resistive sense element is aligned with either of the AC source nodes. If you try to sense across a reactive element (capacitor, inductor) or place your sense resistor in between reactive elements, the voltage will be out of phase with the voltage you rectified from; as a result, part of the waveform will be negative relative to rectified ground.

The schematic below represents a circuit designed to exploit this “always positive” property to sense current. If you consult the original post, you’ll see that we need to offset the voltage so that the single supply micro can tell if it is negative or positive. We could use a quad op-amp chip, use 3 op-amps for an instrumentation amplifier and the final op-amp to buffer our offset voltage. In this case, however, it is going to be much easier to use a pre-packaged instrumentation amplifier. I have chosen the Analog Devices AD8293 amplifier. It is a fixed gain amp, offered in either 80 or 160 gain. It has very good characteristics and accuracy and is reasonable priced at $1 – $2 USD in very low quantities. Especially useful for our purposes here, it has a high impedance REF pin for offsetting the output. The datasheet specifically states that no buffering of this offset is necessary. Its major limitation is low bandwidth but that won’t be an issue for sensing from the 60hz mains. I have set up the following circuit.

Current Sensing CircuitAs you can see, the voltage is divided down by a factor of 11 so that it is in range of our amplifier, which then amplifies the difference by 160. It would have made more sense here to use the AD8293G80 80 gain version and use a higher sense resistance like 0.4 ohms, but I only had the AD8293G160 on hand. The net result is that our sense voltage is amplified by a factor of 14.55 [formula: (1/11) * 160] and referenced to half of VCC .  Since the offset divider is radiometric, no matter where the supply moves, the offset will always be exactly half of the ADC top value. Here is the oscilloscope shot of the results. The oscilloscope ground is connected to the rectified ground and the probe is connected to the ADC OUT to ADC IN line.

DC Coupled

DC Coupled Waveform

AC Coupled Waveform

AC Coupled Waveform

As you can see from the DC waveform, the voltage is well within the sensing range or a 5V microcontroller. When selecting your range, make sure that your full scale expected current range does not cover the full scale ADC range. You will want some margin for detecting fault conditions. Using my Fluke 87 true RMS meter, I measured the circuit voltage to be 23.3VAC and the total resistance to be 78.2. This would equate to about 298mA which would create create a sense voltage of about 59.6mV across the 0.2 ohm sense resistor. When amplified by the 14.55 gain, our expected output voltage is about 867mV RMS. Per the oscilloscope shot, the measured result is 860mV RMS, quite an impressive result.

In order to calculate RMS current in the micro, the waveform must be sampled at regular intervals and combined into an RMS figure. The following is a psuedo-code example:

/* The following is pseudo for concept illustration. It has not been checked or debugged  */
int results_array[1000];
int result_count;
//get a full 60hz cycle of 16.66 ms
begin_time = get_millisecond_tick();
result_count = 0;
while ((get_millisecond_tick() - begin_time) < 16.66)
    while (isDoingConversion());
    int result = getADCResult() - 512; //subtract half value for 10-bit ADC to get signed result
    results_array[result_count] = ConvertADCValuetoAMPS(result);
int total = 0;
int i;
for (i = 0; i < result_count; i++)
    total += results_arry[i] ^ 2; //square each term and add them up
total /= result_count; //divide by the total number of terms
int TrueRMSCurrent = sqrt(total); //the square root is the RMS value

The main point of caution about this circuit is that it is extremely sensitive to common mode error caused by resistor divider mismatch. For this demonstration, I manually matched two 10k resistors, then matched two 1k resistors. 1% tolerance resistors can not be counted on here. Unchecked you will simply end up with useless readings. Basically, you have three choices here.

  1. Use 0.1% tolerance resistors
  2. Match the resistors for like values manually
  3. Implement trimming
  1. Your method of telling all in this post is actually
    good, every one can without difficulty be aware of it, Thanks a

    Visit my page; Emf Copper Mesh

  2. Hi, i think that i saw you visited my site thus i came to “return the favor”.I’m attempting to find things to improve my website!I suppose its ok to use a few of
    your ideas!!

    My blog: buy a fake id

  3. Hello there, I discovered your site via Google even as searching for a similar subject, your website
    came up, it appears to be like great. I’ve bookmarked it in my google bookmarks.

    Hello there, just became aware of your weblog via Google, and located that it is really informative.
    I’m going to watch out for brussels. I will appreciate for those who proceed this in future.

    Lots of folks might be benefited from your writing. Cheers!

  4. 2wwdp7

  1. June 27th, 2014
    Trackback from :
  2. July 5th, 2014
  3. July 22nd, 2014
    Trackback from :
  4. October 10th, 2014
    Trackback from : mechanical