AC current sensing basics and the TA17-03

I'm working on a project where I control a pump with a relay and it's critical to verify that the pump is actually operating. I am controlling a boiler with a 24V signal (also from a relay), but the pump must circulate water through the boiler to prevent short cycling and, ultimately, damage to the heat exchanger.

I have temperature sensors on the circulation loop, not in wells, so there is some delay before the temperature sensor will notice that the loop is actually circulating through the boiler.

This seems like a good application for an AC current sensor: it could tell me that the "expected" current is being used by the pump. Because it's an inductive load, I should even be able to see the surge current at the beginning, followed by a gradual reduction as the loop fluid comes up to speed.

While I am curious about its total energy consumption (Watts used), the primary goal is to verify the pump operation. The accuracy of the current sensor is really secondary concern.

After a little looking around it seems like there are two common choices:

1) Non-invasive: Wrap a **C**urrent **T**ransformer around one of the 120VAC lines to the pump. This can be clamp-on for existing installations, or pass-through if one of the supply lines can be detached and inserted through the CT "donut". The primary winding of the transformer is the single supply line, and the secondary is the CT "donut". That is, a CT is really just the secondary winding. The ratio of the windings will be the ratio of the current induced in the CT. For example, the TA17-03 has a ratio of 1000:1 and can measure AC currents up to 10A.

2) Invasive: Insert a sensor in series with pump's 120VAC supply line. This requires breaking one of the lines and inserting the sensor between those two points. One approach is to use a Hall Effect-based IC, which actually measures the magnetic field generated by the current. As discussed here, they are quite noisy. Another approach is to use a shunt resistor and measure the voltage drop across it. Given the voltage measured and the resistor value, you have I = V/R. Thanks, Ohm! Of course, the disadvantage of the invasive approach is that you are not isolated from the high voltage.

It seems like the CT approach is simpler and safer. I found an Arduino-ready AC Current Sensor brick by ElecFreaks, and a US-based source on ebay.

After it I arrived, I started looking how this module works, and how I might need to protect the Arduino. I couldn't seem to find a schematic for the board, though... The wiki shows it just being plugged into the sensor shield, but after reading about AC Power Measurement at OpenEnergyMonitor.org, I couldn't see how this brick could be connected that way.

Ok, where to start...

First, let's look at the current through the CT. When current flows through the supply line, it induces 1/1000th of that current in the CT. That current, althoug small, must flow. Connecting the terminals with a wire allows 10ma to flow when there are 10A flowing through the supply line. If you were to leave the CT connections open, bad things will happen... In a nutshell, the voltage across the open connection will increase until a spark develops somewhere, between the terminals if you're lucky. That spark allows the measly 10mA to flow. 1000V, or whatever it takes, but that 10mA must flow.

Fortunately, the brick comes with a load resistor across the CT to make sure the induced current has a path to flow. This is also useful because the Arduino can't measure current; it can only measure voltage on its ADC pins. With proper choice of a load resistor, that voltage can be kept within the safe operating range of the Arduino. The load resistor on the brick is 200ohms, which means the voltage across that resistor will be 0-2V when the CT current is 0-10mA.

Second, let's look at the polarity of the voltage across the CT load resistors. The AC voltage being used by my pump varies between -120V and +120V. Similarly, the current being used by my pump varies between -2A and +2A. That means that the CT will have an induced current of -2mA and +2mA. And that means that the voltage across the 200ohm load resistor will vary between -400mV and +400mV.

Wait... -400mv? The Arduino ADC inputs can only take 0-5V. You can't connect that signal to an Arduino. If the pump were to use 10A, the Arduino would see -2V on its ADC input pin. I can only assume that ElecFreaks never used this device with heavier loads. What a surprise... I found a mistake on the innertubes. :-/ There was a discussion at the OpenEnergyMonitor.org forum which raised similar questions about the brick.

The solution is to add a bias to the signal so that it never goes negative. 2.5V seems like a good number, as that would allow the maximum range of -2.5V to +2.5V to be shifted to 0 to 5V. A simple resistor divider is used to bias one pin of the CT at 2.5V. (This is the GND pin from the brick. The VCC pin is not connected.) Then the signal voltage from the other pin of the CT will oscillate around 2.5V. (This is the SIGNAL pin of the brick.) Here's what I have so far:

But now I'm wondering... What if the initial current surge through the pump is more than 10A? Won't that induce more than +-10mA, which is more than +-2V. Let's say its a 20A surge. That means +-20mA, which means +-4V. After biasing, thats -1.5V to +6.5V at the ADC input. Ouch. I could drop in a Zener to clamp the top end to +5.1V:

And when the voltage begins to drop below -0.7V (on its way to -1.5V), the Zener will be forward-biased, allowing current to flow. So the Zener will restrict the ADC input to -0.7V to +5.1V. Is there any way to "clamp" the bottom end of the voltage range?

I could drop a diode in:

...but that would clip any positive voltage less than the 0.7V drop across the diode. I could not measure currents of 350mA or less.

It turns out that this is very similar to protecting a circuit from reversed polarity, like hooking up a battery the wrong way. Here's a very nice discussion of several protection circuits. The basic idea is to use a P-channel MOSFET on the high side:

Also, Googling for "ADC input protection" in general seems to suggest current-limiting resistors and a spike-reducing cap:

SPICE simulation seems to confirm that the Zener clamps the top end, and the FET stops conducting at the bottom end. Here's the results for a 20A load (4VAC at the SIGNAL pin):

The green is the voltage at the input pin, nicely limited to 0V-5V. The light blue is the voltage across the FET, and the red is the current through the Zener. The energies in those two devices measure in the mW, so they will be effective for a wide range of CT signals.

Yeah, that's a little different from plugging it into a sensor shield... :roll_eyes: Does anybody have any comments or suggestions? Analog really isn't my strong suit, so I'd appreciate the help. Are there other gotchas lurking here?

Thanks,
/dev

You are over thinking the problem.

Connect one end of the (terminated) CT secondary to an analog pin.

Connect the other to the midpoint of two 10k resistors between 5V and GND. The 10k
resistors will limit the current to the analog pin to a level that its protection diodes can
easily handle.

You could also add a couple of 2V7 zeners in series (but opposite orientation) across
the CT secondary to clamp the output voltage to about +/-3.3V.

Connect one end of the (terminated) CT secondary to an analog pin.

Connect the other to the midpoint of two 10k resistors between 5V and GND.

Hehe... so I could have stopped here:

...except for the overvoltage during surge. If I had a 40A surge, that's 40ma in the CT, which is 8V on the SIGNAL pin. It will try to put -5.5V to +10.5V on the Arduino pin, but because of the input pin protection diodes, it'll be clamped to -0.5V to +5.5V. About 1mA will be shunted through the diodes.

I love the back-to-back Zeners you suggest:

With external Zeners, the internal protection diodes will see much less current, less than 0.1mA. The Zeners will see 20mA or so (the other 20mA runs through the brick 200ohm resistor). That keeps all the current out at the CT, not through the 10k. Beauty! Thanks for that!

I'm curious about your next statement, though:

The 10k resistors will limit the current to the analog pin to a level that its protection diodes can easily handle.

I can't find anything in tha Atmel spec about rating these diodes. It simply says "All I/O pins have protection diodes to both VCC and Ground." The voltages are supposed to be between -0.5 and +5.5V, but I assumed that was to keep me from using the protection diodes at all. Is there a rule of thumb here? 1mA is ok, but 5mA is too much?

Thanks again for the help!

Regards,
/dev