Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Controlled Robotic Vehicle with Ultrasonic Distance Sensing and Motor Encoder Feedback

View and Edit Project In Cirkit DesignerImage of ESP32-Controlled Robotic Vehicle with Ultrasonic Distance Sensing and Motor Encoder Feedback

Circuit Documentation

Summary

The circuit in question is designed to control a DC motor with an encoder using an ESP32 microcontroller and a motor driver. It also includes three HC-SR04 ultrasonic distance sensors for distance measurement. The system is powered by a Lithium-ion battery. The ESP32 microcontroller interfaces with the motor driver to control the motor's speed and direction, reads the encoder signals to determine the motor's position, and triggers the ultrasonic sensors to measure distances.

Component List

ESP32 (30 pin)

Motor Driver

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

DC Motor with Encoder

Lithium-ion Battery 10000mah

Wiring Details

ESP32 (30 pin)

Motor Driver

HC-SR04 Ultrasonic Distance Sensor (Wokwi Compatible)

DC Motor with Encoder

Lithium-ion Battery 10000mah

Documented Code

// Code for ESP32 (30 pin)
void setup() {
  // Define pin modes for the ultrasonic sensors
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  // Define pin modes for the motor driver
  pinMode(MOTOR_DRIVER_PIN1, OUTPUT);
  pinMode(MOTOR_DRIVER_PIN2, OUTPUT);
  pinMode(MOTOR_DRIVER_PIN7, OUTPUT);
  pinMode(MOTOR_DRIVER_PIN8, OUTPUT);
  // Define pin modes for the encoder
  pinMode(ENCODER_A_PIN, INPUT);
  pinMode(ENCODER_B_PIN, INPUT);
}

void loop() {
  // Main code to control the motor and read sensors
}

This code snippet is a basic setup for the ESP32 microcontroller. It defines the pin modes for the ultrasonic sensors, motor driver, and encoder. The loop function is left empty as the implementation details for controlling the motor and reading from the sensors are not provided.