Build an automatic overhead water tank controller with LM358, 555, ULN2003 and 7805. No microcontroller or code: probe wiring, pump latch, overflow alarm and diagram.
Need it ready-made? Buy Ready Project
This automatic water tank controller fills an overhead tank and switches the pump off when the water reaches the high probe. It is built from four everyday non-programmable ICs — a 7805 regulator, an LM358 dual op-amp, a NE555 timer and a ULN2003A Darlington array — so there is no microcontroller and no code to upload. Two transistors form a set-reset latch: the pump starts when the tank falls below the low probe and keeps running until the high probe gets wet. A fourth overflow probe enables the 555, which sounds a buzzer if the tank ever overfills.
Build and test it with a 12 V DC water pump (an aquarium or diaphragm pump is ideal). That keeps the whole project on low voltage. If you later switch a 230 V mains pump, use a properly rated enclosed relay or contactor and have the mains wiring done by a qualified person. Never put mains voltages on a breadboard.
Below you get a clear description of how the latch and alarm work, the full parts list, a pin-to-pin wiring table, and a connection diagram. Because every chip here is analog or a simple logic array, this project has no sketch to copy.
How the Water Tank Controller Works
A 12 V DC adapter powers the pump relay and the ULN2003 clamp pin. The same 12 V goes into a 7805, which makes a clean 5 V rail for the LM358 and the 555. Put a 10 µF electrolytic and a 0.1 µF ceramic capacitor on both the regulator input and the output, close to the 7805 pins.
Four stainless steel probes hang in the tank. The COM probe sits at the bottom and is wired to +5 V. The LOW, HIGH and OVERFLOW probes sit at about 20 percent, 90 percent and just above the high mark. Each sense probe has a 100 kΩ resistor to ground. When water touches a probe, it conducts from COM and the probe voltage rises well above the 2.5 V reference (two 10 kΩ resistors between +5 V and ground).
Inside the LM358, op-amp A compares the HIGH probe (pin 3) with 2.5 V (pin 2). Pin 1 goes high when the tank is full. Op-amp B compares the LOW probe (pin 5) with 2.5 V (pin 6). Pin 7 goes high when water is at or above the low probe.
The pump must not chatter every time the water ripples around one probe. That is what the latch is for:
- Start: when the tank is below LOW, pin 7 is low. Transistor Q1 inverts that signal, so START is high. Diode D1 pulls the RUN node high and the pump turns on.
- Hold: once the relay closes, its normally-open contact feeds 12 V into a 15 kΩ + 10 kΩ divider (about 4.8 V). Diode D2 keeps RUN high even after the water rises past the low probe and START falls.
- Stop: when the tank reaches HIGH, pin 1 goes high and transistor Q2 shorts RUN to ground. The relay drops out, HOLD disappears, and the pump stays off until the water falls below LOW again.
The ULN2003A sinks the relay coil from IN1/OUT1, so the small RUN signal never has to carry coil current. Pin 9 (COM) goes to +12 V and uses the chip’s built-in clamp diodes. A green LED on IN3/OUT3 lights while the pump is on. A red LED driven from LM358 pin 1 (through another ULN2003 channel) lights when the tank is full.
The NE555 runs as a slow astable (about 0.7 Hz with 10 kΩ, 100 kΩ and 10 µF). Its RESET pin (pin 4) is held low by a 100 kΩ resistor, so the chip stays silent. When water reaches the overflow probe, that pin is pulled up through the water toward +5 V, the 555 starts, and pin 3 drives ULN2003 IN2. OUT2 then beeps the buzzer. If the high-level shutoff is working, you should never hear this alarm — it is the safety net.
Components Required
- 7805 voltage regulator – 1
- LM358 dual op-amp – 1
- NE555 timer – 1
- ULN2003A Darlington transistor array – 1
- 12 V SPDT relay (coil 12 V; contacts rated for your pump) – 1
- 12 V DC water pump – 1 (for safe testing)
- 12 V DC adapter, 1 A or more – 1
- Active buzzer, 5 V or 12 V – 1
- BC547 or 2N2222 NPN transistors – 2
- 1N4148 diodes – 2
- Stainless steel probes or bolts with insulated wire – 4
- Resistors: 10 kΩ × 6, 100 kΩ × 4, 15 kΩ × 1, 330 Ω × 2
- Capacitors: 10 µF / 25 V electrolytic × 2, 10 µF / 16 V electrolytic × 1, 0.1 µF ceramic × 2, 10 nF ceramic × 1
- LEDs: green (pump on) and red (tank full) – 1 each
- 8-pin IC sockets (optional) – 2, and one 16-pin socket for the ULN2003
- Breadboard or perfboard, jumper wires, and a small heatsink for the 7805 if it runs warm
Wiring Table (Pin-to-Pin)
| Part | Pin / Node | Connects To | Notes |
|---|---|---|---|
| 7805 | IN (pin 1) | +12 V adapter + | 10 µF and 0.1 µF from IN to GND, close to the regulator |
| 7805 | GND (pin 2) | Circuit GND | Join to the adapter − |
| 7805 | OUT (pin 3) | +5 V rail | 10 µF and 0.1 µF from OUT to GND |
| LM358 | VCC (pin 8) | +5 V | Do not run the op-amp from 12 V in this build |
| LM358 | GND (pin 4) | GND | Common ground |
| Reference divider | Midpoint of two 10 kΩ resistors | LM358 pins 2 and 6 | Top 10 kΩ to +5 V, bottom 10 kΩ to GND (about 2.5 V) |
| Probe COM | Bottom of the tank | +5 V | Lowest stainless rod; stays in water whenever the tank is not empty |
| Probe LOW | About 20% height | LM358 pin 5 | 100 kΩ from pin 5 to GND |
| Probe HIGH | About 90% height | LM358 pin 3 | 100 kΩ from pin 3 to GND |
| Probe OVERFLOW | A few centimetres above HIGH | NE555 RESET (pin 4) | 100 kΩ from pin 4 to GND |
| LM358 | Pin 7 (low-level output) | Q1 base through 10 kΩ | High when water is at or above LOW |
| Q1 (BC547) | Emitter | GND | Inverts pin 7 to make START |
| Q1 (BC547) | Collector (START) | RUN node through D1 (1N4148) | Also a 10 kΩ pull-up from the collector to +5 V |
| LM358 | Pin 1 (high-level output) | Q2 base through 10 kΩ | High when the tank is full |
| Q2 (BC547) | Emitter | GND | Reset transistor |
| Q2 (BC547) | Collector | RUN node | Shorts RUN to ground when the tank is full |
| Relay | NO contact | HOLD divider, then D2 to RUN | 15 kΩ from NO to the midpoint, 10 kΩ from the midpoint to GND, then D2 (1N4148) to RUN |
| RUN node | — | ULN2003 IN1 (pin 1) and IN3 (pin 3) | High means the pump should run |
| ULN2003A | GND (pin 8) | GND | Common ground |
| ULN2003A | COM (pin 9) | +12 V | Clamp diodes for the relay coil |
| ULN2003A | OUT1 (pin 16) | Relay coil − | Relay coil + goes to +12 V |
| Relay | COM | +12 V | Switched pump supply |
| Relay | NO | 12 V pump + and the HOLD divider | Pump − goes to GND |
| NE555 | VCC (pin 8) | +5 V | |
| NE555 | GND (pin 1) | GND | |
| NE555 | TR (pin 2) and TH (pin 6) | Tied together | Astable mode |
| NE555 | DIS (pin 7) | 10 kΩ to +5 V and 100 kΩ to pins 2 and 6 | Timing resistors |
| Timing capacitor | 10 µF | Pins 2 and 6 to GND | Gives a beep of about 0.7 Hz |
| NE555 | CTRL (pin 5) | 10 nF to GND | Keeps the control pin quiet |
| NE555 | OUT (pin 3) | ULN2003 IN2 (pin 2) | Alarm drive |
| ULN2003A | OUT2 (pin 15) | Buzzer − | Buzzer + to +12 V, or to +5 V if you use a 5 V buzzer |
| Green LED | Anode through 330 Ω to +5 V | Cathode to ULN2003 OUT3 (pin 14) | IN3 is tied to RUN |
| Red LED | Anode through 330 Ω to +5 V | Cathode to ULN2003 OUT4 (pin 13) | IN4 (pin 4) is tied to LM358 pin 1 |
Use one common ground for the adapter, the 7805, both 8-pin ICs, the ULN2003, the two transistors and the pump. If your buzzer is a 5 V type, take its positive lead to +5 V instead of +12 V so you do not burn it out.
Connection Diagram
The overview image shows the main blocks. Use the labelled diagram that follows, and the wiring table, for the exact pin connections.

