Arduino UNO-Based Smart Water Pump System with Ultrasonic Sensor and LED Indicators
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino UNO microcontroller, a water pump, two LEDs (red and green), an L298N DC motor driver, an HC-SR04 ultrasonic sensor, and resistors. The circuit is designed to control the water pump and LEDs based on sensor inputs and microcontroller logic.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
Water Pump
- Description: A small DC water pump.
- Pins: VCC, GND
LED: Two Pin (red)
- Description: A red LED.
- Pins: cathode, anode
LED: Two Pin (green)
- Description: A green LED.
- Pins: cathode, anode
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor.
- Pins: VCC, TRIG, ECHO, GND
Resistor (330 Ohms)
- Description: A resistor with a resistance of 330 Ohms.
- Pins: pin1, pin2
Wiring Details
Arduino UNO
- 5V connected to VCC of HC-SR04 Ultrasonic Sensor
- GND connected to pin1 of Resistor (330 Ohms), GND of HC-SR04 Ultrasonic Sensor, and pin1 of another Resistor (330 Ohms)
- D11 connected to ECHO of HC-SR04 Ultrasonic Sensor
- D10 connected to TRIG of HC-SR04 Ultrasonic Sensor
- D9 connected to ENA of L298N DC Motor Driver
- D8 connected to IN2 of L298N DC Motor Driver
- D7 connected to IN1 of L298N DC Motor Driver
- D5 connected to anode of LED (green)
- D4 connected to anode of LED (red)
Water Pump
- VCC connected to OUT2 of L298N DC Motor Driver
- GND connected to OUT1 of L298N DC Motor Driver
LED: Two Pin (red)
- anode connected to D4 of Arduino UNO
- cathode connected to pin2 of Resistor (330 Ohms)
LED: Two Pin (green)
- anode connected to D5 of Arduino UNO
- cathode connected to pin2 of another Resistor (330 Ohms)
L298N DC Motor Driver
- ENA connected to D9 of Arduino UNO
- IN2 connected to D8 of Arduino UNO
- IN1 connected to D7 of Arduino UNO
- OUT2 connected to VCC of Water Pump
- OUT1 connected to GND of Water Pump
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V of Arduino UNO
- TRIG connected to D10 of Arduino UNO
- ECHO connected to D11 of Arduino UNO
- GND connected to GND of Arduino UNO
Resistor (330 Ohms)
- pin1 connected to GND of Arduino UNO and GND of HC-SR04 Ultrasonic Sensor
- pin2 connected to cathode of LED (red)
Resistor (330 Ohms)
- pin1 connected to GND of Arduino UNO and GND of HC-SR04 Ultrasonic Sensor
- pin2 connected to cathode of LED (green)
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino UNO. The setup() function is used to initialize any settings or configurations, and the loop() function contains the main logic that runs repeatedly.
Additional Notes
- Ensure all connections are secure and double-check the wiring before powering the circuit.
- The resistors are used to limit the current through the LEDs to prevent damage.
- The L298N motor driver is used to control the water pump, allowing for direction and speed control.
- The HC-SR04 ultrasonic sensor is used to measure distance, which can be utilized in the
loop()function to control the water pump and LEDs based on proximity.