Arduino-Controlled Ultrasonic Sensor and Dual Motor Driver System
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates an Arduino UNO microcontroller with two HC-SR04 Ultrasonic Sensors and two yellow hobby gear motors. The motors are driven by an L298N DC motor driver, which is powered by a 12V battery. The ultrasonic sensors are used for distance measurement and are powered by the 5V output from the Arduino UNO. The ground connections are shared among the Arduino, sensors, motor driver, and battery to complete the circuit.
Component List
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor that uses sonar to determine the distance to an object.
- Pins: VCC, TRIG, ECHO, GND
Motor Amarillo Motorreductor Hobby
- Description: A yellow hobby gear motor used for driving wheels or other mechanical parts.
- Pins: vcc, GND
Arduino UNO
- Description: A microcontroller board based on the ATmega328P, widely used for prototyping and educational purposes.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0-A5, SCL, SDA, AREF, D0-D13
L298N DC Motor Driver
- Description: A dual H-bridge motor driver that can drive two DC motors or one stepper motor.
- 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
Battery 12V
- Description: A 12V battery providing the power source for the motor driver and, indirectly, the motors.
- Pins: +, -
Wiring Details
HC-SR04 Ultrasonic Sensor
- VCC connected to Arduino UNO 5V
- GND connected to Arduino UNO GND
- TRIG connected to Arduino UNO D5 (for one sensor) and D3 (for the other sensor)
- ECHO connected to Arduino UNO D4 (for one sensor) and D2 (for the other sensor)
Motor Amarillo Motorreductor Hobby
- vcc connected to L298N DC motor driver OUT2 and OUT4 (one motor to each output)
- GND connected to L298N DC motor driver OUT1 and OUT3 (one motor to each output)
Arduino UNO
- 5V used to power HC-SR04 Ultrasonic Sensors
- GND shared with HC-SR04 Ultrasonic Sensors and L298N DC motor driver
- Vin connected to L298N DC motor driver 5V
- D8-D11 used to control L298N DC motor driver inputs (IN1-IN4)
- D2-D5 used to interface with HC-SR04 Ultrasonic Sensors (TRIG and ECHO pins)
L298N DC Motor Driver
- GND connected to Arduino UNO GND and Battery 12V -
- 5V connected to Arduino UNO Vin
- IN1-IN4 controlled by Arduino UNO D8-D11
- OUT1-OUT4 connected to the yellow hobby gear motors
- 12V connected to Battery 12V +
Battery 12V
-
- connected to L298N DC motor driver 12V
-
- shared with L298N DC motor driver GND
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:
}
Note: The provided code is a template and does not contain any functional code to operate the circuit. The user must implement the setup and loop functions to control the motors and read the sensors.