Arduino non-contact AC sensor
February 22, 2020 7:05 PM   Subscribe

I have a 220 V AC swimming pool pump in an outbuilding. The pump is connected to an over-sensitive GFCI breaker which nuisance-trips once or twice a week. I'm having trouble finding an Arduino compatible circuit to sense when the breaker trips and the voltage to the pump goes away.

I want to use an Arduino sensor to sense the absence of AC voltage in the wire running to the pump. This will need a non-contact voltage sensor for safety reasons.

I'm having no luck finding a non-contact digital AC voltage sensor. Is my best bet just disassembling a voltage sensor pen, or is there a more elegant solution on the market?
posted by monotreme to Computers & Internet (15 answers total) 2 users marked this as a favorite
 
Best answer: Are there any status lights on the pump? If so you could use a photocell.
posted by MonsieurBon at 7:14 PM on February 22, 2020 [2 favorites]


a Non-Invasive Current Sensor?
posted by scruss at 7:30 PM on February 22, 2020


If you're willing to wire a few transistors and resistors together, you can build your own. The circuit is pretty easy to adapt to an arduino input -- the power supply voltage is not critical. (the coil of wire around the power cord is an antenna, it should only have one side attached; this is important.)
posted by seanmpuckett at 7:50 PM on February 22, 2020 [1 favorite]


Is there something you could fix in the breaker instead? Seems like a more straightforward fix. If it’s humidity triggering the GFCI a small fan might even fix the problem.
posted by q*ben at 8:10 PM on February 22, 2020 [1 favorite]


Response by poster: This is a known problem with this pump. The pump manufacturer says to use a less sensitive Brand X breaker. We have a Brand Y breaker. It would cost about $200 to switch.

I'm looking to have the Arduino tweet at me (or something) whenever the breaker trips, so that I can walk out and reset the breaker.
posted by monotreme at 9:06 PM on February 22, 2020


Mod note: sanka, I'm positive you can make your point without hurling abuse at the OP
posted by Eyebrows McGee (staff) at 9:31 PM on February 22, 2020


Oomph in that case as someone with expensive repair experience with this go with the $200 breaker fix.
posted by geoff. at 10:03 PM on February 22, 2020


Best answer: EE here. There are four main ways you can tackle this problem, and they are all viable:

1. Non-contact voltage detector. This would tell you when the pump has voltage.
2. Non-contact current detector. This would tell you when the pump is on and drawing current.
3. Isolated voltage detector. As #1, but directly connected through an isolation barrier.
4. Isolated current detector. As #2, but directly connected through an isolation barrier.

Of these options, #4 has no advantage over #3, so no reason to bother with it. You're asking how to do #1; this will work, but I don't recommend it as it'll be a finicky circuit. If you were building 1,000 of these, I'd strongly oppose it, but you can probably get just one unit working. I still like options #2 or #3 better, though, as they're both straightforward and reliable.

Option #2, the non-contact current detector, is probably the preferred option and what I would typically recommend in a "production" context. The idea here is that you want to use a coil around the power cord, to pick up the current induced in it by current flow in the power cord. The main gotcha here is that you must not wrap both power conductors with your sensing coil, as the current flowing out on one conductor will flow back on another. The sensing coil responds to the net current, and so if you grab both wires that will be zero! Typically one would cut up the outer shield jacket of a cable and carefully mount the sensing coil on just one conductor. You could then stick that section of cable in a box with a male and female plug end on it, or whatever is convenient, making a little box you can plug your troublesome load into.

(This also suggests another way to make the problem go away: run the pump off an isolation transformer. However, that will have other safety implications and you must not do this unless you can explain what those are and exactly how someone might die if you do this!)

The whole business about splicing cables and making boxes and only being able to tell when the pump is actually drawing current, not when it just has voltage, means I would probably go with option #3 if I were solving this problem myself. That's an isolated voltage detector: basically, you plug it into an outlet and it generates an output signal indicating if the outlet has voltage or not. To do this safely requires an isolation barrier. There are many, many ways to do that; the easiest would be to use a small transformer or an optocoupler or two. More complicated methods include linear optocouplers (e.g., LOC111) or isolated modulators. A small transformer is kind of interesting because you could get all kind of power quality metrics and fun stuff, but you probably don't care about that. An optocoupler (e.g. 4N26) is probably the way to go here if you want to keep it simple. The basic idea is that you rig up the input (LED) side to trigger only off a large differential voltage by using a big resistor divider. Then you use the output (transistor) side to modulate one of the Arduino's input pins, probably with the help of a pull-up resistor. You know that you should get a signal once per cycle of the AC waveform (or twice, depending on how exactly you rig it up), and you can then program the Arduino to alert if it doesn't see such a signal within the expected time frame. (There are many variations on this theme.)

