Main components:

  • an ultrasonic HCSR04 measures the water level
  • a simple on / off floating sensor alerts the maximum water level
  • a water sensor, i.e. two wires plunged into the water / sewage
  • a relay switch turn on / off a valve, water pump, buzzer or similar
  • an ESP32 collects data and handles the SMS communication
  • a cheap GSM 2G module, equipped with a SIM, let to send  / receive SMS
  • two LIPO batteries supply the controller in case of power shortage

Schematics:

Please note the bare ESP32 breakout board. In this case it must be programmed by an external FTDI 232 - USB programmer (see the  connector). If you don't like this, you can use an ESP32 conventional board with USB and embedded programmer. 

SMS Messaging:

1) Solicited:

Sending any SMS to the SIM phone number. It will answer:

  • The water level is 110 cm
  • The tank is not full
  • The output is active 
  • The Power is ON

2) Command

Sending an SMS with the text:

On

it will switch to Active the output relay

Off

it will switch to Inactive the output relay


3) Unsolicited:

When the floating switch change from closed to open or viceversa or when the water level goes above / below a certain threshold, send an SMS to the set phone number: 

  • The water level is 180 cm
  • ALARM: the tank is full
  • The output is Active 
  • The Power is ON

Configuration:

ESP32 acts as a WIFI hotspot. If you connect to it locally with your smartphone you can configure the device.

Phone

Set the phone number to send messages to, in unsolicited mode. Please note that in solicited mode, it always answers the caller. 

Input 1

Set the two messages to send when the floating switch Open or Close or water touches the water sensor

Send On Changed: Enable / Disable the unsolicited mode for the Input

Level 1 

Set the two messages to send when the level goes above / below the threshold

Set the threshold

Send On Changed: Enable / Disable the unsolicited mode for the level

Power

Set the two messages to send when the power is ON or OFF

Send On Changed: Enable / Disable the unsolicited mode for the Power

Output 1

Check if it is HIGH or LOW