ESP32 and L298N Motor Driver-Based Wi-Fi Controlled Robotic Car with Ultrasonic Sensor
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control two DC motors using an L298N motor driver, an ESP32 microcontroller, and various other components including an ultrasonic sensor, a servo motor, a rocker switch, and multiple Li-ion batteries. The ESP32 microcontroller is used to control the motor driver and read data from the ultrasonic sensor. The servo motor is also controlled by the ESP32. The rocker switch is used to control the power supply to the motor driver.
Component List
DC Motor
- Description: A standard DC motor.
- Pins: pin 1, pin 2
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows for 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
ESP32 38 PINS
- Description: A microcontroller with Wi-Fi and Bluetooth capabilities.
- Pins: GND, G23, G22, TXD, RXD, G21, G19, G18, G5, G17, G16, G4, G0, G2, G15, SDI, SD0, CLK, 3V3, EN, SP, SN, G34, G35, G32, 33, G25, G26, G27, G14, G12, G13, SD2, SD3, 5V
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic sensor used for distance measurement.
- Pins: VCC, TRIG, ECHO, GND
Tower Pro SG90 Servo
- Description: A small servo motor used for precise control of angular position.
- Pins: Signal, +5V, GND
Rocker Switch
- Description: A simple on/off switch.
- Pins: 1, 2
Li-ion Battery 18650-2000mAh 3.7V 7.4WH
- Description: A rechargeable lithium-ion battery.
- Pins: +, -
Wiring Details
DC Motor 1
- Pin 1 connected to L298N DC Motor Driver OUT4
- Pin 2 connected to L298N DC Motor Driver OUT3
DC Motor 2
- Pin 1 connected to L298N DC Motor Driver OUT1
- Pin 2 connected to L298N DC Motor Driver OUT2
L298N DC Motor Driver
- OUT4 connected to DC Motor 1 Pin 1
- OUT3 connected to DC Motor 1 Pin 2
- OUT1 connected to DC Motor 2 Pin 1
- OUT2 connected to DC Motor 2 Pin 2
- 12V connected to Rocker Switch Pin 1
- GND connected to:
- Li-ion Battery -
- Tower Pro SG90 Servo GND
- HC-SR04 Ultrasonic Sensor GND
- 5V connected to:
- Tower Pro SG90 Servo +5V
- ESP32 38 PINS 5V
- HC-SR04 Ultrasonic Sensor VCC
- ENA connected to ESP32 38 PINS G22
- IN1 connected to ESP32 38 PINS G5
- IN2 connected to ESP32 38 PINS G18
- IN3 connected to ESP32 38 PINS G19
- IN4 connected to ESP32 38 PINS G21
- ENB connected to ESP32 38 PINS G23
ESP32 38 PINS
- 5V connected to L298N DC Motor Driver 5V
- G22 connected to L298N DC Motor Driver ENA
- G5 connected to L298N DC Motor Driver IN1
- G18 connected to L298N DC Motor Driver IN2
- G19 connected to L298N DC Motor Driver IN3
- G21 connected to L298N DC Motor Driver IN4
- G23 connected to L298N DC Motor Driver ENB
- G27 connected to HC-SR04 Ultrasonic Sensor ECHO
- G14 connected to HC-SR04 Ultrasonic Sensor TRIG
- G13 connected to Tower Pro SG90 Servo Signal
HC-SR04 Ultrasonic Sensor
- VCC connected to L298N DC Motor Driver 5V
- TRIG connected to ESP32 38 PINS G14
- ECHO connected to ESP32 38 PINS G27
- GND connected to L298N DC Motor Driver GND
Tower Pro SG90 Servo
- Signal connected to ESP32 38 PINS G13
- +5V connected to L298N DC Motor Driver 5V
- GND connected to L298N DC Motor Driver GND
Rocker Switch
- Pin 1 connected to L298N DC Motor Driver 12V
- Pin 2 connected to Li-ion Battery +
Li-ion Battery 1
- + connected to Rocker Switch Pin 2
- - connected to Li-ion Battery 2 +
Li-ion Battery 2
- + connected to Li-ion Battery 1 -
- - connected to Li-ion Battery 3 +
Li-ion Battery 3
- + connected to Li-ion Battery 2 -
- - connected to L298N DC Motor Driver GND
Code
No code provided for this circuit.