DIY Wireless Water Level Controller

by Electro Retro in Circuits > Microcontrollers

13243 Views, 119 Favorites, 0 Comments

DIY Wireless Water Level Controller

IMG20220829215831.jpg
DIY Wireless Water Level Controller
IMG20220829215836.jpg

In this Instructable, we will learn how to make a wireless water level controller by using an ESP32 and ESP8266 microcontroller. This controller has voltage and current protection to protect the motor. And it uses ESP-NOW protocol to transmit data.


features

  • Wireless
  • High and Low voltage protection
  • Overload and Dry run protection
  • Inbuild buttons for settings
  • Store settings in flash memory
  • 1.8inch TFT display
  • Shows voltage, current, power and power factor.
  • Mode selection switch
  • Top up button.


Why a water level controller?

For me the main purpose of this controller is to fill up the water tank when it is 50%. This is the version 2 of my water level controller, I have earlier made a controller which uses waterproof ultrasonic sensor to measure the water level. I used that controller for about a year. The main problem about that controller is building up water droplets on the surface of ultrasonic transducer which causes false reading. It usually happens in rainy seasons. And my water tank is sitting on a hard to reach area. So it's really painful to climb up and clean the ultrasonic sensor on that rainy weather. What I need is reliable and long lasting solution. I like to try throw in type pressure sensor to measure water level but it's kinda expensive and I can't find a one to buy in my country. And as I mentioned earlier the main thing I need is to fill the tank when the water level reaches 50%. so I am sticking to the standard float switch. In the previous one I used CAT 6 cable to connect ultrasonic sensor to the controller, which is messy and its about 50 meters long. In this controller I used ESP-NOW to transmit data. I am using ESP 32U for the receiver and ESP07S for the transmitter. In the test I got almost 450 meters range (line of sight) by placing the transmitter on the top of the building, Which is really good considering the fact that we're not using any external wireless modules. The other main feature of this controller is protection from high and low voltage, overload and dry run.

The overload and dry run protection work by measuring the current draw of the motor. When the motor is running dry the current draw of the motor will decrease Significantly. I am using Emonlib library to measure voltage and current.

Supplies

WLC_V2 schematic.png
WLC TX.png
button breakout board.png

Components for transmitter

  • ESP 07S microcontroller
  • Antenna for ESP
  • LM2950G-3.3 LDO
  • SMD tactile switches - 2
  • 2200uf electrolytic capacitor
  • 0805 10k resistor - 3
  • 0805 100k
  • 0805 330k
  • 0805 22k
  • PCB screw terminal
  • RMC connector
  • 18650 battery
  • Tp4056 charging module
  • Float switch
  • Float switch - P43(For top up function)
  • Waterproof enclosure
  • Solar panel 5v
  • PCB

Components for receiver

  • ESP32U microcontroller
  • Antenna for ESP
  • AMS1117-3.3
  • AO3400 MOSFET
  • SMD tactile switches - 2
  • 1.8 inch TFT display Driver IC: ST7735
  • 3 position Rocker switch
  • 2 position Rocker switch
  • Push button switch with Led
  • 5v 40a T relay
  • 20a CT sensor (1:2500)
  • ZMPT101B voltage transformer
  • RMC connectors
  • PCB terminal
  • M7 (1N4007) diode
  • 10uf electrolytic capacitor - 3
  • 0805 100nf
  • 1206 4.7uf - 2
  • 82k 1W resistor - 2
  • 0805 10k - 9
  • 0805 1k
  • 0805 470ohms
  • 0805 220ohms
  • Enclosure
  • M3 bolts
  • PCB

Components for Button breakout board

  • Tactile switch - 3
  • 0805 10k resistor
  • 0805 4.7k
  • 0805 20k
  • PCB

Solder All Components on PCB

IMG20220826002315.jpg
IMG20220826002321.jpg
DIY Double Sided PCB

I made my own double sided PCB for this project. I am gonna leave the link to a video on how to make a double sided PCB. I used EasyEDA to design the PCB.

Here is the links to the Design files

Receiver:- https://oshwlab.com/electronics220903/wlc-v2

Transmitter :- https://oshwlab.com/electronics220903/wlc-transmitter

Button_Breakout_Board :-https://oshwlab.com/electronics220903/button_breakout_board

You can open these files in EasyEDA and edit as you wish. The holes for vias on these PCBs are bigger. If you are ordering from PCB manufacturers you need change the hole size.


After making the PCBs I soldered all SMD and Through hole components.

Upload Code to the Boards

Receiver code:- https://drive.google.com/drive/folders/1oN21vcqVJcCuiDm71Qibws8T0X_f_2Nv?usp=drive_link

Transmitter code :- https://drive.google.com/drive/folders/118O5g42zTWnbbP4dSWR-kLHYOfZpG2Tn?usp=sharing

Before uploading the Code install all required library's

TFT_eSPI :- https://github.com/Bodmer/TFT_eSPI

Preferences :- https://www.arduino.cc/reference/en/libraries/preferences/

EmonLib-esp32 :- https://github.com/Savjee/EmonLib-esp32

You need to configure the TFT_eSPI library, I followed this tutorial. Before uploading the Code to the ESP07S(Transmitter), you need enter the MAC address of the receiver. you can get the MAC address by uploading the MAC address example code to the ESP32U(Receiver). I put the transmitter to deep sleep mode for 20 seconds. The Preferences library is used to store the settings in flash memory.

Assembly

Assembly.png
wlc 1.png
wlc2.png

I used a PVC enclosure for the base and 3d printed the top cover. The board is powered by a AC 220v to 5V DC power supply. I connected the phase and neutral wire to the PCB Screw terminal and one motor wire goes to Relay NO pin and the other one is connected to the neutral. I used RTV silicon in the holes of wires on the transmitter to prevent water from getting inside.

Downloads

Working

6.png
7.png
8.png
wlc3.png
wlc5.png

I used two float switches for this project, The red one is the main float switch, whenever the red float switch is in low position the motor will turn ON automatically and when the float switch is in high position the motor will turn OFF automatically. so what's the use of that white float? It is used for top up function, The white float switch is placed just beneath the overflow pipe. Lets say you want to fill up the tank but the Red float is still in the High position, in that scenario you can press the Top up button and the motor will turn OFF automatically when the water touches the white float switch. This controller has 3 modes AUTO,OFF,MANUAL. The manual mode is just like a normal switch which turn ON the motor, In this mode the motor has no protection features. You can only enter the settings menu if you switch to OFF mode. In the settings you can define Vmax, Vmin, Imax, Imin, Delay, Turn ON/OFF voltage and current protection, And RST Delay. After setting the values, press topup button and push button on the center together to save values to flash memory permanently. The info menu shows Voltage, Current, Power, Power factor, And transmitter battery voltage.