🔌Circuit Connections
🎯 Lesson Objective
In this lesson, students will understand:
• How to connect the components for the Light Sensitive Robot
• How the LDR sensor is connected to the ESP32
• How the L298N motor driver is connected to the ESP32
• How DC motors are connected to the motor driver
• The importance of proper wiring in robotics systems
This lesson explains the hardware connections required to build the Light Sensitive Robot.
1️⃣ Understanding the Circuit
Before writing the program, all hardware components must be connected correctly.
In this project, the main components connected to the ESP32 are:
🧠 ESP32 microcontroller
💡 LDR sensor module
⚙ L298N motor driver
🚗 DC motors
Each component must be connected to the correct power pins and GPIO pins.
Correct wiring ensures that the ESP32 can read sensor values and control the motors properly.
2️⃣ LDR Sensor Connections
The LDR sensor module detects light intensity and sends an analog signal to the ESP32.
LDR Sensor Pin Connections
| LDR Module Pin | ESP32 Connection |
|---|---|
| VCC | 3.3V |
| GND | GND |
| AO | GPIO 34 |
Connection Explanation
🔴 VCC supplies power to the sensor.
⚫ GND connects the sensor to the ground of the circuit.
🟡 AO (Analog Output) sends the light intensity signal to the ESP32.
The ESP32 reads this value using the analogRead() function.
3️⃣ L298N Motor Driver Connections
The L298N motor driver controls the two DC motors of the robot.
Motor Driver Pin Connections to ESP32
| L298N Pin | ESP32 Connection |
|---|---|
| IN1 | GPIO 26 |
| IN2 | GPIO 27 |
| IN3 | GPIO 14 |
| IN4 | GPIO 12 |
Connection Explanation
These pins control the direction of the motors.
By sending HIGH or LOW signals to these pins, the ESP32 controls the robot movement.
4️⃣ Motor Connections
The DC motors are connected to the output terminals of the motor driver.
Motor Driver Output Connections
| Motor Driver Output | Motor Connection |
|---|---|
| OUT1 | Left Motor Terminal 1 |
| OUT2 | Left Motor Terminal 2 |
| OUT3 | Right Motor Terminal 1 |
| OUT4 | Right Motor Terminal 2 |
These outputs deliver power to the motors and control their rotation direction.
5️⃣ Motor Driver Power Connections
The motor driver requires a separate power supply to operate the motors.
Power Connections
| Motor Driver Pin | Connection |
|---|---|
| 12V | Battery Positive |
| GND | Battery Ground |
| 5V | Optional logic power |
The battery supplies power for the motors.
The ESP32 only provides control signals, not motor power.
6️⃣ Importance of Common Ground
All devices in the system must share a common ground connection.
This means:
• ESP32 ground
• Motor driver ground
• Sensor ground
• Battery ground
All must be connected together.
A common ground ensures proper communication between all components.
7️⃣ Checking the Circuit Before Powering
Before turning on the system, check the following:
✔ Sensor connections are correct
✔ Motor driver pins are connected properly
✔ Motors are connected to the correct output terminals
✔ Battery polarity is correct
✔ No loose wires
Incorrect wiring may prevent the robot from functioning or may damage components.
8️⃣ Circuit Working Overview
The complete circuit operates as follows:
1️⃣ The LDR sensor detects light intensity.
2️⃣ The sensor sends an analog signal to the ESP32.
3️⃣ The ESP32 processes the sensor value.
4️⃣ Based on the light level, the ESP32 sends signals to the motor driver.
5️⃣ The motor driver controls the motors.
6️⃣ The robot moves according to the detected light.
This circuit allows the robot to respond automatically to light conditions.
🚀 What Happens Next
Now that the hardware connections are completed, the next step is to write the program that controls the Light Sensitive Robot.