Arduino UNO-Based Battery-Powered Ultrasonic Sensor and Motor Control System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO microcontroller, an HC-SR04 Ultrasonic Sensor, a motor driver (L298N), two hobby motors, a rocker switch, and two 9V batteries. The Arduino UNO is used to control the motors and read data from the ultrasonic sensor. The motor driver is used to control the direction and speed of the motors. The rocker switch is used to control the power supply to the motor driver.
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
9V Battery
- Description: A standard 9V battery used to power the circuit.
- Pins: -, +
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic sensor used for distance measurement.
- Pins: VCC, TRIG, ECHO, GND
Motor amarillo motorreductor hobby
- Description: A hobby motor with a gearbox.
- Pins: vcc, GND
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
Rocker Switch
- Description: A simple on/off switch.
- Pins: 1, 2
Wiring Details
Arduino UNO
- 5V connected to VCC of HC-SR04 Ultrasonic Sensor
- GND connected to GND of HC-SR04 Ultrasonic Sensor, GND of L298N DC motor driver, and - of 9V Battery
- Vin connected to 5V of L298N DC motor driver
- D10 connected to ECHO of HC-SR04 Ultrasonic Sensor
- D9 connected to TRIG of HC-SR04 Ultrasonic Sensor
- D7 connected to IN4 of L298N DC motor driver
- D6 connected to IN3 of L298N DC motor driver
- D5 connected to IN2 of L298N DC motor driver
- D4 connected to IN1 of L298N DC motor driver
9V Battery
- + connected to - of the second 9V Battery
- - connected to GND of Arduino UNO and GND of L298N DC motor driver
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- ECHO connected to D10 of Arduino UNO
- TRIG connected to D9 of Arduino UNO
Motor amarillo motorreductor hobby
- GND connected to OUT1 of L298N DC motor driver
- vcc connected to OUT2 of L298N DC motor driver
L298N DC motor driver
- GND connected to GND of Arduino UNO and - of 9V Battery
- 5V connected to Vin of Arduino UNO
- IN1 connected to D4 of Arduino UNO
- IN2 connected to D5 of Arduino UNO
- IN3 connected to D6 of Arduino UNO
- IN4 connected to D7 of Arduino UNO
- OUT1 connected to GND of Motor amarillo motorreductor hobby
- OUT2 connected to vcc of Motor amarillo motorreductor hobby
- OUT3 connected to GND of second Motor amarillo motorreductor hobby
- OUT4 connected to vcc of second Motor amarillo motorreductor hobby
- 12V connected to 2 of Rocker Switch
Rocker Switch
- 1 connected to + of the second 9V Battery
- 2 connected to 12V of L298N DC motor driver
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Additional Documentation (documentation.txt)