Arduino UNO-Based Ultrasonic Sensor Water Pump Controller with 12V Relay and Battery Power
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller, a 12V relay, an ultrasonic sensor, a 5V mini water pump, and a 2x 18650 battery pack. The Arduino UNO controls the relay and the ultrasonic sensor, which in turn controls the water pump. The relay is powered by the Arduino and the battery pack, and it switches the water pump on and off based on signals from the Arduino.
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
12V Relay
- Description: A relay module that can be controlled by a microcontroller to switch high voltage devices.
- Pins: NO, COM, NC, IN, DC-, DC+
Ultrasonic Sensor
- Description: A sensor that measures distance by using ultrasonic waves.
- Pins: +VCC, Trigger, Echo, GND
2x 18650 Battery Pack
- Description: A battery pack consisting of two 18650 lithium-ion batteries.
- Pins: vcc, gnd
5V Mini Water Pump
- Description: A small water pump that operates on 5V.
- Pins: positive pin, negative pin
Wiring Details
Arduino UNO
- 5V: Connected to DC+ of the 12V Relay and +VCC of the Ultrasonic Sensor.
- GND: Connected to DC- of the 12V Relay and GND of the Ultrasonic Sensor.
- D10: Connected to Echo of the Ultrasonic Sensor.
- D9: Connected to Trigger of the Ultrasonic Sensor.
- D8: Connected to IN of the 12V Relay.
12V Relay
- DC+: Connected to 5V of the Arduino UNO.
- DC-: Connected to GND of the Arduino UNO.
- IN: Connected to D8 of the Arduino UNO.
- NO: Connected to gnd of the 2x 18650 Battery Pack.
- COM: Connected to negative pin of the 5V Mini Water Pump.
Ultrasonic Sensor
- +VCC: Connected to 5V of the Arduino UNO.
- GND: Connected to GND of the Arduino UNO.
- Echo: Connected to D10 of the Arduino UNO.
- Trigger: Connected to D9 of the Arduino UNO.
2x 18650 Battery Pack
- gnd: Connected to NO of the 12V Relay.
- vcc: Connected to positive pin of the 5V Mini Water Pump.
5V Mini Water Pump
- positive pin: Connected to vcc of the 2x 18650 Battery Pack.
- negative pin: Connected to COM of the 12V Relay.
Documented Code
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 where you initialize your components and the loop() function is where you place the code that needs to run continuously.
Additional Documentation
This section is reserved for any additional documentation or notes that may be required for understanding the circuit or the code.