ESP32 and MPU-6050 Controlled Dual DC Motor Robot with Encoders and L298N Driver
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes various components such as DC motors with encoders, an L298N DC motor driver, an MPU-6050 sensor, an ESP32 microcontroller, an XL4015 DC buck step-down converter, and a pair of 18650 Li-ion batteries. The circuit is designed to control DC motors using the ESP32 microcontroller, with feedback from the encoders and orientation data from the MPU-6050 sensor. The L298N motor driver is used to drive the motors, and the XL4015 step-down converter regulates the power supply from the batteries.
Component List
DC Motor with Encoder
- Pins: Encoder B, Encoder A, GND - Encoder, VCC - Encoder Power, Motor +ve, Motor -ve
- Description: A DC motor with an integrated encoder for feedback on motor position and speed.
L298N DC Motor Driver
- 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
- Description: A dual H-bridge motor driver that can control the speed and direction of two DC motors.
MPU-6050
- Pins: VCC, GND, SCL, SDA, XDA, XCL, AD0, INT
- Description: A 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer.
ESP32 38 PINS
- Pins: GND, 23, 22/SCL, 1, 2, 21/SDA, 19, 18, 5, 17/TX2, 16/RX2, 4, 0, 15, D1, D0, CLK, 3V3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, 13, D2, D3, 11, 5V/VIN
- Description: A powerful microcontroller with integrated Wi-Fi and Bluetooth capabilities.
XL4015 5A DC Buck Step-down
- Pins: Output +, Output -, Input +, Input -
- Description: A DC-DC buck converter that steps down voltage from a higher level to a lower level.
18650 Li-ion Battery x 2
- Pins: +, -
- Description: Rechargeable lithium-ion batteries commonly used in portable electronics.
Wiring Details
DC Motor with Encoder (Instance 1)
- Encoder B: Connected to ESP32 pin 27
- Encoder A: Connected to ESP32 pin 26
- GND - Encoder: Connected to L298N GND, XL4015 Output -, and DC Motor with Encoder (Instance 2) GND - Encoder
- VCC - Encoder Power: Connected to L298N 12V, XL4015 Output +, and DC Motor with Encoder (Instance 2) VCC - Encoder Power
- Motor +ve: Connected to L298N OUT1
- Motor -ve: Connected to L298N OUT2
DC Motor with Encoder (Instance 2)
- Encoder B: Connected to ESP32 pin 17/TX2
- Encoder A: Connected to ESP32 pin 16/RX2
- GND - Encoder: Connected to L298N GND, XL4015 Output -, and DC Motor with Encoder (Instance 1) GND - Encoder
- VCC - Encoder Power: Connected to L298N 12V, XL4015 Output +, and DC Motor with Encoder (Instance 1) VCC - Encoder Power
- Motor +ve: Connected to L298N OUT4
- Motor -ve: Connected to L298N OUT3
L298N DC Motor Driver
- IN3: Connected to ESP32 pin 19
- IN4: Connected to ESP32 pin 18
- ENB: Connected to ESP32 pin 5
- IN2: Connected to ESP32 pin 33
- IN1: Connected to ESP32 pin 25
- ENA: Connected to ESP32 pin 14
- OUT1: Connected to DC Motor with Encoder (Instance 1) Motor +ve
- OUT2: Connected to DC Motor with Encoder (Instance 1) Motor -ve
- OUT3: Connected to DC Motor with Encoder (Instance 2) Motor -ve
- OUT4: Connected to DC Motor with Encoder (Instance 2) Motor +ve
- 12V: Connected to XL4015 Output +, DC Motor with Encoder (Instance 1) VCC - Encoder Power, and DC Motor with Encoder (Instance 2) VCC - Encoder Power
- GND: Connected to XL4015 Output -, DC Motor with Encoder (Instance 1) GND - Encoder, and DC Motor with Encoder (Instance 2) GND - Encoder
MPU-6050
- GND: Connected to ESP32 GND
- SCL: Connected to ESP32 pin 22/SCL
- SDA: Connected to ESP32 pin 21/SDA
- VCC: Connected to ESP32 3V3
ESP32 38 PINS
- GND: Connected to MPU-6050 GND
- 22/SCL: Connected to MPU-6050 SCL
- 21/SDA: Connected to MPU-6050 SDA
- 19: Connected to L298N IN3
- 18: Connected to L298N IN4
- 5: Connected to L298N ENB
- 17/TX2: Connected to DC Motor with Encoder (Instance 2) Encoder B
- 16/RX2: Connected to DC Motor with Encoder (Instance 2) Encoder A
- 3V3: Connected to MPU-6050 VCC
- 33: Connected to L298N IN2
- 25: Connected to L298N IN1
- 26: Connected to DC Motor with Encoder (Instance 1) Encoder A
- 27: Connected to DC Motor with Encoder (Instance 1) Encoder B
- 14: Connected to L298N ENA
XL4015 5A DC Buck Step-down
- Output +: Connected to L298N 12V, DC Motor with Encoder (Instance 1) VCC - Encoder Power, and DC Motor with Encoder (Instance 2) VCC - Encoder Power
- Output -: Connected to L298N GND, DC Motor with Encoder (Instance 1) GND - Encoder, and DC Motor with Encoder (Instance 2) GND - Encoder
- Input +: Connected to 18650 Li-ion Battery + terminal
- Input -: Connected to 18650 Li-ion Battery - terminal
18650 Li-ion Battery x 2
- +: Connected to XL4015 Input +
- -: Connected to XL4015 Input -
Code
No code is provided for this circuit.
This document provides a comprehensive overview of the circuit, including a summary, component list, wiring details, and code section. Each component is described, and the wiring details are provided to ensure proper connections between components.