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

ESP32 and L298N Motor Driver-Based Battery-Powered Robotic System with Encoders

Image of ESP32 and L298N Motor Driver-Based Battery-Powered Robotic System with Encoders

Circuit Documentation

Summary

This circuit is designed to control multiple DC motors with encoders using an ESP32 microcontroller. The motors are driven by L298N motor drivers, and the circuit is powered by a LiPo battery. Additionally, an MPU-6050 sensor is included for motion sensing. The ESP32 microcontroller interfaces with the motor drivers and the MPU-6050 sensor to control the motors and read sensor data.

Component List

  1. L298N DC Motor Driver

    • Description: Dual H-Bridge motor driver for controlling 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
  2. DC Motor with Encoder

    • Description: DC motor with an integrated encoder for precise control.
    • Pins: Encoder B, Encoder A, GND - Encoder, VCC - Encoder Power, Motor +ve, Motor -ve
  3. LiPo Battery

    • Description: Lithium Polymer battery for powering the circuit.
    • Pins: VCC, GND
  4. GND

    • Description: Ground connection.
    • Pins: GND
  5. ESP32 (30 pin)

    • Description: A powerful microcontroller with Wi-Fi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
  6. MPU-6050

    • Description: 6-axis motion tracking device.
    • Pins: VCC, GND, SCL, SDA, XDA, XCL, AD0, INT

Wiring Details

L298N DC Motor Driver

  • OUT1: Connected to Motor +ve of DC Motor with Encoder
  • OUT2: Connected to Motor -ve of DC Motor with Encoder
  • 12V: Connected to VCC of LiPo Battery
  • GND: Connected to GND of LiPo Battery and GND
  • OUT3: Connected to Motor +ve of another DC Motor with Encoder
  • OUT4: Connected to Motor -ve of another DC Motor with Encoder
  • ENA: Connected to D13 of ESP32
  • IN1: Connected to D12 of ESP32
  • IN2: Connected to D26 of ESP32
  • IN3: Connected to D32 of ESP32
  • IN4: Connected to D18 of ESP32
  • ENB: Connected to D27 of ESP32

DC Motor with Encoder

  • Motor +ve: Connected to OUT1 of L298N DC Motor Driver
  • Motor -ve: Connected to OUT2 of L298N DC Motor Driver
  • Encoder B: Connected to VP of ESP32
  • Encoder A: Connected to D5 of ESP32

LiPo Battery

  • VCC: Connected to 12V of L298N DC Motor Driver
  • GND: Connected to GND of L298N DC Motor Driver and ESP32

GND

  • GND: Connected to GND of LiPo Battery and L298N DC Motor Driver

ESP32 (30 pin)

  • D2: Not connected
  • GND: Connected to GND of LiPo Battery
  • D13: Connected to ENA of L298N DC Motor Driver
  • D12: Connected to IN1 of L298N DC Motor Driver
  • D26: Connected to IN2 of L298N DC Motor Driver
  • D32: Connected to IN3 of L298N DC Motor Driver
  • D18: Connected to IN4 of L298N DC Motor Driver
  • D27: Connected to ENB of L298N DC Motor Driver
  • VP: Connected to Encoder B of DC Motor with Encoder
  • D5: Connected to Encoder A of DC Motor with Encoder
  • D34: Connected to Encoder B of another DC Motor with Encoder
  • VN: Connected to Encoder A of another DC Motor with Encoder
  • D14: Connected to Encoder B of another DC Motor with Encoder
  • D35: Connected to Encoder A of another DC Motor with Encoder
  • D4: Connected to Encoder B of another DC Motor with Encoder
  • D15: Connected to Encoder A of another DC Motor with Encoder
  • D22: Connected to SCL of MPU-6050
  • D21: Connected to SDA of MPU-6050

MPU-6050

  • SCL: Connected to D22 of ESP32
  • SDA: Connected to D21 of ESP32

Code

No code provided.