I need to detect when a pump is running. The pump is controlled by a float switch that allows 120V AC to pass when the pump should be turned on. I was thinking of putting in a normal wall outlet wired to the switched side of the float circuit. I'd then plug a 5V wall wart into this outlet and feed the wall wart's output into an arduino digital pin. The wall wart would only be powered when the float switch calls for the pump to run. This seems really simple but I've learned that nothing is simple when it comes to electronics. Is there anything I should be careful off? Do I need a load on the wall wart to protect the arduino? If so, how big and an I accomplish it via a resistor to ground?
I would suggest a series resistor and 3.2 or 5v zener
Wallwarts are not always regulated and you need to ensure that you do not apply more than the arduino supply voltage to an inpuut pin.
Oh and a pull down resistor too, wallwart may have an output capacitor which could take time to discharge.
Your method doesn't actually detect that the pump is running though: just that it's likely to have power to it.
I would use a 5V relay on the wallwart to switch the input to the pin, keeping the two voltages seperate.
True but it could be derived by having a timeout on the floatswitch,i would expect it to open when the bucket is full.
So a timeout to set alarm / switch off.
Henry_Best:
I would use a 5V relay on the wallwart to switch the input to the pin, keeping the two voltages seperate.
^^^ this is a much better idea. It adds an extra layer of insulation between the AC mains, the wall wart and the Arduino.
Plus, all the relay does is pull down a digital input that's set to "pinmode INPUT_PULLUP". There's no chance of sending too high of a voltage to the pin and latching it up and therefore no need for a resistor and diodes to protect the input.
And, the relay coil acts as a load to discharge the wall wart when it's powered off so that the Arduino "knows" when the power went off.
Excellent idea!
Could someone recommend a specific relay to use? I looked at relays originally and there are 100's of choices. One additional
piece of information: the on/off measurement doesn't have to be terribly precise, i.e., if the switch detection takes a few seconds, that's ok. The pump fills a 6000 gallon water tank and is switched on when it gets about 1500 gallons low. It then runs long enough to refill the tank. In the winter, it only runs rarely. In the summer, it runs every other day due to irrigation.
You just need a relY tht will operate at 5 volts.
There is no significant current consumption,
Find a cheap one.
Why isn't the use of a transformer considered isolation of the 120v from 5v? The physical circuits are completely separate and the only crossover is the electric field from the 120v that generates the 5v.
I went to the digikey site and looked for relays that were specified to take line voltage as input and 5V as output. There are lots of choices that switch the other way but few that control 5V from 120V. The ones they have are expensive and will require a circuit board wired into the line voltage This seems more dangerous that just using a transformer. Losing an arduino due to a problem is trivial vs causing a problem in the main electrical system.
jimbarstow:
Why isn't the use of a transformer considered isolation of the 120v from 5v? The physical circuits are completely separate and the only crossover is the electric
You mean magnetic
field from the 120v that generates the 5v.
Most modern wallwarts are transformerless and don't have that level of isolation.
I went to the digikey site and looked for relays that were specified to take line voltage as input and 5V as output. There are lots of choices that switch the other way but few that control 5V from 120V.
Nope. Use a 5V relay operated by the wallwart's output...A 5V coil with a single set of contacts.
Krupski:
Henry_Best:
I would use a 5V relay on the wallwart to switch the input to the pin, keeping the two voltages seperate.^^^ this is a much better idea. It adds an extra layer of insulation between the AC mains, the wall wart and the Arduino.
Plus, all the relay does is pull down a digital input that's set to "pinmode INPUT_PULLUP". There's no chance of sending too high of a voltage to the pin and latching it up and therefore no need for a resistor and diodes to protect the input.
And, the relay coil acts as a load to discharge the wall wart when it's powered off so that the Arduino "knows" when the power went off.
Excellent idea!
Thanks. There may be a problem if timing is critical. The relay pull-in may be slightly delayed (~500millis) until the wallwart output is up to full voltage. There could be a longer delay (up to ~3 seconds) in the release time, until the caps in the wallwart discharge sufficiently. He does say that timing is not critical, though.
Henry_Best:
Most modern wallwarts are transformerless and don't have that level of isolation.
Huh!
All Wall-warts have a transformer, either an old-fashion iron-core or a Ferrite-based one. It's still a magnetic transformer.
A wall-wart with a capacitive dropper would be considered extremely dangerous and would be outlawed.
// Per.
jimbarstow:
Why isn't the use of a transformer considered isolation of the 120v from 5v? The physical circuits are completely separate and the only crossover is the electric field from the 120v that generates the 5v.
It is.
The use of a relay does increase safety ithink , not needed imo.
My origional post was only a suggestion.
I would probably sense the motor with an opto isolator
but your idea is i think a simple solution to your origional question.
The relay will probably cost more than the wall wart as additional cost.
Sounds like an expensive and stilted solution to a problem. Personally I'd use a neon indicator across the pump and use a phototranny to detect if it were on or not. Nice optical isolation to keep the dangerous stuff away from the signalling.....
@Zapro, Have you ever heard about switching power supplies? Almost every 5V Wall-wart now uses switching mode power suply, and the main "only" goes through an inductor and a diode. Still it is safe...
Patouf:
@Zapro, Have you ever heard about switching power supplies? Almost every 5V Wall-wart now uses switching mode power suply, and the main "only" goes through an inductor and a diode. Still it is safe...
Seriously, what have you been smoking ?!
The mains current goes into a rectifier, then a cap, a switching transistor chops the high voltage into pulses at 50-100 KHz and feeds them into a ferrite transformer whose output is again rectified and filtered before going to the low voltage output. Some Transformers have a feedback-winding, but have bad load-regulation. Most have an optocoupler from low voltage side to the SMPS controller to give feedback.
Still, there is a transformer, not just an inductor and a diode.
Get your facts right, thank you.
// Per.
Neon would only detect power not if the motor is runningor not, but im being pedantic.
Op posed what i think is a one off solution to a monitoring requirment.
His solution imo was a good one , only requiring a few p of components to protect the arduino.
FX
Dons asbestos underpants.