DIY Water Level Sensor (without 3D Parts)
by AgriPulse in Outside > Water
55 Views, 0 Favorites, 0 Comments
DIY Water Level Sensor (without 3D Parts)
Have you ever driven 30 minutes to check a water tank, only to find out it was fine? Or worse — arrived to find it bone dry and animals thirsty, plants wilting, or a pump running against nothing?
This sensor fixes that. It clips onto any water tank or basin, measures the water level with ultrasound, and sends the reading to your phone over LTE — no Wi-Fi needed. Whether your water is in the backyard or 10 kilometres down a dirt road, you'll know the level without making the trip.
It works for cattle basins, greenhouse reservoirs, rainwater tanks, irrigation systems — anywhere water matters and you can't always be there to check.
Built to be simple and adaptable. We deliberately tried to only use materials you might already have. No complex fabrication or specialty tools. If you can follow a recipe and use a drill, you can build this.
Developed at Concordia University's Innovation Lab as part of the Regenerative Agriculture Challenge.
Let's build it!
(Have a 3D printer and want to put it to use? Check out our alternative Instructables that 3D prints the housing: https://www.instructables.com/DIY-Water-Level-Sensor-Monitor-Any-Tank-From-Your-/)
Supplies
Electronics:
- JSN-SR04T Ultrasonic Sensor: the "ears" of the device, sends a sound pulse and measures the distance to the water surface (~$15, Amazon)
- ESP32-S3 SIM7670G 4G Development Board: the "brain," reads the sensor and sends data to your phone over cell service (~$38, Amazon)
- Soder & Flux
- ~1ft (5 pieces) of coated copper wire
- IoT SIM Card: a cell data plan for the sensor, lets it transmit over LTE. Typically ~$2–5/month after initial prepaid bundle (~$50 prepaid)
- 12V-5V USB Step-Down Converter: converts battery power to the voltage the board needs (~$14, Amazon)
- Battery
Materials:
- 8" of a 2-inch PVC pipe
- 2-inch PVC pipe cap
- 2 Zipties (long enough to reach around the PVC and side of basin)
- Waterproof Outdoor Silicon Caulk (neutral cure)
- 2 thick rubber bands
- Weatherproof junction box
- OPTIONAL: Plastic Shim (if side of basin is not straight)
Tools:
- Drill & ~15mm bit
- Sodering Iron
- Wire cutter & strippers
Connect Mircocontroller + Ultrasonic Sensor + LTE Chip
Follow the schematic above to connect your components:
- Insert the SIM Card
- Place your IoT Sim Card into the SIM slot on the ESP32 board
- Make sure it clicks into place and is oriented correctly
- Wire the Ultrasonic Sensor
- Connect the JSN-SR04T Ultrasonic Sensor to the ESP32-S3 SIM7670G board as follows:
- VCC → 5V (or VIN)
- GND → GND
- Trig → GPIO pin
- Echo → GPIO
- Double-Check your Connections
- Ensure all wires are firmly connected
- Verify each pin matches the schematic exactly
Connect Microcontroller to the Computer Using Waveshare Driver and Create a Thingspeak Account
- Connect the Board
- Connect the ESP32-S3 board to your computer using a USB-C cable
- Open the Arduino IDE on your computer
- Install the Required Board Package
- In the Arduino IDE, go to Tools → Board → Boards Manager
- Search for and install the Waveshare ESP32-S3 (or relevant ESP32-S30) board package
- Create a ThingSpeak Account
- Go to the ThingSpeak website and create a free account
- You'll use this to store and visualize sensor data
Upload Code to Microcontroller
- Install Required libraries
- Open the Arduino IDE and install the following libraries:
- ESP32
- TinyGSM
- Select the Correct Board and Port
- Go to Tools → Board and select ESP32-S3 Dev Module
- Go to Tools → Port and choose the port that corresponds to your device
- Configure the Code
- Before uploading, update the following in your code
- Insert your ThingSpeak API key
- Enter your SIM card APN (provided by your carrier)
- Upload the Code
- Click the Upload button in the Arduino IDE
- Wait for the code to compile and upload to your ESP325
- Verify Uplaod
- Open the Serial Monitor to confirm the device is connecting and sending data
Assemble the Water Level Sensor
It's time to put together your device!
- Drill a hole in the middle of the PVC cap
- Feed the ultrasound sensor through the drilled hole, USB port first
- Using the silicone, secure the ultrasound sensor to the inside of the PVC cap. Then, create a conical seal on the outside to both stabilize the wire and ensure waterproofing.
- Once dry, place the PVC cap onto the pipe
Secure the Water Level Sensor to the Basin
Now that you have your device we need to mount it!
- First, we need to drill holes into the basin to secure the sensor. Drill two sets of holes about 2 inches apart, 2 and 2.5 inches down from the top of the basin (the measurements aren’t too important as long as the pipe feels secure and the ultrasound sensor is 23cm above the highest possible water level)
- Place the rubber bands around the bottom of the PVC pipe where it will be secured. The rubber bands provide grip for the zipties to hold the sensor in place.
- Feed the zipties through the drilled holes and around the rubber bands, and secure the water-level sensor in place
Tip: If the side of your basin is not straight, place a plastic shim between the basin and pipe to ensure the sensor is at a 90-degree angle from the water
Connect to Power
Your sensor is mounted on the basin; now it needs electricity to start working!
The step-down converter in your supplies list does one simple job: it takes 12V power from a battery and converts it to the 5V that your ESP32 board needs
What you'll need:
- The 12V-5V USB step-down converter from your supplies list
- A 12V battery
- Your mounted sensor device from (Step 6)
Wiring the converter:
- Look at the converter. It has two bare wires on one end (red and black) and a USB plug on the other end.
- Connect the red wire to the positive (+) terminal of your 12V power source.
- Connect the black wire to the negative (−) terminal of your 12V power source.
- Plug the USB end into the USB port on the ESP32 board.
Storage:
- The ESP32 board, converter, and battery all need to stay dry. Put them inside a weatherproof junction box.
Test Your Sensor
Everything is connected and powered up. Before you walk away and trust it, let's make sure it's actually working.
Check for signs of life:
- Look at the ESP32 board. You should see a small LED light up, so that means it's getting power.
- Give it a minute or two. The LTE module needs about 30–60 seconds to find and connect to the cell network, just like a phone does when you turn it on.
Check ThingSpeak:
- Open ThingSpeak on your phone or computer. Go to your channel (the one you set up in step 3)
- Within 2–5 minutes, you should see a number appear on the chart. This number is the distance in centimeters from the sensor to the water surface.