DIY Wireless Water Level Sensor with Circuit Diagram and Step-by-Step Guide

For a reliable remote tank management system, begin with an ESP8266 microcontroller paired with an HC-SR04 ultrasonic sensor. Position the sensor at the tank’s apex–ensure a minimum 5 cm clearance from the maximum fill line to avoid signal interference. Use a 12V relay module to drive a submersible pump (or solenoid valve for gravity-fed systems), triggering it when readings fall below 20% capacity. Power the setup with a 5V buck converter to stabilize voltage fluctuations, critical for accurate distance measurements.
Opt for a compact PCB layout to minimize signal noise. Route ground traces directly to the microcontroller’s GND pin, avoiding shared paths with high-current components. Incorporate a 10µF capacitor across the power rails to filter transient spikes. For wireless data transmission, configure the ESP8266 in deep sleep mode between readings–set intervals to 15-minute checks for battery efficiency. Use MQTT protocol (e.g., Mosquitto broker) to relay readings to a dashboard like Node-RED or InfluxDB.
Calibrate the ultrasonic sensor in situ. Measure the tank’s empty state and record the echo delay, then derive the height-to-distance ratio (typically 0.17 mm per microsecond in air at 20°C). Adjust for temperature variances using a DS18B20 thermistor, compensating with the formula:
Distance (cm) = (SpeedOfSound × Time) / 2, where SpeedOfSound = 331.4 + (0.6 × Temperature°C).
Validate accuracy by cross-checking with manual dipstick measurements during initial setup.
Avoid common pitfalls: condensation on the sensor lens disrupts readings–install a PTFE film cover or silica gel pack nearby. For outdoor deployment, enclose the circuit in a waterproof junction box (IP66-rated) and use silicone sealant around cable entries. Test the relay’s response time; delay action by 3 seconds after pump shutoff to prevent motor burnout from rapid cycling.
Smart Remote Tank Monitoring System: Key Schematic Insights

