Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

ESP32-Controlled Quadruple DC Motor Driver with Ultrasonic Sensing

Image of ESP32-Controlled Quadruple DC Motor Driver with Ultrasonic Sensing

Circuit Documentation

Summary

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.

Component List

ESP32 Devkit V1

  • Microcontroller with WiFi and Bluetooth capabilities.
  • It has multiple digital I/O pins and analog inputs.
  • Utilized for controlling the motor drivers and reading sensor data.

L298N DC Motor Driver (x2)

  • A module capable of driving two DC motors.
  • It has pins for motor outputs, power supply, and control inputs.
  • Used to control the direction and speed of the connected DC motors.

HC-SR04 Ultrasonic Sensor

  • A sensor for measuring distances using ultrasonic waves.
  • It has pins for VCC, Trigger, Echo, and Ground.
  • Used to measure the distance to objects in front of the sensor.

DC Motor (x4)

  • A simple DC motor with two connection pins.
  • Used as the actuator in the circuit.

9V Battery

  • A standard 9V battery with positive and negative terminals.
  • Provides power to the circuit.

Wiring Details

ESP32 Devkit V1

  • 3V3 connected to HC-SR04 Ultrasonic Sensor VCC
  • GND connected to the ground of both L298N DC motor drivers and HC-SR04 Ultrasonic Sensor
  • D18 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 Battery

L298N DC Motor Driver (1st instance)

  • GND connected to ESP32 Devkit V1 GND and 9V Battery -
  • 12V connected to the positive terminal of the 9V Battery
  • OUT1 and OUT2 connected to the first DC Motor
  • OUT3 and OUT4 connected to the second DC Motor

L298N DC Motor Driver (2nd instance)

  • GND connected to ESP32 Devkit V1 GND and 9V Battery -
  • 12V connected to the positive terminal of the 9V Battery
  • OUT1 and OUT2 connected to the third DC Motor
  • OUT3 and OUT4 connected to the fourth DC Motor

HC-SR04 Ultrasonic Sensor

  • VCC 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

DC Motors

  • Each DC Motor has two pins connected to the corresponding outputs of the L298N DC motor drivers.

9V Battery

  • + 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

Documented Code

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.