Posts: 124
Joined: Wed Oct 10, 2012 10:16 am

Re: Detecting 250VAC voltage/current of deep well pump motor

Sun Nov 01, 2015 5:00 pm

Thanks again for your help - just one more question please.

The R1/R2 resistor I choose ended up being a minimum 5000 item order, so my only other option is a 500V resistor. Would this be too low?

http://uk.farnell.com/multicomp/mcpmr02 ... dp/1973211

Power Rating: 2W
Resistance: 270kohm
Resistance Tolerance: ± 5%
Resistor Case Style: Axial Leaded
Resistor Element Material: Metal Film
Temperature Coefficient: ± 400ppm/°C
Voltage Rating: 500V


Posts: 87
Joined: Fri May 17, 2013 2:45 pm
Location: Westcliffe, Colorado, USA

Re: Detecting 250VAC voltage/current of deep well pump motor

Sun Nov 01, 2015 9:00 pm

That resistor is too big - it is a 2W resistor that has a body that is too large. Digikey will ship to the UK...for 12 GBP, which is like robbery. Can you try to contact the local Stackpole sales office ([email protected]) maybe they can give you some free samples?

I tried to find some appropriate high voltage resistors on the Farnell website, but either the quantities are huge or the physical sizes won't fit. Are there other electronics hobbyist sites in the UK you can try?

I looked at the voltage ratings of the 500V rated resistors you selected and the surge ratings seemed a bit low to me - just for safety's sake.


Posts: 124
Joined: Wed Oct 10, 2012 10:16 am

Re: Detecting 250VAC voltage/current of deep well pump motor

Mon Nov 02, 2015 8:10 pm

Hi Bud,

Thanks again for your help. I've tried quite a few different UK online shops today and it seems they either don't stock the right spec'd resistor, or if they do delivery charge is £12.

I think I'll order the resistor from Digikey but buy 30 of them to make the most of the delivery charge, then if any other UK guys reading this thread want some of those resistors, I can post locally.

I've emailed VTM sales as well so will wait to see what they say first before I order.

As it stands, my shopping list from Farnell is as follows (as a reference for others who are interested in this project and are UK based).

Q1 - http://uk.farnell.com/nxp/bc856b-215/tr ... dp/1081243
C1 - http://uk.farnell.com/avx/tajr106k006rn ... dp/1135071
D1, D2 - http://uk.farnell.com/multicomp/1n4148/ ... dp/9565124
C2 - http://uk.farnell.com/avx/08051c104k4t2 ... dp/1833888
Opto Isolator - http://uk.farnell.com/vishay-semiconduc ... dp/1612456
R1/R2 - http://www.digikey.co.uk/scripts/DkSear ... 2599053643

Posts: 3
Joined: Fri May 17, 2019 5:54 pm

Re: Detecting 250VAC voltage/current of deep well pump motor

Fri May 17, 2019 7:33 pm

post to rpi forum

Hi, Bud,

Thank you for this post!

I have a simpler use case: I just need to know when my deep well pump cycles on and off.

While my well pump runs on 220VAC, I'd prefer to source this with just one of the hot leads and the neutral, so I'm only bringing 110VAC to your invention.

To the point: Is there a simple way to modify your design to accommodate 110VAC input vs 220VAC?

Obviously, I'm new to this, and I'm sure the answer is out there on the inter-webs, but I thought I check with you first, since it's your design, and you have so thoroughly researched your options for the design.

Thank you again!


Posts: 87
Joined: Fri May 17, 2013 2:45 pm
Location: Westcliffe, Colorado, USA

Re: Detecting 250VAC voltage/current of deep well pump motor

Sat May 18, 2019 4:04 am

I believe the simplest approach would be to change the two 270kΩ resistors to 120kΩ. I think the circuit would not care if one of the leads was neutral as long as the differential voltage was 110VAC @60Hz. Probably still a good idea to use the Stackpole resistors for safety reasons. — Bud.

User avatar
Posts: 120
Joined: Tue Feb 28, 2017 1:13 pm
Location: Sydney, Australia

Re: Detecting 250VAC voltage/current of deep well pump motor

Sat May 18, 2019 1:02 pm

BudBennett wrote:
Tue Aug 27, 2013 8:32 pm
My Project Rationale:

