📘 MODULE 7 – Automatic Water Dispenser
Lesson 7.2 – IR Sensor + Pump Circuit
Learning Objectives
By the end of this lesson, students will be able to:
- Understand the complete circuit of the Automatic Water Dispenser.
- Learn how the IR sensor, relay module, and water pump are connected.
- Identify the purpose of each circuit connection.
- Understand signal flow from sensor detection to pump activation.
- Build the circuit safely on a breadboard.
- Verify all wiring before testing.
- Troubleshoot common circuit connection mistakes.
Main Content
Introduction
In the previous lesson, we learned about the Automatic Water Dispenser project and its working principle.
Now it is time to build the actual hardware circuit.
The circuit consists of four main components:
- Arduino UNO
- IR Sensor Module
- Relay Module
- Mini DC Water Pump
These components work together to create a touchless water dispensing system.
Project Circuit Overview
The system works in the following sequence:
Hand/Bottle Detected
↓
IR Sensor
↓
Arduino UNO
↓
Relay Module
↓
Water Pump
↓
Water Dispensing
The IR sensor acts as the input device.
The relay and pump act as the output system.
Arduino processes the input and controls the output.
Components Required
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| IR Sensor Module | 1 |
| Single Channel Relay Module | 1 |
| Mini DC Water Pump | 1 |
| Breadboard | 1 |
| Jumper Wires | Several |
| USB Cable | 1 |
| External 5V–12V Supply (Pump) | 1 |
Understanding Circuit Sections
The complete circuit can be divided into three sections:
Section 1: IR Sensor Connections
Used for object detection.
Section 2: Relay Connections
Used for switching the pump.
Section 3: Pump Connections
Used for dispensing water.
IR Sensor Connections
A typical IR sensor module contains:
VCC
GND
OUT
IR Sensor → Arduino Connections
| IR Sensor Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | D2 |
VCC Connection
IR VCC → Arduino 5V
Provides power to the sensor.
GND Connection
IR GND → Arduino GND
Completes the electrical circuit.
OUT Connection
IR OUT → Arduino D2
Sends detection signals to Arduino.
When an object is detected:
OUT = LOW or HIGH
depending on sensor type and adjustment.
Relay Module Connections
A relay module usually contains:
VCC
GND
IN
Relay → Arduino Connections
| Relay Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| IN | D8 |
Relay VCC
Relay VCC → Arduino 5V
Powers the relay module.
Relay GND
Relay GND → Arduino GND
Provides ground reference.
Relay IN
Relay IN → Arduino D8
Arduino controls the relay through this pin.
Water Pump Connections
The pump should NOT be powered directly from an Arduino digital pin.
Reason:
Pump Current > Arduino Pin Current Capacity
Doing so may damage the Arduino.
Instead, use the relay.
Relay Output Terminals
Most relay modules provide:
COM
NO
NC
Recommended Connection
Use:
COM
NO
terminals.
This ensures:
Pump OFF when Relay OFF
Pump ON when Relay ON
Pump Wiring Diagram
Power Supply (+)
|
|
COM
|
NO
|
|
Pump (+)
Pump (-)
|
Power Supply (-)
Working of Relay Circuit
When Arduino sends:
HIGH
(or LOW depending on module type)
Relay activates.
Then:
COM ↔ NO Connected
Current flows to the pump.
The pump starts.
When Arduino turns relay OFF:
COM ↔ NO Disconnected
Current stops.
The pump stops.
Complete Circuit Table
IR Sensor
| Sensor Pin | Arduino |
|---|---|
| VCC | 5V |
| GND | GND |
| OUT | D2 |
Relay Module
| Relay Pin | Arduino |
|---|---|
| VCC | 5V |
| GND | GND |
| IN | D8 |
Pump
| Pump Connection | Connected To |
|---|---|
| Positive | Relay NO |
| Negative | Power Supply Negative |
Breadboard Layout Tips
Place components in an organized manner.
Example:
IR Sensor
|
Arduino ---- Relay
|
Pump
Keep wiring short and neat.
This reduces troubleshooting problems.
Signal Flow Through Circuit
The complete signal flow is:
Hand Detected
↓
IR Sensor
↓
Arduino D2
↓
Arduino Program
↓
Arduino D8
↓
Relay Module
↓
Pump Power
↓
Water Flow
Understanding this flow helps identify problems quickly.
Power Supply Considerations
The relay and sensor can usually operate from Arduino 5V.
However, the pump may require:
5V
6V
9V
12V
depending on the model.
Always check the pump specifications.
Why Use an External Power Supply?
Example:
Pump Current Requirement:
500mA
Arduino USB current:
Limited
The pump may:
- Run slowly
- Restart Arduino
- Cause unstable operation
Therefore external power is recommended.
Circuit Verification Checklist
Before powering the circuit:
✅ IR Sensor VCC connected to 5V
✅ IR Sensor GND connected to GND
✅ IR Sensor OUT connected to D2
✅ Relay VCC connected to 5V
✅ Relay GND connected to GND
✅ Relay IN connected to D8
✅ Pump connected through relay terminals
✅ External power supply connected properly
✅ No loose wires
Common Wiring Mistakes
Mistake 1: Reversing VCC and GND
Wrong:
VCC → GND
GND → 5V
This may damage the module.
Mistake 2: Connecting Pump Directly to Arduino Pin
Wrong:
Arduino Pin → Pump
Can damage Arduino.
Mistake 3: Using NC Instead of NO
If connected to NC:
Pump ON by default
which may not be desired.
Mistake 4: Missing Common Ground
All modules should share the same ground reference.
Testing Connections Without Water
Before adding water:
- Build the circuit.
- Upload test code.
- Place hand near sensor.
- Listen for relay click.
- Observe pump operation.
Testing without water helps prevent spills during troubleshooting.
Real-World Example
Imagine a water bottle placed near the dispenser.
Process:
Bottle Near Sensor
↓
Sensor Detects Bottle
↓
Arduino Receives Signal
↓
Relay Activates
↓
Pump Starts
↓
Water Dispensed
When the bottle is removed:
Bottle Removed
↓
Sensor Clears
↓
Relay OFF
↓
Pump Stops
Best Practices
Keep Electronics Away from Water
Protect Arduino and relay from splashes.
Use Proper Pump Voltage
Match pump voltage with power supply.
Double-Check Wiring
Verify all connections before powering.
Secure Components
Prevent accidental wire disconnections.
Test Components Individually
Verify sensor and relay operation before connecting the pump.
Summary
The Automatic Water Dispenser circuit consists of an IR sensor, Arduino UNO, relay module, and water pump. The IR sensor detects a hand or bottle and sends a signal to Arduino. Arduino processes the signal and activates the relay. The relay then supplies power to the water pump, allowing water to flow. Proper wiring and power management are essential for safe and reliable operation.
Key Terms
- IR Sensor
- Relay Module
- Water Pump
- COM Terminal
- NO Terminal
- Arduino UNO
- Input Signal
- Output Control
- External Power Supply
- Automation Circuit
Quiz
1. Which Arduino pin receives the IR sensor signal in this lesson?
A. D8
B. D13
C. D2
D. A0
Answer: C
2. Which Arduino pin controls the relay?
A. D8
B. D2
C. A1
D. D12
Answer: A
3. Why should the pump not be connected directly to Arduino?
A. Pump is too small
B. Arduino cannot provide sufficient current
C. Pump requires Wi-Fi
D. Arduino cannot read pumps
Answer: B
4. Which relay terminal is commonly used to keep the pump OFF until activation?
A. NC
B. COM
C. NO
D. GND
Answer: C
5. What is the purpose of the relay module?
A. Measure distance
B. Detect objects
C. Switch pump power safely
D. Store data
Answer: C
Assignment
Practical Activity
Build the complete Automatic Water Dispenser circuit on a breadboard.
Perform the following:
- Connect the IR sensor.
- Connect the relay module.
- Connect the water pump through the relay.
- Verify all wiring using the checklist.
- Draw the complete circuit diagram in your notebook.
Answer the following:
- Why is a relay necessary?
- Why is an external power source recommended for the pump?
- What happens when the sensor detects a bottle?