Some search keywords for option #2: non-invasive current sensing, current sense transformer, LEM module. For option #3: AC line sync, AC line detection, mains voltage detect circuit.
posted by GSV The Structure of Our Preferred Counterfactuals at 10:05 PM on February 22, 2020 [3 favorites]


Best answer: Most NCV pens light up. You could tape the tester to the cable and then tape a photocell to the tester and use that to pull up a relay. Note that NCV testers won't work if the cable is armoured with metal (teck is common in this application in Canada, not sure what is used in your area.)

A cleaner way to go would be to monitor current with a CT. It's pretty easy to interface one with an arduino. An advantage to this method is it would also alert you if the motor quits.

This is option #2 above. I wouldn't cut the cable to affix a CT, just mount the CT in either the breaker panel or the motor starter. You could nipple the box containing the arduino directly to the panel/starter for a clean install.

You could also use a pressure switch mounted in the output piping from the pump. This would be way more reliable than a hacked together voltage sensor and wouldn't require messing with mains voltage. Also cheap. Also alerts you if the motor quits, the pump stops working or there is a fault in the plumbing. This is the approach I'd use.

Personally I wouldn't swap out the Class A (5mA) GFCI for something that has a higher threshold (typically 30mA) despite the pump manufacturer's recommendation. Class B GFCIs are available for things like heat tracing but, in Canada at least, would be illegal to use on pool equipment (I don't have my NEC handy but it might be less restrictive1). 10mA is generally considered the death threshold and you don't need much leak at all to feel tingling in the pool.

Using a isolation transformer also wouldn't be legal unless it was GFCI protected which puts you back at the GFCI tripping because the motor is leaking current to ground.

PS: Breakers aren't rated to trip repeatedly (even the switch duty breakers aren't rated to trip over and over again). They quickly wear to the point where they either won't hold up to the handle rating or fuse on and don't trip at all. If this is happening so often that you need alerting to when the pump trips off you should strongly consider replacing the pump with one that doesn't have this problem. Not cheap I know.

[1] A little searching around found this:
A Class B GFCI with a 20 milliamp trip level is to be used only for protection of underwater swimming pool lighting fixtures installed before adoption of the 1965 National Electrical Code (NEC).

posted by Mitheral at 10:40 PM on February 22, 2020 [1 favorite]


Best answer: This is dumb but the implementation is mostly software if that's where you're more comfortable.

Power the Arduino from the same circuit as the pump. Have the Arduino post a proof-of-life every minute or so to a little service. If the service stops getting updates, the circuit breaker has probably been tripped, and the service can email you about it.

Possibly of use for you: The ESP8266 is an Arduino-compatible WiFi platform that is super-cheap ($5 or so).
posted by slagheap at 3:34 AM on February 23, 2020 [4 favorites]


If you have an outlet on a different circuit nearby it would also be pretty straightforward to make the logical inverse of slagheap's circuit -- you could have a 5VDC wall wart plugged into the GFCI circuit with the pump and have an Arduino powered by a separate circuit read that 5v (probably with a pulldown resistor so the wall wart capacitor doesn't take forever to bleed out when the GFCI trips).

I would, with kindness, say that I'm very wary of solutions that involve you re-wiring any 220VAC circuitry if you're starting from the position of needing to ask this question. I would strongly suggest that you stick to building strictly low-voltage apparatus, not just for your immediate safety but because this is presumably experimental hardware that's going to run unattended for a long time in a pretty hostile environment.

