suppose a conductive/resistive moisture sensor out of copper tape and paper to check for leaks and lets say for whatever reason there's is a leak. What happens if the water touching the moisture sensor becomes energized by a nearby 220v AC electrical wire.
I'm going to guess this would instantly destroy the ADC and possibly any other circuits connected to it.
The moisture has 2 copper layers with paper between them. one copper layer is connected to 5vref and the other copper plate is connected to ADC0. When the paper is wet it creates a conductive path between the two layer of copper.
The pcf8591 has a max ADC input voltage of around 7V
My question is, how can you protect a circuit like this from allowing high voltages from destroying the ADC but at the same time still get a signal from the sensor so i know if the moisture sensor is wet or not?
This is hypothetically speaking, there is no real risk of electrocution or shock hazards. I'm just curious of ways to protect a circuit in that situation.
You generally want a higher-value current-limiting resistor than what they are using but it should be low relative the input impedance because you're making a voltage divider. (I don't know the input impedance of the pcf8591.) A higher resistance is also more likely to pick-up noise.
For 220V, you'd need to calculate the power dissipated by the resistor (and the Zener if you choose the Zener variation) and the current through the diode (any type).
It might also be a good idea to add a fuse if you're worried about lethal voltages. ...A fuse doesn't directly-protect against excess voltage. It only blows when you get "excess" current though the protection circuit, and then it blows cutting-off the voltage (and current).