Course Content
Hands-On ESP32 Robotics: Build Smart Robots Step by Step

🧪 Testing and Feature Options

🎯 Lesson Objective

In this lesson, students will learn:

• How to test the Light Sensitive Robot
• How to verify that the LDR sensor is detecting light correctly
• How to confirm that the motors are working properly
• How to troubleshoot common problems
• Additional features that can improve the robot

This lesson focuses on testing the robot and improving its performance.


1️⃣ Checking the Hardware Setup

Before running the robot, it is important to check all hardware connections.

Verify the following:

✔ ESP32 is connected properly
✔ LDR sensor module wiring is correct
✔ Motor driver connections are correct
✔ Motors are connected to the correct terminals
✔ Battery polarity is correct
✔ All components share a common ground

Incorrect wiring is one of the most common reasons why robotics projects fail.

Always check the circuit before powering the system.


2️⃣ Uploading the Program

To start testing the robot:

1️⃣ Connect the ESP32 to the computer using a USB cable.
2️⃣ Open Arduino IDE.
3️⃣ Select the correct ESP32 board.
4️⃣ Select the correct COM port.
5️⃣ Upload the program to the ESP32.

Once the program is uploaded, the robot will start running automatically.


3️⃣ Testing the LDR Sensor

The first step is to verify that the LDR sensor is working properly.

Steps to test:

1️⃣ Open the Serial Monitor in Arduino IDE.
2️⃣ Set the baud rate to 9600.
3️⃣ Observe the light sensor values displayed.

Example output:

 
Light Value: 3200
Light Value: 3000
Light Value: 1500
Light Value: 900
 

Now perform the following test:

• Shine a flashlight or phone light on the LDR sensor.
• Cover the LDR sensor with your hand.

You should see the light values change.

This confirms that the LDR sensor is functioning correctly.


4️⃣ Testing the Motors

After verifying the sensor, the next step is to test the motors.

Steps:

1️⃣ Place the robot on a flat surface.
2️⃣ Shine a light toward the LDR sensor.
3️⃣ The robot should begin moving forward.
4️⃣ Remove the light or reduce the light intensity.
5️⃣ The robot should stop.

If the robot moves correctly, the system is working as expected.


5️⃣ Complete Robot Test

Once both the sensor and motors are working, test the full robot behavior.

Testing process:

1️⃣ Turn on the robot.
2️⃣ Move a light source near the LDR sensor.
3️⃣ The robot detects the light intensity.
4️⃣ The ESP32 processes the sensor value.
5️⃣ The motors activate and the robot moves.

This confirms that the Light Sensitive Robot is operating correctly.


6️⃣ Troubleshooting Common Problems

Students may encounter some common issues.

Problem: Robot not moving

Possible causes:

• Motor driver wiring incorrect
• Motors not connected properly
• Battery not supplying enough power

Solution:

Check motor driver connections and battery power.


Problem: Sensor value not changing

Possible causes:

• LDR sensor not connected properly
• Wrong analog pin used
• Sensor damaged

Solution:

Verify LDR wiring and confirm the analog pin connection.


Problem: Robot always moving

Possible cause:

The light threshold value in the code may not match the environment.

Solution:

Adjust the threshold value in the program.

Example:

 
if(lightValue < 1200)
 

Adjust this value depending on the lighting conditions.


7️⃣ Improving the Light Sensitive Robot

Once the basic robot works, several improvements can be added.

Possible improvements include:

💡 Adding two LDR sensors for better light direction detection
⚡ Using PWM to control motor speed
🔊 Adding a buzzer indicator when light is detected
💡 Adding LED indicators to show sensor activity

These improvements make the robot more advanced and interactive.


8️⃣ Real-World Applications

Light detection systems are widely used in modern technology.

Examples include:

💡 Automatic street lights
📷 Camera brightness sensors
🏠 Smart home lighting systems
🚗 Light-following robots

This project demonstrates how simple sensors can be used to build intelligent automation systems.


🚀 What Happens Next

Now that you have successfully built and tested the Light Sensitive Robot, the next project will introduce physical interaction with the environment.

Scroll to Top