Arduino UNO-Based Battery-Powered Robotic Car with Ultrasonic Sensor
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed to control a pair of DC gear motors using an L298N motor driver and an Arduino UNO. The circuit also includes an HC-SR04 ultrasonic sensor for distance measurement and two LEDs for visual indicators. The power supply is provided by a 9V battery.
Component List
Gearmotor DC Wheels Right
- Pins: PIN1, PIN2
- Description: A DC gear motor used for the right wheel of the robot.
Gearmotor DC Wheels Left
- Pins: PIN1, PIN2
- Description: A DC gear motor used for the left wheel of the robot.
L298N DC 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
- Description: A dual H-bridge motor driver used to control the DC gear motors.
Arduino UNO
- 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
- Description: A microcontroller board based on the ATmega328P.
HC-SR04 Ultrasonic Sensor
- Pins: VCC, TRIG, ECHO, GND
- Description: An ultrasonic sensor used for distance measurement.
Resistor (220 Ohms)
- Pins: pin1, pin2
- Description: A resistor with a resistance of 220 Ohms.
LED: Two Pin (Red)
- Pins: cathode, anode
- Description: A red LED used as a visual indicator.
LED: Two Pin (Green)
- Pins: cathode, anode
- Description: A green LED used as a visual indicator.
Battery 9V
- Pins: VCC, GND
- Description: A 9V battery used as the power supply for the circuit.
Wiring Details
Gearmotor DC Wheels Right
- PIN1 connected to OUT4 of L298N DC Motor Driver
- PIN2 connected to OUT3 of L298N DC Motor Driver
Gearmotor DC Wheels Left
- PIN1 connected to OUT2 of L298N DC Motor Driver
- PIN2 connected to OUT1 of L298N DC Motor Driver
L298N DC Motor Driver
- GND connected to:
- pin1 of Resistor
- GND of Arduino UNO
- GND of Battery 9V
- 12V connected to:
- Vin of Arduino UNO
- VCC of Battery 9V
- IN1 connected to D8 of Arduino UNO
- IN2 connected to D9 of Arduino UNO
- IN3 connected to D10 of Arduino UNO
- IN4 connected to D11 of Arduino UNO
- ENA connected to D5 of Arduino UNO
- ENB connected to D6 of Arduino UNO
Arduino UNO
- GND connected to:
- GND of HC-SR04 Ultrasonic Sensor
- GND of L298N DC Motor Driver
- pin1 of Resistor
- GND of Battery 9V
- 5V connected to VCC of HC-SR04 Ultrasonic Sensor
- Vin connected to 12V of L298N DC Motor Driver
- D3 connected to anode of LED: Two Pin (Green)
- D4 connected to anode of LED: Two Pin (Red)
- D5 connected to ENA of L298N DC Motor Driver
- D6 connected to ENB of L298N DC Motor Driver
- D7 connected to TRIG of HC-SR04 Ultrasonic Sensor
- D8 connected to IN1 of L298N DC Motor Driver
- D9 connected to IN2 of L298N DC Motor Driver
- D10 connected to IN3 of L298N DC Motor Driver
- D11 connected to IN4 of L298N DC Motor Driver
- D12 connected to ECHO of HC-SR04 Ultrasonic Sensor
HC-SR04 Ultrasonic Sensor
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- TRIG connected to D7 of Arduino UNO
- ECHO connected to D12 of Arduino UNO
Resistor (220 Ohms)
- pin1 connected to GND of L298N DC Motor Driver
- pin2 connected to cathode of LED: Two Pin (Red)
- pin1 connected to GND of L298N DC Motor Driver
- pin2 connected to cathode of LED: Two Pin (Green)
LED: Two Pin (Red)
- anode connected to D4 of Arduino UNO
- cathode connected to pin2 of Resistor
LED: Two Pin (Green)
- anode connected to D3 of Arduino UNO
- cathode connected to pin1 of Resistor
Battery 9V
- VCC connected to 12V of L298N DC Motor Driver
- GND connected to GND of L298N DC Motor Driver
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:
}
Documentation (documentation.txt)
This document provides a comprehensive overview of the circuit, including a summary, component list, wiring details, and documented code.