🔌 Circuit Connections
🎯 Lesson Objective
In this lesson, students will understand:
• How to connect the ESP32 to the L298N motor driver
• How to connect DC motors to the motor driver
• How the Bluetooth communication works internally in ESP32
• The importance of correct wiring in robotics systems
This lesson explains the hardware connections required to build the Bluetooth Control Car.
1️⃣ Understanding the Circuit
Before programming the robot, all hardware components must be connected properly.
In this project, the main components connected to the ESP32 are:
🧠 ESP32 microcontroller
⚙ L298N motor driver
🚗 DC motors
🔋 Battery pack
Bluetooth communication is handled internally by the ESP32’s built-in Bluetooth module, so no external Bluetooth module is required.
2️⃣ Motor Driver Connections
The L298N motor driver controls the two DC motors of the robot.
Motor Driver Input Pins
| L298N Pin | ESP32 Connection |
|---|---|
| IN1 | GPIO 26 |
| IN2 | GPIO 27 |
| IN3 | GPIO 14 |
| IN4 | GPIO 12 |
These pins control the direction of the motors.
The ESP32 sends HIGH and LOW signals to control motor movement.
3️⃣ Motor Connections
The DC motors are connected to the motor driver output terminals.
Motor Driver Output Connections
| Motor Driver Output | Motor |
|---|---|
| OUT1 | Left Motor Terminal 1 |
| OUT2 | Left Motor Terminal 2 |
| OUT3 | Right Motor Terminal 1 |
| OUT4 | Right Motor Terminal 2 |
These outputs supply power to the motors and control their rotation direction.
4️⃣ Motor Driver Power Connections
The motor driver requires an external power supply.
Power Wiring
| Motor Driver Pin | Connection |
|---|---|
| 12V | Battery Positive |
| GND | Battery Ground |
| 5V | Optional logic power |
The battery powers the motors, while the ESP32 sends control signals.
5️⃣ ESP32 Power Supply
The ESP32 can be powered using:
• USB cable connected to a computer
• External battery connected to the VIN pin
The ESP32 typically operates at 3.3V logic level, but the VIN pin allows higher voltage input.
6️⃣ Importance of Common Ground
All devices must share a common ground connection.
This means connecting together:
• ESP32 ground
• Motor driver ground
• Battery ground
A common ground ensures proper communication between the components.
7️⃣ Checking the Circuit Before Powering
Before turning on the robot, verify the following:
✔ Motor driver pins connected to ESP32 correctly
✔ Motors connected to correct output terminals
✔ Battery polarity correct
✔ All grounds connected together
✔ No loose wires
Incorrect wiring may prevent the robot from working or may damage components.
8️⃣ Circuit Working Overview
The circuit operates as follows:
1️⃣ The smartphone sends a command through Bluetooth.
2️⃣ The ESP32 receives the Bluetooth data.
3️⃣ The ESP32 processes the received command.
4️⃣ The ESP32 sends signals to the motor driver.
5️⃣ The motor driver powers the motors.
6️⃣ The robot moves according to the command.
This allows the robot to be controlled wirelessly using a smartphone.
🚀 What Happens Next
Now that the hardware connections are complete, the next step is to write the program that allows the robot to receive Bluetooth commands.