I have a home automation project that I am just beginning. A 600 foot deep well provides water to my house. The well only produces 8 gallons/hour. Therefore I also have a 1700 gallon cistern to store the water before it is pumped into the house for use. There is a float valve that turns on the deep well pump when the cistern level drops to a certain level below full and turns off the deep well pump when it is full again. The pump is a 1hp 250VAC induction motor.

My project is to monitor the status of the cistern to make sure that it doesn't run dry. I thought that the easiest way to do this would be to monitor how often, and for how long, the deep well pump is running. I assumed (assume = ass of u and me, more on that later) that simply detecting a voltage applied to the motor would be a good indicator of this, so I proceeded to design a circuit for detecting a 250VAC signal and presenting to the Raspberry Pi as a GPIO logic level.

Design Requirements:

1. Safety: 2500-3500V galvanic isolation between motor circuit and RPi circuit.
2. Cool Operation: low power dissipation…
3. Simple, two-wire interface: GND and GPIO signal to the RPi. No power supply signal required.
4. Small size - it has to fit inside the well "pump-saver" box that is mounted on the garage wall, and it won't be the only circuit in the box.

Some Background:

There is another forum thread that covers a lot of this: http://www.raspberrypi.org/phpBB3/viewt ... 01#p237701. Here is the circuit that I came up with after reading this posting and the associated links (and digging a bit deeper in other areas):


I think that this is IMHO probably the simplest and most straightforward approach. Design requirements #1-3 are met quite easily. Power dissipation is below 10mW.

Note that there are a few extra components and some values have changed. R1 and R2 are optional - they are only there if you don't want to be zapped by any residual charge on C1 if you happen to remove the circuit and put any of your body parts across the input terminals. Note that you need two of them if you use carbon or metal film resistors that are rated for working voltage between 125V and 200V. Most of us don't even know what the maximum working voltage of the small (i.e 1/4W) resistors that we have around the shop.

D1 can be removed if you use an opto-isolator that includes a reverse clamping diode, such as the H11AA1. The requirements for D1 are so relaxed in terms of reverse voltage and forward current that almost anything will work. The 1N4148 is cheap and ubiquitous.

R3 is there to protect the opto-isolator LED against transients, such as surges or spikes, that can happen on 250VAC wiring. Alternatively it can act as a fuse, but I think that a real fuse should be employed (more on that later).

C1 controls the amount of current flowing in the opto-LED. I've sized C1 to produce 5mA peak:

XC1 = reactance of C1 = 1/(2*Pi*F*C1) , where F = 60Hz and Pi = 3.1415926…

Ipeak = Vpeak/XC1 = sqrt(2)*250V*2*Pi*60*0.039uF = 5.2mA peak

Note that the sqrt(2)*VAC converts from RMS (root-mean-squared) voltage to peak voltage (for a sinusoid waveform).

Why 5mA instead of 10mA? There is an aging factor in opto-isolator LEDs. The LED output decreases over time, but the aging process is directly proportional to the LED current, so the aging process is half as fast with 5mA as 10mA. 5mA is plenty of LED current, even with a 20% CTR (Current Transfer Ratio) and considering temperature and aging, given that the load is only 3.3V/50k = 66uA. Also, according to data sheets that I've seen on common opto-isolators the 5mA CTR peaks about 20-30% above the 10mA CTR.

Why 5mA instead of 1mA? The opto CTR tends to fall off rapidly when you get below about 2mA. You can go there, but you will have to use a 4N35 or 4N36 or 4N37 or similar opto-isolator with a higher CTR (near 100% min).

C1 must be a safety rated (type X1 or X2) capacitor if it is going to be connected to the mains power. If you go to Digikey and plug in X2 and 0.039uF and 250V you only get one capacitor: http://www.digikey.com/product-search/e ... geSize=500 Note the size of this component: 0.689" L x 0.217" W x 0.512" H (17.50mm x 5.50mm x 13.00mm) This thing is huge! The fuse will not be small either, so this circuit won't work for me. But it could work for applications with more relaxed space requirements.

R4 prevents the opto NPN from turning on from Collector-base leakage current at high temperature. It degrades the CTR slightly. If you aren't worried about high temperature operation (even in a fault mode) then you can probably delete it.

