How it works
This sensor has strips of metal plated probes that when in the presence of liquids change the resistance that will activate the internal switch. It can be mounted for example on a skirting board, with the the wireless sensor or Raspberry Pi some height above, via the attached wire. When the liquids drain away from the probe the resistance will drop and the switch contacts will open again. Liquids of very poor viscosity may not drain away from the probes and will cause the switch contacts to remain closed.
This switch works in the opposite way to a door switch. The water sensor switch is normally open and closed in the presence of liquids. A door switch, however, is normally closed and open when the door opens.
Option 1 – Wired water sensor
Option 2 – Wireless water sensor
Option 1 – Wired Water Sensor
- The 1k resistor creates the least resistance so pulls Pin 15 high. When the sensor is in presence of water it creates a short circuit to ground and Pin 15 will go into low state.
- Build the circuit as depicted in Figure 1.
- Figure 2 shows the pin layout of the Raspberry Pi header
- I have chosen to use GPIO 22 but you can connect that to any available GPIO digital pin on the Raspberry Pi
- I would recommend making the wires to the water sensor quite long so you can install the sensor on the floor or close to where you want to detect for water, but keep the Raspberry Pi up and away from the water.
- Once built follow the alarm system tutorial to configure and set up your alarm system (if you haven’t done that already).
- The sensor will now operate like a door switch and trigger the alarm when open and reset when closed. That
- doesn’t make much sense for a water sensor. The solution to this problem is to construct rules specially for the water sensor. We currently have a Beta release of our software that allow you to do just that. See the Using Trigger Based Rules section below to configure rules to create alerts, sirens or alarms.
Option 2 – Wireless Water Sensor
- The water sensor triggers an internal switch within the wireless switch circuitry that sends an RF signal to the Raspberry Pi via the base station RF receiver. You can follow these tutorials to set up your Raspberry pi for wireless communications. Follow this tutorial to construct the wireless switch.
- Connect two jumper wires to the either Button A or Button B as per Figure – 3
For more detail: Flood/Water Presence Sensor