i want to start on a project in which i have to make arduino to work with 220v AC. My plan is to know when an appliance is On and notify it wirelessly using a ESP-8266 for WiFi. The appliance is a submerged water pump, connected to a water autoclave (i'm not sure this is the correct translation, but basically is an intermediate reservoir with an internal air lung that automatically refills the autoclave when is empty) so that the pump does turn on each time we open the tap.
Back then we used a 220v light bulb in serie to the pump, now i want to substitute or put side to side arduino with a light so that i can know when the pump is on both in the old way and remotely.
I searched and asked a bit about 220v AC detection, and the cheapest and "safe" way to do seems to be the ACS712 hall-effect current sensor or use a 5v phone charger. But the problem here is: which is the most safe?
Keeping in mind that, in a normal day, the pump will be on (mostly for not more than 30s) and off most of the time except during summer when using the garden hose for irrigation (that makes the pump to be always on while the tap is full open) and also that this pump is used every day, as it pumps the only house water we have, can the wall charger or the ACS712 (maybe the 20Amp version) support such a work load without risking a shortcircuit/over heating and other risk-to-damage-the-main problems?
I point that i've never worked with arduino and the main yet, my only experience with main has been some lamp holder and some extension cords hooked to the wall male plug i've made my self. I know too there exists sonoff and shellys, but i'd like to work a bit with DIY IoT, because it gives you the maximum freedom.
Thanks for reading all of this, and for your help in advance :3
So what would be a good way to learn how to work with it? What could cause a problem?
If the problem is wiring everything up or make safer the project i can make a more experienced person to wire to the 220V instead of me.
But please explain, and don't just say "is dangerous, don't do it"
You would have a light bulb in parallel with the pump, using a double adapter.
You are confusing two different approaches. The current sensor could be used to detect that the pump is actually drawing current. The "phone charger" would again connect in parallel with the pump and/ or light bulb and indicate that there is power available for the pump whether or not it has failed in the meantime.
The "phone charger" is certainly a safe way to do it as you yourself never touch the mains wiring. I believe the current sensor must be actually wired into the mains wiring, so that may not be so safe. You can alternatively get a "current transformer" which need not actually contact a mains wire, but must be clamped around one mains wire - live or neutral but not both.
I'm not sure the ACS712 is mains rated or approved. For AC mains a CT is often used to sense current and plenty of mains-rated CTs are available.
The problem with mains isn't the mains voltage as such, but the pulses and spikes that sometimes appear across it in the kV region (inductive load switching, nearby lightning). The insulation requirements for safe mains equipment is much higher than the mains voltage.
With the phone charger i won't directly touch the mains but the charger will do, and i'll touch the output and hook it up to arduino. But again, can a charger be turned on and off several times in a day, for all the year without the risk of breaking or burn and such?
The safest and surest way to detect if the pump is on is to detect the current flow in one of the pump power leads, using a current transformer (CT). No electrical connection is required.
I think the OP is simplifying his water system beyond what it really is. Seems similar to my domestic well. He neglects the water pressure switch that actually controls the pump through a motor controller which may be either a relay or a solid state switch. All is run at 220 volts.
His system must be a rather rare one to have a wired outlet in line with the pump motor.
He would do well to call his well/pump service company and have them come and suggest where to connect the controller and actually make the connection for him.
Now that is an interesting question and one I have seriously considered. It probably will survive just fine but I have a related concern and as far as possible avoid having any SMPS such as a phone charger switched on without its normal load (phone) connected.
This is because these devices with "universal" input (100 to 220 V and of course, 50 or 60 Hz which never matters anyway with a SMPS) are here being operated at maximum voltage (up to 250 V sometimes).
Bad/dangerous tutorial.
I wouldn't dream of connecting that board to mains power, especially not in a wet area.
Look at the spacing (creep distance) between mains and Arduino ground (0.5mm?).
Only a clip-on current sensor would be safe (no need to cut wires).
Leo..
A while ago I pulled the cover on my well pump controller box. There is easy access to the two hot 220 wires to add a split current transformer. You would have to add an access hole for the wires to exit the box.
With a current transformer, you can do what ever you like to get a DC voltage that your Arduino can use. The voltage will only be there while current is flowing.
Another possibility is to just wind a few turns of insulated wire around one of the hot leads and make your own current transformer. that would be my choice and the easiest to do.
My project is related to a water pump, but it is not submerged into water nor is near it xD. I'd install all the components near the electrical cabinet at which is connected the pump
You know what, this is the first time i really understood what it meant to wrap wire around the hot one in the 3 wires. I always imagined that i'd had to physically connect the wire to the copper, and i was like (are you serious). This is the 3rd time somebody adviced me to do so.
I also seen something on youtube but it was a circuit that used also transistor and capacitors, basically an antenna.
Something like this: #114 No contact mains detector for Arduino & Pi π₯§(just 10 components) - YouTube
How should i make such a cheap/safe current transformer? How many turns, thickness of the cable? How can i ensure not to damage arduino with this?
I'd have somebody to connect it to me, but not somebody that knows about electronics, but rather about electrotechnics (i could just let him know where to connect the hot and neutral, he would just treat my "remote pump monitor" like a blackbox). However i can lock cable with screwdriver too, this isn't hard for me.
Doing a serial/parallel connection to the pump isn't hard for me. The difficult (hence the point) of my initial question was a safe way (and maybe also a cheap one) to connect arduino to the mains voltage to detect it.
To be clear, i would MAYBE use a wall plug switching power supply that can output multiple voltages (from 3v up to 12v). I bought it years ago for a chinese audio amp i used.