The opto-isolator is acting as a switch to GND that closes every 1/60 seconds. C2 filters out the 60 Hz information and turns the output voltage into a steady state voltage that is either high when there's no AC voltage, or low when there is. The value of C2 is found by asking how much ripple you can tolerate on the output voltage. I thought 100mV would be acceptable - the VCEsat of the opto NPN when added to the ripple voltage must be less than the logic low level (VIL) of the GPIO input. When AC input voltage is present the opto NPN transistor will drive the output voltage to near GND every cycle and then turn off and let the GPIO pull-up resistor (50k min.) try to pull the capacitor toward 3.3V. You can treat the pull-up resistor as a constant current source since the voltage variation across it is small:

dV/dt = I/C gives:

C2 = 3.3V/50k * 1/(60Hz*100mV) = 11uF => 10uF is close enough

When the AC voltage turns off the rise time of the output voltage will be 65k * 10uF = 0.65 second. That should not be a problem for my application.

Effect of Component Failures:

These circuit should be evaluated for failure effects to see what bad things happen when components fail. I did some investigating of how and why electronic components fail. Here's some of what I found:



[1] Failure mode data was taken from a combination of resistor manufacturer's recommendations, MIL-HDBK-978, "NASA Parts Application Handbook," 1991; MIL-HDBK-338, "Electronic Reliability Design Handbook," 1994; "Reliability Toolkit: Commercial Practices Edition," Reliability Analysis Center (RAC), 1998; and "Failure Mode, Effects, and Criticality Analysis (FMECA)," RAC, 1993.

[2]Failure mode data was taken from a combination of MIL-HDBK-978, “NASA Parts Application Handbook”, 1991; MIL-HDBK-338, “Electronic Reliability Design Handbook”, 1994; “Reliability Toolkit: Commercial Practices Edition”, Reliability Analysis Center (RAC), 1998; and “Failure Mode, Effects, and Criticality Analysis (FMECA)”, RAC, 1993.

Capacitors normally fail with a short circuit. Film resistors most likely fail with an open circuit, but can fail just as often with a parameter change, and only fail shorted 5% of the time.

If R3, D1, F1, or the opto LED shorts or opens there is no harm done - the circuit continues operating or fails without further consequences. If C1 short circuits in the above circuit then R3 and the opto-LED get hit with all of the mains voltage. This causes the dissipation in R3 to increase from 2.7mW to 31W! Yes, it would be nice if it blew up and put itself out of it's misery. But can you count on it? And what happens to the shrapnel? The fuse is nicely contained in a glass tube.

Component Ratings:

Only use components rated to withstand the electrical environment to which they are subjected. Design for Reliability guidelines suggest that resistors be derated to 60% of maximum operating limits for voltage and power dissipation. This was an eye-opener for me. This is serious stuff and a failure could cause a fire or other serious issue that places the occupants of the house in danger. It gives credence to the people who say "Don't play with the mains."

Still Searching:

While this circuit is very attractive, and will satisfy the vast majority of applications out there, I'm working on a couple of other approaches that are probably not as general purpose, but will satisfy my objectives. I will post more info on that soon.
I must be missing something here. Sensing the presence of 250VAC at the pump motor indicates nothing. The pump could be jammed, stalled, open circuit or blocked, and this sensor would not detect any of these failure conditions. At very minimum you should be sensing that the motor is in fact drawing current (ie operating) . Even then this would not detect a blocked pipe. Ideally you should be sensing water flow in the pump discharge pipe, examining actual flow rates wil tell you a lot about the bore, pump and pump efficiency conditions. Also level sensing of the cistern would be advisable.
..the only thing worse than a stupid question is a question not asked.

Posts: 3
Joined: Fri May 17, 2019 5:54 pm

Re: Detecting 250VAC voltage/current of deep well pump motor

Sat May 18, 2019 7:42 pm


Thank you for your quick reply!

Time to order parts!


Posts: 3
Joined: Fri May 17, 2019 5:54 pm

Re: Detecting 250VAC voltage/current of deep well pump motor

Sat May 18, 2019 7:46 pm


For my situation, just knowing that juice is flowing from the control box to my deep well pump is good enough. If the pump's not working, I'll know very quickly when I open a faucet. This happened to me a bit over a year ago.

For my project, I assume that my pump is good. I just need to know when it begins to cycle too quickly, usually due to the air-over-water (no diaphragms) pressure tanks becoming waterlogged over time. At some point, I'll just upgrade my pressure tanks to the diaphragm style, but this project will help me know when to purge and re-pressurize them.

Bud's design fits my use case really well.


Return to “Automation, sensing and robotics”