Begin with a 433 MHz RF transmitter-receiver pair for optimal signal range–up to 100 meters in open spaces. Pair the HC-12 module for longer distances (1 km) if line-of-sight isn’t obstructed. Avoid Bluetooth or Wi-Fi; their power draw defeats battery longevity in off-grid setups.
Select Arduino Nano or ESP8266 as the microcontroller–both handle analog inputs with 10-bit resolution, critical for precise depth sensing. For ESP8266, leverage deep sleep (10 μA current) to extend battery life to 6+ months. Flash memory enables OTA updates, eliminating manual intervention.
Use ultrasonic sensors (HC-SR04) or conductive probes for detection. Ultrasonics excel for non-corrosive liquids (error margin ±0.3 cm) but falter in foam or turbulence. Probes work universally but corrode in saline solutions; pair with a voltage divider to prevent electrolysis. For probes, apply 5V and measure resistance–submerge in distilled liquid first to calibrate baseline.
- Power: 9V alkaline battery or solar panel (5W) with a TP4056 charging module. Add a Schottky diode (1N5817) to prevent reverse current drain. For solar, incorporate a 3.7V Li-ion cell with 2000mAh capacity–this sustains operation during 48-hour cloud cover.
- Components: Opt for SMD resistors (1% tolerance) to shrink PCB footprint. Use Tantalum capacitors (10μF) near the MCU to stabilize voltage fluctuations. Transistors (2N2222) switch pumps/valves; relays are overkill unless handling >2A loads.
- Enclosure: IP67-rated ABS plastic with silicone gaskets. Mount sensors internally using M3 threaded standoffs to prevent misalignment. Drill a 3mm vent hole to equalize pressure without compromising ingress protection.
Partition the PCB into three zones: analog (sensors), digital (MCU), and power. Route ground planes separately–analog ground beneath sensor traces, digital ground under the MCU. Tie grounds at a single point near the power input to eliminate noise coupling. Use 0.2mm trace widths for signal paths, 2mm for power.
Code logic: poll sensors every 10 seconds. If depth exceeds 90% threshold, trigger output (transistor/relay) for 5 seconds–sufficient to actuate a solenoid valve. Log timestamps to EEPROM to track fill/drain cycles. For redundancy, implement a watchdog timer (WDT) to reset the MCU if it hangs. Sample code snippet:
- Initialize pins:
const int trigPin = 9; echoPin = 10; - Read ultrasonic:
duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; - Validate data:
if (distance > 2 && distance - Transmit via RF:
radio.send(outBuffer, 4); radio.waitPacketSent();
Field-test in situ with a multimeter. Probe sensor output voltage at varying depths–analog probes should linearly increase from 0V (empty) to 5V (full). For ultrasonics, measure echo pulse width; deviations >1ms indicate obstruction. Calibrate pump actuation delay by filling a 1L container–adjust duration until volume delivered matches +/-5%. Document all thresholds in firmware comments for future reference.
Core Elements for Assembling a Remote Fluid Height Monitoring Device

Select an ESP8266 or ESP32 microcontroller as the primary processing unit. These modules integrate Wi-Fi connectivity with sufficient computational power for data transmission. The ESP32 additionally supports Bluetooth, enabling short-range communication as a fallback. Ensure the module includes a 10-bit analog-to-digital converter (ADC) for accurate readings from sensors.
For detection probes, use conductive stainless steel rods measuring 6–10 mm in diameter. Cut them to lengths exceeding your tank’s maximum height by 5–10 cm. Space pairs of rods horizontally 2–3 cm apart to minimize false triggers caused by surface tension. Passivate the rods with a light electrolyte solution–such as sodium bicarbonate–to reduce corrosion and maintain consistent conductivity.
Install a 220 Ω resistor in series with each probe to limit current below 5 mA. This prevents electrolysis at the electrode tips while maintaining reliable signal strength. For tanks exceeding 1 m depth, increase resistor values incrementally: 470 Ω for 1–2 m, 1 kΩ for deeper reservoirs. Place resistors as close to the probes as possible to reduce noise pickup.
Opt for a capacitive non-contact sensor as an alternative to conductive probes in corrosive or scaling environments. The DFRobot SEN0228 module operates reliably through non-metallic tank walls up to 1 cm thick. Configure sensitivity via onboard trims: start at mid-range (50%) and fine-tune until consistent hysteresis pairs form at 5% above and below target thresholds.
| Component | Model | Key Specification | Typical Cost (USD) |
|---|---|---|---|
| MCU | ESP32-WROOM-32E | Wi-Fi + Bluetooth, dual-core 240 MHz | 5–7 |
| Power Supply | HLK-PM01 | 220V AC to 5V DC, 600 mA | 3–4 |
| Sensor | DFRobot SEN0228 | 1–20 cm detection range | 12–15 |
| Probes | 316L Stainless Steel | 6 mm diameter, passivated | 0.5–1 per meter |
Power the system with a HLK-PM01 AC-DC converter providing 5 V at 600 mA. Avoid USB power adapters in industrial environments due to susceptibility to voltage fluctuations. Install a 1000 µF electrolytic capacitor across the power rails to smooth out transient spikes greater than 1 V.
Implement hysteresis in the detection logic to avoid rapid toggling at threshold points. Set the upper trip point 3–5% below overflow and the lower trip 3–5% above pump activation. Use interrupt-driven routines on GPIO pins to wake the MCU from deep sleep, extending battery life in solar-powered units to 3–6 months with a 6000 mAh lithium-ion cell.
Enclose the electronics in a IP67-rated plastic junction box measuring at least 15 × 10 × 8 cm. Mount the box no closer than 30 cm from the tank wall to prevent condensation affecting circuitry. Secure probes with polyvinyl chloride (PVC) pipe clamps to maintain consistent spacing as temperature fluctuates.
Step-by-Step Assembly for Signal Sender and Receiver Units

Begin by placing the RF transmitter module on a solderless breadboard, ensuring pin 1 (VCC) aligns with the power rail. Connect a 9V battery via a 7805 voltage regulator to provide stable 5V input–fluctuations beyond ±0.2V will disrupt data transmission. Solder a 10kΩ resistor between the module’s data pin and the microcontroller’s output to prevent signal reflection.
Attach a float switch to the sensor input, wiring it in a normally-open configuration. Use a 1N4007 diode across the switch to clamp voltage spikes generated when the contacts close–this extends switch lifespan by 300%. Route the switch output through a 470Ω resistor into the microcontroller’s analog input for noise suppression.
For the receiver unit, mount the RF module identically but add a 10μF capacitor between VCC and ground to filter power supply ripple. Program the microcontroller to parse incoming signals with a Manchester encoding scheme–this doubles error resilience compared to NRZ. Verify packet integrity by logging CRC checksums to a serial monitor at 9600 baud.
Install a 5V relay on the receiver’s output, driven by a 2N2222 transistor with a base resistor of 2.2kΩ. Connect the relay’s coil to the microcontroller’s PWM output, ensuring the flyback diode (1N4148) is oriented cathode-to-VCC. Test relay actuation by toggling the PWM duty cycle between 40% and 60%–delays above 50ms indicate insufficient transistor saturation.
Add a red LED with a 330Ω current-limiting resistor to indicate fault states. Set the microcontroller to flash the LED at 10Hz when signal strength drops below -85dBm–this threshold balances sensitivity and false triggers. For outdoor deployments, enclosure the entire setup in a polycarbonate IP66-rated box, sealing cable entries with silicone compound.
Calibrate the sensor by immersing it in incremental depths. Record the microcontroller’s ADC readings at each depth, then plot the values against actual measurements–linearity errors above ±2% require recalibration of the voltage divider network (use trimpots for fine adjustment). Store calibration coefficients in the microcontroller’s EEPROM to preserve settings across power cycles.
Optimize transmission range by adjusting the antenna length to ¼ wavelength (17.3 cm for 433 MHz). Position the antenna vertically and space it at least 5 cm from metal surfaces–horizontal orientation reduces range by 40%. For environments with dense obstructions, switch to frequency-hopping mode (if supported) to mitigate multipath interference.
Finalize the build by uploading a bootloader with watchdog timer enabled. Set the timeout to 2 seconds–longer intervals risk unresponsive states during brownouts. Secure all connections with heat-shrink tubing and apply conformal coating to PCB traces to prevent corrosion in humid conditions. Perform a 24-hour stress test at 90% relative humidity to validate reliability before deployment.