You dont have javascript enabled! Please enable it!

Practical case: Automatic Reservoir Pump Controller

Automatic Reservoir Pump Controller prototype (Maker Style)

Level: Medium | Construct a transistor-driven relay circuit to automatically control a water pump using a float switch.

Objective and use case

In this practical case, you will build an automatic reservoir pump controller. The circuit uses a mechanical float switch to trigger an NPN transistor, which energizes an electromechanical relay to drive a high-current DC pump (simulated here as a resistive load) and a status LED.

Why this is useful:
* Automates water level management in tanks, reservoirs, and sump basins.
* Safely isolates low-voltage control circuits from high-power loads.
* Demonstrates the practical interfacing of simple mechanical sensors with power electronics.
* Prevents overflow or dry-running conditions in industrial and agricultural settings.

Expected outcome:
* Closing the float switch applies a voltage to the transistor base, turning it on (saturation).
* The transistor sinks current for the relay coil, energizing it and closing its normally open (NO) contact.
* The simulated DC pump (load resistor) receives the full supply voltage.
* The status indicator LED illuminates when the pump is active.
* Releasing the switch de-energizes the relay, and the flyback diode safely dissipates the inductive voltage spike from the coil.

Target audience: Intermediate electronics students learning about transistor switching, electromechanical relays, and inductive load protection.

Materials

  • V1: 12 V DC supply, function: main power for relay coil and pump
  • V2: 5 V DC supply, function: control logic power for the float switch
  • SW1: SPST switch, function: simulated float switch or high-level sensor
  • R1: 1 kΩ resistor, function: transistor base current limiting
  • R2: 10 kΩ resistor, function: pull-down for transistor base to ensure turn-off
  • R3: 1 kΩ resistor, function: LED current limiting
  • RLOAD: 50 Ω high-power resistor, function: simulated DC pump load
  • Q1: 2N2222 NPN transistor, function: relay coil driver
  • D1: 1N4007 diode, function: flyback protection for relay coil
  • D2: Green LED, function: pump status indicator
  • K1: 12 V SPDT Relay, function: electromechanical switch for the pump

Wiring guide

  • V1 connects between node VCC12 and node 0.
  • V2 connects between node VCC5 and node 0.
  • SW1 connects between node VCC5 and node SENSE.
  • R1 connects between node SENSE and node VB.
  • R2 connects between node VB and node 0.
  • Q1 base connects to node VB, emitter connects to node 0, and collector connects to node COIL_NEG.
  • K1 coil connects between node VCC12 and node COIL_NEG.
  • K1 COM (Common) contact connects to node VCC12.
  • K1 NO (Normally Open) contact connects to node LOAD_SW.
  • D1 cathode connects to node VCC12 and anode connects to node COIL_NEG (placed anti-parallel to the relay coil).
  • RLOAD connects between node LOAD_SW and node 0.
  • R3 connects between node LOAD_SW and the anode of D2.
  • D2 cathode connects to node 0.

Conceptual block diagram

Conceptual block diagram — Relay Pump Controller
Quick read: inputs → main block → output (actuator or measurement). This summarizes the ASCII schematic below.

Schematic

VCC5 --> [ SW1 ] --(SENSE)--> [ R1 ] --(VB)--> [ Q1:B ]
                                              |          |
                                            [ R2 ]       |
                                              |          |
                                             GND         |
                                                         |
      VCC12 --> [ K1 Coil || D1(Rev) ] --(COIL_NEG)--> [ Q1:C ] --( )-- [ Q1:E ] --> GND
                       |
                (Magnetic Link)
                       v
      VCC12 --> [ K1 Switch (COM->NO) ] --(LOAD_SW)--> [ RLOAD (Pump) ] --> GND
                                              |
                                              +------> [ R3 ] --> [ D2 (LED) ] --> GND
Electrical Schematic

Electrical diagram

Electrical diagram for case: Automatic reservoir pump controller
Generated from the validated SPICE netlist for this case.

🔒 This electrical diagram is premium. With the 7-day pass or the monthly membership you can unlock the complete didactic material and the print-ready PDF pack.🔓 See premium access plans

