Arduino UNO-Based Battery-Powered Robotic Vehicle with Ultrasonic Sensor and Servo Control
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an Arduino UNO microcontroller, an L298N DC motor driver, two motors with reducers, a 4 x AAA battery mount, a servo, and an HC-SR04 ultrasonic sensor. The circuit is designed to control the motors and servo, and to measure distance using the ultrasonic sensor. The Arduino UNO serves as the central controller, interfacing with all other components.
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
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver module.
- 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
Motor with Reducer
- Description: A DC motor with a gear reducer.
- Pins: 3 - 6 VCC, GND
4 x AAA Battery Mount
- Description: A battery holder for four AAA batteries.
- Pins: -, +
Servo
- Description: A servo motor for precise control of angular position.
- Pins: GND, VCC, PWM
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor.
- Pins: VCC, TRIG, ECHO, GND
Wiring Details
Arduino UNO
- 5V connected to VCC of Servo
- 5V connected to VCC of HC-SR04 Ultrasonic Sensor
- GND connected to GND of Servo
- GND connected to GND of HC-SR04 Ultrasonic Sensor
- GND connected to GND of L298N DC Motor Driver
- Vin connected to 5V of L298N DC Motor Driver
- D10 connected to TRIG of HC-SR04 Ultrasonic Sensor
- D9 connected to ECHO of HC-SR04 Ultrasonic Sensor
- D8 connected to PWM of Servo
- 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
L298N DC Motor Driver
- GND connected to - of 4 x AAA Battery Mount
- 5V connected to Vin of Arduino UNO
- IN4 connected to D7 of Arduino UNO
- IN3 connected to D6 of Arduino UNO
- IN2 connected to D5 of Arduino UNO
- IN1 connected to D4 of Arduino UNO
- OUT1 connected to 3 - 6 VCC of Motor with Reducer
- OUT2 connected to GND of Motor with Reducer
- OUT3 connected to 3 - 6 VCC of Motor with Reducer
- OUT4 connected to GND of Motor with Reducer
- 12V connected to + of 4 x AAA Battery Mount
Motor with Reducer
- 3 - 6 VCC connected to OUT1 of L298N DC Motor Driver
- GND connected to OUT2 of L298N DC Motor Driver
Motor with Reducer
- 3 - 6 VCC connected to OUT3 of L298N DC Motor Driver
- GND connected to OUT4 of L298N DC Motor Driver
4 x AAA Battery Mount
- - connected to GND of L298N DC Motor Driver
- + connected to 12V of L298N DC Motor Driver
Servo
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- PWM connected to D8 of Arduino UNO
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- TRIG connected to D10 of Arduino UNO
- ECHO connected to D9 of Arduino UNO
Code Documentation
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino UNO. The setup() function is where you initialize your components and settings, and it runs once when the program starts. The loop() function contains the main logic of your program and runs repeatedly.
This document provides a comprehensive overview of the circuit, including the components used, their wiring details, and the code for the Arduino UNO. This should serve as a useful reference for understanding and replicating the circuit.