This circuit is designed to control multiple DC motors using ESP32 Devkit V1 microcontroller and L298N DC motor drivers. It also includes an HC-SR04 Ultrasonic Sensor for distance measurement. The ESP32 microcontroller interfaces with the motor drivers to control the direction and speed of the motors and reads the distance from the ultrasonic sensor. The circuit is powered by a 9V battery, which supplies power to the motor drivers and the microcontroller.
3V3
connected to HC-SR04 Ultrasonic Sensor VCC
GND
connected to the ground of both L298N DC motor drivers and HC-SR04 Ultrasonic SensorD18
connected to L298N DC motor driver ENB
D19
connected to L298N DC motor driver IN4
D21
connected to L298N DC motor driver IN3
RX0
connected to L298N DC motor driver IN2
TX0
connected to L298N DC motor driver IN1
D22
connected to L298N DC motor driver ENA
D34
connected to the second L298N DC motor driver ENA
D35
connected to the second L298N DC motor driver IN1
D32
connected to the second L298N DC motor driver IN2
D33
connected to the second L298N DC motor driver IN3
D25
connected to the second L298N DC motor driver IN4
D26
connected to the second L298N DC motor driver ENB
D12
connected to HC-SR04 Ultrasonic Sensor TRIG
D13
connected to HC-SR04 Ultrasonic Sensor ECHO
VIN
connected to the positive terminal of the 9V BatteryGND
connected to ESP32 Devkit V1 GND
and 9V Battery -
12V
connected to the positive terminal of the 9V BatteryOUT1
and OUT2
connected to the first DC MotorOUT3
and OUT4
connected to the second DC MotorGND
connected to ESP32 Devkit V1 GND
and 9V Battery -
12V
connected to the positive terminal of the 9V BatteryOUT1
and OUT2
connected to the third DC MotorOUT3
and OUT4
connected to the fourth DC MotorVCC
connected to ESP32 Devkit V1 3V3
TRIG
connected to ESP32 Devkit V1 D12
ECHO
connected to ESP32 Devkit V1 D13
GND
connected to ESP32 Devkit V1 GND
+
connected to the 12V
input of both L298N DC motor drivers and ESP32 Devkit V1 VIN
-
connected to the ground of both L298N DC motor drivers and ESP32 Devkit V1 GND
There is no code provided for the microcontroller. The code would typically initialize the GPIO pins for motor control and ultrasonic sensor interfacing, set up PWM for speed control, and include routines to read the sensor and control the motors based on the sensor input.