Arduino UNO-Based Battery-Powered Robotic Car with Ultrasonic Sensor and Motor Driver
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, an HC-SR04 Ultrasonic Sensor, two motors with reducers, a 18650 Li-Ion battery, and a toggle switch. The circuit is designed to control the motors based on input from the ultrasonic sensor, with power supplied by the Li-Ion battery and controlled via the toggle switch.
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 that allows control of two DC motors.
- 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
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic distance sensor used for measuring distances.
- Pins: VCC, TRIG, ECHO, GND
Motor with Reducer
- Description: A DC motor with a gear reducer.
- Pins: 3 - 6 VCC, GND
18650 Li-Ion Battery
- Description: A rechargeable lithium-ion battery.
- Pins: Positive, Negative
Toggle Switch
- Description: A switch used to control the power supply.
- Pins: Vcc, Sig, Gnd
Wiring Details
Arduino UNO
- 5V: Connected to 5V of L298N DC motor driver and VCC of HC-SR04 Ultrasonic Sensor
- GND: Connected to GND of L298N DC motor driver, GND of HC-SR04 Ultrasonic Sensor, and Negative of 18650 Li-Ion battery
- D9: Connected to TRIG of HC-SR04 Ultrasonic Sensor
- D8: Connected to ECHO of HC-SR04 Ultrasonic Sensor
- D7: Connected to ENB of L298N DC motor driver
- D6: Connected to ENA of L298N DC motor driver
- D5: Connected to IN4 of L298N DC motor driver
- D4: Connected to IN3 of L298N DC motor driver
- D3: Connected to IN2 of L298N DC motor driver
- D2: Connected to IN1 of L298N DC motor driver
L298N DC Motor Driver
- 5V: Connected to 5V of Arduino UNO
- GND: Connected to GND of Arduino UNO, GND of HC-SR04 Ultrasonic Sensor, and Negative of 18650 Li-Ion battery
- ENB: Connected to D7 of Arduino UNO
- ENA: Connected to D6 of Arduino UNO
- IN4: Connected to D5 of Arduino UNO
- IN3: Connected to D4 of Arduino UNO
- IN2: Connected to D3 of Arduino UNO
- IN1: Connected to D2 of Arduino UNO
- OUT1: Connected to GND of Motor with reducer
- OUT2: Connected to 3 - 6 VCC of Motor with reducer
- OUT3: Connected to GND of Motor with reducer
- OUT4: Connected to 3 - 6 VCC of Motor with reducer
- 12V: Connected to Vcc of Toggle Switch
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V of Arduino UNO and 5V of L298N DC motor driver
- GND: Connected to GND of Arduino UNO, GND of L298N DC motor driver, and Negative of 18650 Li-Ion battery
- TRIG: Connected to D9 of Arduino UNO
- ECHO: Connected to D8 of Arduino UNO
Motor with Reducer
- 3 - 6 VCC: Connected to OUT2 of L298N DC motor driver
- GND: Connected to OUT1 of L298N DC motor driver
Motor with Reducer
- 3 - 6 VCC: Connected to OUT4 of L298N DC motor driver
- GND: Connected to OUT3 of L298N DC motor driver
18650 Li-Ion Battery
- Positive: Connected to Sig of Toggle Switch
- Negative: Connected to GND of Arduino UNO, GND of L298N DC motor driver, and GND of HC-SR04 Ultrasonic Sensor
Toggle Switch
- Vcc: Connected to 12V of L298N DC motor driver
- Sig: Connected to Positive of 18650 Li-Ion battery
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 variables, pin modes, start using libraries, etc. The loop() function runs over and over again, allowing your program to change and respond.
Additional Documentation
This section is reserved for any additional documentation or notes related to the code or circuit.