I think all of GSV's solutions above will all work (though I'm slightly skeptical of what are effectively no-load voltage measurements on a system like this; you are looking for such low voltages that I think you're probably susceptible to ghost AC readings via capacitive coupling through the breaker). But some of those methods involve tampering with/rebuilding the 220VAC pathway and that's capital-D Dangerous (like, knock you on your ass if you're lucky dangerous). Getting shocked by 110VAC gives you precisely zero idea of how bad 220VAC is. Even the most jaded electricians I know slow down and treat 220 with respect.
posted by range at 8:35 AM on February 23, 2020


Response by poster: @Mitheral Breakers aren't rated to trip repeatedly

The breaker trips 2 or 3 times a month in winter, less in summer. How concerned should I be?
posted by monotreme at 12:11 PM on February 23, 2020


> you could have a 5VDC wall wart plugged into the GFCI circuit with the pump and have an Arduino powered by a separate circuit read that 5v (probably with a pulldown resistor so the wall wart capacitor doesn't take forever to bleed out when the GFCI trips).

I actually really like this solution. It's not suitable for a product design, but it's really good for a one-off.

> The breaker trips 2 or 3 times a month in winter, less in summer. How concerned should I be?
It'll probably fail early, but I wouldn't be too worried. Then again, I am, ah, as a poster above put it, rather jaded....

> though I'm slightly skeptical of what are effectively no-load voltage measurements on a system like this; you are looking for such low voltages that I think you're probably susceptible to ghost AC readings via capacitive coupling through the breaker)

That's actually one of the nice things about the optocoupler solutions: optos are all about "current transfer ratio", so you need to pull at least a milliamp, and probably more like 5mA, or the thing won't turn on. That's enough to deal with most phantom coupling problems. Transformers are similar (if appropriately loaded on their secondaries), but anything involving a high-impedance circuit will have exactly this problem and need to be designed carefully to avoid it. For what it's worth, the optocoupler solution is something I've seen used all the time in products for line detection.

> pressure switch mounted in the output piping from the pump
Maybe it's just my EE-nature showing, but I wouldn't want to mess with this. It's probably a perfectly fine solution though!

> Even the most jaded electricians I know slow down and treat 220 with respect.
220 is no joke and I second this, be careful with mains. But it's also no 480 -- that's serious business there -- or worse. (And don't listen to me too much; I'm working on a product now where the 90-264 mains coming in is just about the least dangerous thing we have to deal with, so I'm obviously crazy.)
posted by GSV The Structure of Our Preferred Counterfactuals at 3:29 PM on February 23, 2020


Best answer: The breaker trips 2 or 3 times a month in winter, less in summer. How concerned should I be?

Technically a breaker like you are dealing with is only required to handle 1 (one) fault current trip. (IE: breaker trips for the first time because of over current. The breaker is required to reset and hold. The second time it trips the listing (design spec) doesn't require it to be able to reset).

Now obviously breakers handle a lot more abuse than that but I'm not aware of anyone publicly rating them for more than the minimum. And you aren't tripping on excessive current but because of a current leak (IE: more like flipping the handle than faulting off). What will happen is the breaker just won't reset at some point. It might give you a little warning where you have to cycle the handle a few times before it sets or it might not. At any rate the 2P GFCI powering the pump isn't cheap (probably a couple hundred bucks). Knowing it'll wear out at some point changes the cost benift trade off of not replacing the pump/motor.

WAG: It'll most likely last a 100 cycles, I wouldn't bet on it lasting a 1000 cycles.

> pressure switch mounted in the output piping from the pump
Maybe it's just my EE-nature showing, but I wouldn't want to mess with this. It's probably a perfectly fine solution though!

It has the advantage that anyplace that supports salt water pools will have the parts needed (Plastic T and appropriately rated, extra low voltage, corrosion resistant, pressure switch) in stock because the chlorine generators used in salt water systems require this exact protection. Install is cut a short section of pipe out, glue in the T, thread in the pressure switch, done. Failure mode is water leaks out -- no one dies.
posted by Mitheral at 6:24 PM on February 23, 2020 [1 favorite]


This is a known problem with this pump. The pump manufacturer says to use a less sensitive Brand X breaker. We have a Brand Y breaker. It would cost about $200 to switch.

This has red flags all over it even before getting into the electrical details. Their product is triggering a safety device which is designed to cut off at a given level for your safety. Their response is that you should install a less sensitive one. What is leading you to trust their advice on this? What makes you think the GFCI is actually over-sensitive? And what do they think the brand of the breaker has to do with it?

I'm in the UK, where a GFCI is called an RCD, and all the standards are different so you shouldn't pay too much attention to me. But I can tell you in practice that whatever you call the widget, the way they work means that in order to guarantee they trip by the N milliamps they are specified for, they need to be designed and built to trip at well below that level. The maximum current they're required to not trip at is usually only half the rating, and it's normal for them to trip pretty quickly once you get above that.

It sounds like you'll have a 5mA GFCI fitted. So just going by what I've said above, unless the GFCI is actually faulty, you've got a pump that must be regularly exceeding at least ~2.5mA leakage to trip it, even if it's not getting to 5mA.

Does the manufacturer think that you should spend $200 to switch from GFCI brand Y to GFCI brand X, because they think X manufactures their GFCIs to trip at a milliamp or two higher for the same 5mA rating? Or are they actually telling you to switch to a GFCI with a higher trip rating? In the first case their advice is just dumb, in the second it's dangerous.

If you want an electronics project to help solve this problem, a more useful one would be to build yourself a leakage current clamp meter. Then you could monitor how much current this dodgy pump is actually leaking, see what level it trips the GFCI at, and tell the manufacturer where to shove it, with proof.
posted by automatronic at 7:57 PM on February 23, 2020 [1 favorite]


« Older How to best sample the beer during 5 days in...   |   Rosehip, rosehip, hooray! Newer »
This thread is closed to new comments.