Arduino-Controlled Ultrasonic Sensor Array with Motor Actuation
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates an Arduino UNO microcontroller with multiple HC-SR04 Ultrasonic Sensors and a L298N DC motor driver to control four hobby motors. The circuit is powered through a 2.1mm Barrel Jack with Terminal Block, and a Tantalum Capacitor is used for voltage smoothing. The Arduino UNO manages sensor inputs and motor control outputs, interfacing with the ultrasonic sensors and the motor driver.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button.
HC-SR04 Ultrasonic Sensor (x3)
- Ultrasonic distance sensor
- Provides 2cm to 400cm non-contact measurement functionality with a ranging accuracy that can reach up to 3mm.
L298N DC Motor Driver
- Dual H-Bridge motor driver
- Used to drive two DC motors or a stepper motor.
2.1mm Barrel Jack with Terminal Block
- Power connector
- Used to supply power to the circuit.
Motor Amarillo Motorreductor Hobby (x4)
- Yellow hobby gear motor
- Typically used for driving wheels or other rotating parts.
Tantalum Capacitor
- Capacitance: 1 µF (microfarads)
- Used for voltage smoothing or as a filter.
Wiring Details
Arduino UNO
5Vconnected to VCC of all HC-SR04 Ultrasonic SensorsGNDconnected to GND of all HC-SR04 Ultrasonic Sensors, GND of L298N DC Motor Driver, and negative side of Tantalum CapacitorVinconnected to 5V of L298N DC Motor DriverD11connected to IN4 of L298N DC Motor DriverD10connected to IN3 of L298N DC Motor DriverD9connected to IN2 of L298N DC Motor DriverD8connected to IN1 of L298N DC Motor DriverD7connected to ECHO of the third HC-SR04 Ultrasonic SensorD6connected to TRIG of the third HC-SR04 Ultrasonic SensorD5connected to ECHO of the second HC-SR04 Ultrasonic SensorD4connected to TRIG of the second HC-SR04 Ultrasonic SensorD3connected to ECHO of the first HC-SR04 Ultrasonic SensorD2connected to TRIG of the first HC-SR04 Ultrasonic Sensor
HC-SR04 Ultrasonic Sensors
VCCconnected to 5V of Arduino UNOGNDconnected to GND of Arduino UNOECHOandTRIGconnected to respective digital pins on Arduino UNO
L298N DC Motor Driver
GNDconnected to GND of Arduino UNO and negative side of Tantalum Capacitor5Vconnected to Vin of Arduino UNOIN1toIN4connected to respective digital pins on Arduino UNOOUT1toOUT4connected to respective motors
Motors Amarillo Motorreductor Hobby
- Each motor has one terminal connected to an OUT pin on the L298N and the other terminal connected to the corresponding OUT pin for reverse polarity.
Tantalum Capacitor
- Positive side connected to 12V of L298N DC Motor Driver and POS of 2.1mm Barrel Jack with Terminal Block
- Negative side connected to GND of Arduino UNO and GND of L298N DC Motor Driver
2.1mm Barrel Jack with Terminal Block
POSconnected to positive side of Tantalum Capacitor and 12V of L298N DC Motor DriverNEGconnected to negative side of Tantalum Capacitor
Documented Code
Arduino UNO - 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 include specific functionality. It should be populated with setup configurations for the pins and the main logic for controlling the motors and reading the ultrasonic sensors.