I made a simple water level sensor with an Arduino. A digital pin supplies 5V to a probe in a coffee machine boiler. Boiler chassis is connected to AC ground (earth) and the ground to an analog IO pin on Arduino. A pull down resistor is between the analog pin and GND pin on Arduino. If there's water in the boiler, the analog pin detects the voltage, if there's not, it reads zero.

The digital pin is turned on every 1s to slow down corrosion of the probe.

Now, a lot of things are connected to the AC ground - the pump, boiler heater, power supply etc. Should I do anything to protect the Arduino in case anything goes wrong? Is there a better design for this?


simulate this circuit – Schematic created using CircuitLab


simulate this circuit

  • 1
    \$\begingroup\$ To be perfectly clear, by AC ground do you mean earth ground or neutral? \$\endgroup\$ – Hearth Jan 28 at 19:00
  • \$\begingroup\$ And there's a "Custom component" you can use to represent the microcontroller board. \$\endgroup\$ – Transistor Jan 28 at 19:19
  • 1
    \$\begingroup\$ We need to see how the Arduino power supply is connected. Is the power supply ground also earth ground or ac neutral? You are expecting to pull the earth ground line high with respect to the Arduino ground, and that sounds a little sketchy to me. \$\endgroup\$ – Elliot Alderson Jan 28 at 20:26
  • \$\begingroup\$ I think you've identified the critical idea to worry about: corrosion. (Though I might broaden it into a wider scope of migration of charged particles.) Potential differences (volts) regardless of cause (galvanically connected dissimilar metals or ground loop caused, etc.) can be a problem over time. \$\endgroup\$ – jonk Jan 28 at 20:29
  • 1
    \$\begingroup\$ You can dramatically reduce corrosion by using AC. Use a capacitor to couple to your probe, in series with R1, replace R2 with a capacitor. Drive D1 up, measure, drive it down, measure. \$\endgroup\$ – Neil_UK Jan 28 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.