Measurements and tests

  1. Control Logic Test: With SW1 open, measure the voltage at node SENSE. It should be 0 V. Close SW1 and verify the voltage rises to 5 V.
  2. Base Drive Verification: Measure the voltage at node VB with SW1 closed. It should read approximately 0.7 V, confirming the base-emitter junction of Q1 is forward-biased.
  3. Coil Switching Verification: Probe node COIL_NEG. When SW1 is open, it should measure 12 V. When SW1 is closed, it should drop to near 0 V (Vce_sat of the transistor), confirming the coil is energized.
  4. Load Delivery Test: Measure the voltage at node LOAD_SW. Verify that it reads 0 V when the relay is off, and jumps to 12 V when the relay clicks on. Check that the RLOAD draws current and D2 illuminates.

SPICE netlist and simulation

Reference SPICE Netlist (ngspice) — excerptFull SPICE netlist (ngspice)

* Automatic Reservoir Pump Controller
.width out=256

* Power Supplies
V1 VCC12 0 DC 12
V2 VCC5 0 DC 5

* Simulated Float Switch (SW1)
* Using a voltage-controlled switch and a pulse source to simulate a user/sensor triggering the switch
V_SW_CTRL SW_CTRL 0 PULSE(0 5 50u 1u 1u 200u 500u)
S1 VCC5 SENSE SW_CTRL 0 myswitch

* Base driving circuit
R1 SENSE VB 1k
R2 VB 0 10k

* Relay Driver Transistor
Q1 COIL_NEG VB 0 2N2222MOD

* Relay Coil (K1)
* ... (truncated in public view) ...

Copy this content into a .cir file and run with ngspice.

🔒 Part of this section is premium. With the 7-day pass or the monthly membership you can access the full content (materials, wiring, detailed build, validation, troubleshooting, variants and checklist) and download the complete print-ready PDF pack.

* Automatic Reservoir Pump Controller
.width out=256

* Power Supplies
V1 VCC12 0 DC 12
V2 VCC5 0 DC 5

* Simulated Float Switch (SW1)
* Using a voltage-controlled switch and a pulse source to simulate a user/sensor triggering the switch
V_SW_CTRL SW_CTRL 0 PULSE(0 5 50u 1u 1u 200u 500u)
S1 VCC5 SENSE SW_CTRL 0 myswitch

* Base driving circuit
R1 SENSE VB 1k
R2 VB 0 10k

* Relay Driver Transistor
Q1 COIL_NEG VB 0 2N2222MOD

* Relay Coil (K1)
* Modeled as a series resistor and inductor
R_K1 VCC12 K1_COIL_INT 400
L_K1 K1_COIL_INT COIL_NEG 10mH

* Flyback Diode
D1 COIL_NEG VCC12 1N4007MOD

* Relay Contacts (K1 NO)
* The switch closes when the voltage across the coil (VCC12 - COIL_NEG) exceeds 8V
S_RELAY VCC12 LOAD_SW VCC12 COIL_NEG relay_sw

* Simulated Pump Load
RLOAD LOAD_SW 0 50

* Status LED
R3 LOAD_SW D2_A 1k
D2 D2_A 0 DLED

* Models
.model myswitch SW(vt=2.5 vh=0.5 ron=0.1 roff=10MEG)
.model relay_sw SW(vt=8 vh=1 ron=0.05 roff=100MEG)
.model 2N2222MOD NPN(IS=1E-14 VAF=100 BF=200 IKF=0.3 XTB=1.5 BR=3 CJC=8E-12 CJE=25E-12 TR=100E-9 TF=400E-12 ITF=1 VTF=2 XTF=3 RB=10)
.model 1N4007MOD D(IS=7.02767n RS=0.0341512 N=1.80803 EG=1.11 XTI=3.0 BV=1000 IBV=5e-08 CJO=1e-11 VJ=0.7 M=0.5 FC=0.5 TT=1e-07)
.model DLED D(IS=1e-20 N=2.2 RS=2.5 BV=5 IBV=10u CJO=50p)

* Analysis Commands
.op
.tran 1u 500u
.print tran V(SENSE) V(LOAD_SW) V(COIL_NEG) V(VB) I(L_K1)

.end

Simulation Results (Transient Analysis)

