Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

Science project idea

Overhead tank level on your phone with automatic pump control (ESP8266)

An ultrasonic sensor on the tank lid measures the distance to the water surface. The ESP8266 converts that to a percentage, shows it on a phone page, and switches a 5 V pump through a relay to refill when the level is low and stop when full.

What it shows

An ultrasonic sensor on the tank lid measures the distance to the water surface. The ESP8266 converts that to a percentage, shows it on a phone page, and switches a 5 V pump through a relay to refill when the level is low and stop when full.

The science

The HC-SR04 sends a 40 kHz burst and raises its echo pin until the reflection returns; distance is the echo time times the speed of sound divided by two. Mounted on the lid, a short distance means a full tank. The sketch maps the distance between the empty and full marks to 0 to 100 percent. Two thresholds, start at 20 percent and stop at 95 percent, form a hysteresis band so the pump does not restart the moment a little water is used. The ESP8266 web server shows the level and lets the user force the pump on or off.

Materials

Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.

  • A NodeMCU ESP8266 and USB cable
  • An HC-SR04 ultrasonic sensor
  • A 5 V relay module
  • A 5 V submersible mini pump with tube
  • Two plastic containers for the sump and the tank
  • A 1k and 2k resistor divider for the echo pin
  • Jumper wires

Safety

For this project: Water and electronics stay in separate containers. Only the 5 V pump goes through the relay. An adult must check wiring before the pump supply is connected.

Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.

All the safety rules

Step by step

9 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.

  1. Wire the HC-SR04: VCC to Vin (5 V), GND to GND, TRIG to D5, ECHO through the 1k:2k divider to D6 (the ESP8266 pins are 3.3 V).

  2. Fix the sensor in the lid of the tank container pointing straight down at the water.

  3. Wire the relay IN to D1 and the pump through COM and NO to a separate 5 V supply such as a power bank, grounds joined.

  4. Measure the distance with the tank empty and full and write both numbers into the sketch.

  5. Convert each reading to a percentage and average five readings to steady the value.

  6. Add the pump logic: switch the relay on below 20 percent and off above 95 percent.

  7. Serve a web page showing the percentage as a bar and two buttons for manual pump on and off.

  8. Fill the sump, start the system, and watch the page while the tank fills and the pump stops by itself.

  9. Scoop water out of the tank and confirm the pump restarts only once the level falls below 20 percent.

What you should see

The phone shows the tank percentage updating every two seconds. The pump starts at the low mark and stops at the full mark without overflowing.

Viva questions

A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.

1Why mount the sensor on the lid and not in the water?

Ultrasound measures the air gap to the surface; the sensor is not waterproof and must stay dry.

2What error does temperature cause?

The speed of sound changes about 0.6 m/s per degree, a small error for a tank but worth noting.

3Why two thresholds for the pump?

To avoid rapid on-off cycling, which wears out the pump and relay.

4Why divide the echo signal?

The HC-SR04 echo is a 5 V signal and the ESP8266 pins are only rated for 3.3 V.

Free ebook: Viva Questions for Science Projects

Take it further

Add a float switch in the sump so the pump never runs dry, and log daily water use.

Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.

Free ebooks for this project

WhatsApp us