Arduino-Controlled Ultrasonic Sensor with Bluetooth and Dual Motor Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary of the Circuit
This circuit is designed to interface an Arduino UNO with various peripherals including an HC-SR04 Ultrasonic Sensor, a Servomotor SG90, an L298N DC motor driver, two hobbyist yellow geared motors, and a Bluetooth HC-06 module. The circuit is powered by a 2 x AA Battery Mount. The Arduino UNO acts as the central controller, managing sensor inputs, motor control, and Bluetooth communication.
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
- An ultrasonic distance sensor that provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm.
Servomotor SG90
- A small and lightweight servo motor capable of precise control. It operates on 4.8V to 6V and offers good torque for its size.
L298N DC Motor Driver
- A dual H-bridge motor driver capable of driving two DC motors or one stepper motor. It can handle a current of up to 2A per channel.
Motor Amarillo Motorreductor Hobby (x2)
- Yellow hobbyist geared motors that are commonly used in robotics and small projects.
Bluetooth HC-06
- A Bluetooth module that allows for wireless communication between devices. It operates as a slave and can be connected to a variety of devices through its serial port.
2 x AA Battery Mount
- A battery holder for two AA batteries, providing a convenient power source for portable electronics.
Wiring Details
Arduino UNO
5Vconnected to HC-SR04 Ultrasonic SensorVCCGNDconnected to Servomotor SG90GND, HC-SR04 Ultrasonic SensorGND, and L298N DC Motor DriverGNDVinconnected to Servomotor SG90VCCand L298N DC Motor Driver5VA0connected to HC-SR04 Ultrasonic SensorTRIGA1connected to HC-SR04 Ultrasonic SensorECHOD11connected to L298N DC Motor DriverENAD8connected to L298N DC Motor DriverIN1D7connected to L298N DC Motor DriverIN2D5connected to L298N DC Motor DriverIN3D4connected to L298N DC Motor DriverIN4D3connected to L298N DC Motor DriverENBD2connected to Servomotor SG90SIG
HC-SR04 Ultrasonic Sensor
VCCconnected to Arduino UNO5VTRIGconnected to Arduino UNOA0ECHOconnected to Arduino UNOA1GNDconnected to Arduino UNOGND
Servomotor SG90
SIGconnected to Arduino UNOD2VCCconnected to Arduino UNOVinGNDconnected to Arduino UNOGND
L298N DC Motor Driver
OUT1connected to Motor Amarillo Motorreductor HobbyOUT2connected to Motor Amarillo Motorreductor Hobby12Vconnected to 2 x AA Battery Mount+GNDconnected to Arduino UNOGND5Vconnected to Arduino UNOVinOUT3connected to Motor Amarillo Motorreductor HobbyOUT4connected to Motor Amarillo Motorreductor HobbyENAconnected to Arduino UNOD11IN1connected to Arduino UNOD8IN2connected to Arduino UNOD7IN3connected to Arduino UNOD5IN4connected to Arduino UNOD4ENBconnected to Arduino UNOD3
Motor Amarillo Motorreductor Hobby
- One motor's
vccconnected to L298N DC Motor DriverOUT2,GNDtoOUT1 - Another motor's
vccconnected to L298N DC Motor DriverOUT4,GNDtoOUT3
2 x AA Battery Mount
+connected to L298N DC Motor Driver12V-connected to Arduino UNOGND, L298N DC Motor DriverGND
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 include specific functionality. It should be populated with the setup and loop code required to control the connected components based on the desired application.