How to Build and Set the Probes
- Wire the 7805 first and confirm you have a steady 5 V rail before you insert the other ICs.
- Add the 2.5 V reference divider and check that LM358 pins 2 and 6 sit near 2.5 V.
- Fit the LM358, the two transistors, the two diodes and the ULN2003, then the relay and the green LED. Leave the 555 and buzzer until the pump latch works.
- Hang the four probes so they cannot swing into each other. COM must be the lowest. Space LOW, HIGH and OVERFLOW to match your tank.
- For a first test, stand the four probes in a plastic jar or bucket instead of the real overhead tank. Use a 12 V DC pump that recirculates water back into the same jar, or simply watch the relay and the green LED.
- If tap water is very pure and a probe does not switch the comparator, raise the pull-down resistors from 100 kΩ to 470 kΩ, or move that pair of probes closer together. Do not add salt to a drinking-water tank.
- When the latch works, add the 555, the overflow probe resistor and the buzzer. Raise the water to the overflow probe on purpose once, confirm the alarm, then lower the probe so normal fill-and-stop never reaches it.
Testing the Controller
- Start with the jar below the LOW probe. The green LED should light and the relay should click on. The 12 V pump (if connected) should run.
- Raise the water past LOW but not as far as HIGH. The pump must stay on. That proves the HOLD path through the relay contact and D2.
- Raise the water to HIGH. The red LED should light, the relay should drop out and the pump should stop.
- Lower the water so HIGH goes dry but LOW is still wet. The pump must stay off. That is the other half of the latch.
- Lower the water below LOW. The pump should start again.
- Raise the water to the overflow probe. The buzzer should beep on and off about once a second. Drop the water below that probe and the alarm should stop.
Troubleshooting
| Problem | Fix |
|---|---|
| 7805 gets very hot | The relay coil or a wiring short is drawing too much from the 5 V rail. The coil must run from +12 V through the ULN2003, not from 5 V. Add a heatsink and check for solder bridges. |
| Pump never starts | Check RUN with a meter. If it never goes high, look at Q1, the 10 kΩ collector pull-up and D1. Confirm COM is on +5 V and the LOW probe really reaches pin 5. |
| Pump never stops | Confirm the HIGH probe reaches LM358 pin 3 and that Q2 can pull RUN to ground (about 0 V) when you touch the HIGH probe to COM. Check that pin 1 goes high when HIGH is wet. |
| Pump chatters on and off near one probe | The latch is not holding. Check D2, the 15 kΩ + 10 kΩ divider on the relay NO contact, and that the relay COM is really at +12 V when the coil is energised. |
| A probe does nothing | Clean the metal, shorten the gap to COM, or raise that probe’s 100 kΩ pull-down to 470 kΩ. Very long thin wires pick up noise — keep probe cables reasonably short. |
| Buzzer stays silent at overflow | RESET (pin 4) must rise well above 0.7 V. Check the overflow pull-down and the ULN2003 IN2/OUT2 path. A passive buzzer (no internal oscillator) will only click — use an active buzzer. |
| Buzzer runs all the time | Pin 4 is not pulled down, or the overflow probe is touching COM or sitting in water. Confirm the 100 kΩ from pin 4 to GND. |
Ideas to Extend This Project
- Add a sump or underground-tank dry-run probe with a second LM358 so the pump cannot run if the source is empty.
- Wire a second relay channel on the ULN2003 to switch a solenoid valve instead of, or as well as, a pump.
- Bring LOW, HIGH and OVERFLOW status to three extra LEDs so you can see each probe without dipping a meter in the tank.
- Replace the two 10 kΩ reference resistors with a 10 kΩ preset if you want to tune the trip point for very pure or very hard water.
FAQ
Why is there no code? The 7805, LM358, NE555 and ULN2003 are analog and logic chips, not microcontrollers. The behaviour is set by the wiring, the probe heights and a few resistors.
Can I use this on a 230 V borewell or overhead-tank pump? The control side stays at 12 V and 5 V. Only a properly rated enclosed relay or contactor should switch a mains pump, and a qualified person should do that wiring. For learning and for the tests in this article, use a 12 V DC pump.
Will the probes rust? Use stainless steel rods or bolts. Ordinary iron or copper will corrode in water and give false readings. Keep the wiring joints above the water line.
Can I power the LM358 from 12 V instead of 5 V? The LM358 can run from 12 V, but then the probe pull-ups, the 2.5 V divider and the 555 supply would no longer match. Keep the op-amp and the 555 on the 7805’s 5 V rail as drawn.
What pump current can the ULN2003 handle? The ULN2003 drives the relay coil, not the pump motor. A typical 12 V relay coil is 30 to 80 mA, which is well inside one ULN2003 channel (500 mA). Size the relay contacts for the pump’s own current.
Related Projects
- Automatic Plant Watering System with Arduino
- 555 Timer and CD4017 LED Chaser Circuit
- ATmega16 Temperature Controller with LM35
- Wemos D1 Mini Rain Detector with Wi-Fi Alert
Browse more Industrial Automation on Arduino Project Hub.
1 thought on “Automatic Water Tank Controller with LM358, 555 & ULN2003”