Simulation Results (Transient Analysis)
Analysis: The transient analysis spans 0 s to 500 us and captures the switching interval. The switching node and inductor current remain bounded, consistent with the flyback path protecting the switch. Main ranges: l_k1#branch -7.86 uA -> 29.9 mA; v(coil_neg) 9.89 mV -> 12.7 V; v(load_sw) 6 uV -> 12 V.
Show raw data table (961 rows)
Index   time            v(sense)        v(load_sw)      v(coil_neg)     v(vb)           l_k1#branch
0	0.000000e+00	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403801e-11
1	1.000000e-08	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403803e-11
2	2.000000e-08	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403801e-11
3	4.000000e-08	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403795e-11
4	8.000000e-08	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403772e-11
5	1.600000e-07	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403654e-11
6	3.200000e-07	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403033e-11
7	6.400000e-07	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.400598e-11
8	1.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.398528e-11
9	2.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.403534e-11
10	3.280000e-06	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.401174e-11
11	4.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.394780e-11
12	5.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.402136e-11
13	6.280000e-06	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.408634e-11
14	7.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.401469e-11
15	8.280000e-06	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.399217e-11
16	9.280000e-06	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.399919e-11
17	1.028000e-05	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.393646e-11
18	1.128000e-05	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.397704e-11
19	1.228000e-05	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.408121e-11
20	1.328000e-05	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.402567e-11
21	1.428000e-05	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.395460e-11
22	1.528000e-05	5.494076e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.400449e-11
23	1.628000e-05	5.494077e-03	5.999997e-06	1.200000e+01	4.994626e-03	2.399821e-11
... (937 more rows) ...

Common mistakes and how to avoid them

  • Missing flyback diode (D1): When the relay turns off, the collapsing magnetic field in the coil generates a massive voltage spike. Without D1 to provide a safe discharge path, this spike will instantly destroy Q1. Always place D1 reverse-biased across the coil.
  • Insufficient base drive current: If R1 is too large, Q1 will operate in its linear region instead of fully saturating. This will cause the transistor to overheat and the relay may fail to actuate reliably. Always ensure R1 provides enough base current (Ib) for the required collector current (Ic).
  • Undersized relay contacts: Motors and pumps draw a massive «inrush» current when starting up. Using a relay rated exactly for the running current will cause the contacts to weld shut or burn. Always select a relay rated for at least 2-3 times the load’s continuous current.

Troubleshooting

  • Symptom: The relay chatters or buzzes rapidly instead of latching cleanly.
  • Cause: The 12 V power supply is too weak and drops voltage under the heavy load of the pump, causing the relay coil to lose holding power, disconnect the load, recover, and repeat.
  • Fix: Use a bench power supply with a higher current capacity or test with a battery.
  • Symptom: Transistor Q1 becomes extremely hot and fails.
  • Cause: Missing flyback diode, or the relay coil’s current demand exceeds the maximum collector current of the 2N2222.
  • Fix: Verify D1 is correctly installed. Check the relay coil resistance; ensure it draws less than 600 mA.
  • Symptom: Circuit turns on randomly without float switch action.
  • Cause: The base of Q1 is floating, picking up environmental electromagnetic interference.
  • Fix: Ensure the pull-down resistor R2 is securely connected between node VB and ground.
  • Symptom: The LED turns on, but the simulated pump (RLOAD) does not work.
  • Cause: Broken connection at the relay NO contact or a blown load resistor.
  • Fix: Check the wiring between the relay’s NO pin and LOAD_SW. Verify the resistance of RLOAD with a multimeter.

Possible improvements and extensions

  • Low-Water Cutoff (Latching Logic): Add a second float switch and configure the relay as a latching circuit. This ensures the pump runs continuously until the tank is completely full, rather than short-cycling.
  • Debounce Delay Network: Water ripples in a tank can cause the float switch to rapidly bounce on and off. Add an RC delay network (a capacitor and resistor) at the transistor base, or use a 555 timer, to introduce a turn-on/turn-off delay and protect the pump.

More Practical Cases on Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon Associate, I earn from qualifying purchases. If you buy through this link, you help keep this project running.

Quick Quiz

Question 1: What is the primary purpose of the circuit described in the text?




Question 2: What type of transistor is used to energize the electromechanical relay?




Question 3: Why is the use of an electromechanical relay important in this circuit?




Question 4: What happens to the transistor when the float switch is closed?




Question 5: Which relay contact closes when the relay coil is energized?




Question 6: What happens when the float switch is released?




Question 7: What component is used to trigger the NPN transistor?




Question 8: What happens to the status indicator LED when the pump is active?




Question 9: What is one of the benefits of this circuit in industrial and agricultural settings?




Question 10: How is the high-current DC pump simulated in this practical case?




Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:
Scroll to Top