Arduino UNO-Based Battery-Powered Robotic Vehicle with Ultrasonic and IR Sensors
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes various sensors, a motor driver, motors, a servo, and an Arduino UNO microcontroller. The circuit is designed to interface with multiple sensors and control motors and a servo. The Arduino UNO serves as the central microcontroller, coordinating the activities of the connected components.
Component List
HC-SR04 Ultrasonic Sensor
- Description: Ultrasonic distance sensor
- Pins: VCC, TRIG, ECHO, GND
IR Sensor (1)
- Description: Infrared sensor for object detection
- Pins: out, gnd, vcc
IR Sensor (2)
- Description: Infrared sensor for object detection
- Pins: out, gnd, vcc
L298N DC Motor Driver
- Description: Dual H-Bridge motor driver
- 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
Rocker Switch
- Description: On/Off switch
- Pins: output, input
Hobby Gearmotor with 48:1 Gearbox (1)
- Description: DC motor with gearbox
- Pins: pin 1, pin 2
Hobby Gearmotor with 48:1 Gearbox (2)
- Description: DC motor with gearbox
- Pins: pin 1, pin 2
Arduino UNO
- Description: 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
Servo (Wokwi Compatible)
- Description: Servo motor
- Pins: GND, V+, PWM
12V Battery (mini)
- Description: Power source
- Pins: -, +
Wiring Details
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V on Arduino UNO
- TRIG connected to D10 on Arduino UNO
- ECHO connected to D11 on Arduino UNO
- GND connected to GND on Arduino UNO
IR Sensor (1)
- out connected to A1 on Arduino UNO
- gnd connected to GND on Arduino UNO
- vcc connected to 5V on Arduino UNO
IR Sensor (2)
- out connected to A0 on Arduino UNO
- gnd connected to GND on Arduino UNO
- vcc connected to 5V on Arduino UNO
L298N DC Motor Driver
- GND connected to GND on Arduino UNO
- 12V connected to output on Rocker Switch
- OUT1 connected to pin 1 on Hobby Gearmotor (2)
- OUT2 connected to pin 2 on Hobby Gearmotor (2)
- OUT3 connected to pin 2 on Hobby Gearmotor (1)
- OUT4 connected to pin 1 on Hobby Gearmotor (1)
- ENA connected to D6 on Arduino UNO
- IN1 connected to D2 on Arduino UNO
- IN2 connected to D3 on Arduino UNO
- IN3 connected to D4 on Arduino UNO
- IN4 connected to D5 on Arduino UNO
- ENB connected to D7 on Arduino UNO
Rocker Switch
- input connected to 5V on Arduino UNO
- output connected to 12V on L298N DC Motor Driver
Hobby Gearmotor with 48:1 Gearbox (1)
- pin 1 connected to OUT4 on L298N DC Motor Driver
- pin 2 connected to OUT3 on L298N DC Motor Driver
Hobby Gearmotor with 48:1 Gearbox (2)
- pin 1 connected to OUT1 on L298N DC Motor Driver
- pin 2 connected to OUT2 on L298N DC Motor Driver
Arduino UNO
- GND connected to GND on L298N DC Motor Driver
- 5V connected to VCC on HC-SR04 Ultrasonic Sensor, input on Rocker Switch, vcc on IR Sensor (1), vcc on IR Sensor (2), V+ on Servo (Wokwi Compatible)
- D10 connected to TRIG on HC-SR04 Ultrasonic Sensor
- D11 connected to ECHO on HC-SR04 Ultrasonic Sensor
- A1 connected to out on IR Sensor (1)
- A0 connected to out on IR Sensor (2)
- D6 connected to ENA on L298N DC Motor Driver
- D2 connected to IN1 on L298N DC Motor Driver
- D3 connected to IN2 on L298N DC Motor Driver
- D4 connected to IN3 on L298N DC Motor Driver
- D5 connected to IN4 on L298N DC Motor Driver
- D7 connected to ENB on L298N DC Motor Driver
- D9 connected to PWM on Servo (Wokwi Compatible)
Servo (Wokwi Compatible)
- GND connected to GND on Arduino UNO
- V+ connected to 5V on Arduino UNO
- PWM connected to D9 on Arduino UNO
12V Battery (mini)
- - connected to GND on Arduino UNO
- + connected to 5V on Arduino UNO
Documented Code
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 the loop() function is where you place the code that needs to run continuously.