Arduino-Controlled Ultrasonic Sensor Array with Dual Motor Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to interface an Arduino UNO microcontroller with a pair of HC-SR04 Ultrasonic Sensors and two Hobby Gearmotors through an L298N DC motor driver. The system is powered by a Li-ion battery. The Arduino UNO is responsible for controlling the motors based on the input from the ultrasonic sensors, which are used for distance measurement.
Component List
Li-ion Battery, 2200 mAh 11.1 V
- Description: A rechargeable battery that provides the main power source for the circuit.
- Pins:
+(Positive),-(Negative)
Hobby Gearmotor with 48:1 Gearbox (2 units)
- Description: Electric motors with a gearbox used for driving the mechanical parts of the system.
- Pins:
pin 1,pin 2
HC-SR04 Ultrasonic Sensor (3 units)
- Description: Ultrasonic range-finding sensors that measure distance by emitting ultrasonic waves and measuring the time taken for the echo to return.
- Pins:
VCC,TRIG,ECHO,GND
Arduino UNO (2 units)
- Description: Microcontroller boards based on the ATmega328P, used for processing and controlling the logic of the circuit.
- Pins:
UNUSED,IOREF,Reset,3.3V,5V,GND,Vin,A0toA5,SCL,SDA,AREF,D0toD13
L298N DC Motor Driver
- Description: A motor driver module that allows the microcontroller to control the speed and direction of two DC motors.
- 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
Wiring Details
Li-ion Battery, 2200 mAh 11.1 V
+connected to L298N DC motor driver12V-connected to common ground net
Hobby Gearmotor with 48:1 Gearbox
pin 1connected to L298N DC motor driverOUT1orOUT4pin 2connected to L298N DC motor driverOUT2orOUT3
HC-SR04 Ultrasonic Sensor
VCCconnected to Arduino UNO5VTRIGconnected to Arduino UNO digital pins (D8,D10,D12)ECHOconnected to Arduino UNO digital pins (D9,D11,D13)GNDconnected to common ground net
Arduino UNO
GNDconnected to common ground net5Vconnected to HC-SR04VCCand L298N DC motor driver5V- Digital pins (
D1,D2,D3,D4,D5,D6,D8,D9,D10,D11,D12,D13) connected to L298N DC motor driver control pins (IN1,IN2,IN3,IN4,ENA,ENB) and HC-SR04TRIGandECHOpins
L298N DC Motor Driver
OUT1,OUT2,OUT3,OUT4connected to Hobby Gearmotor pins12Vconnected to Li-ion battery+GNDconnected to common ground net5Vconnected to Arduino UNO5V- Control pins (
ENA,ENB,IN1,IN2,IN3,IN4) connected to Arduino UNO digital pins
Documented Code
Arduino UNO (First Instance)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Arduino UNO (Second Instance)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code for both Arduino UNO instances is a template and does not contain any functional code specific to the operation of the circuit. The actual implementation should include initialization of the pins, setup of the motor driver, and logic for reading the ultrasonic sensors and controlling the motors accordingly.