🧪Testing and Feature Options
🎯 Lesson Objective
In this lesson, students will learn:
• How to test the Obstacle Avoiding Robot
• How to verify that the ultrasonic sensor is measuring distance correctly
• How to check robot movement and turning behavior
• 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 powered correctly
✔ Ultrasonic sensor pins are connected correctly
✔ 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 the most common reason why robotics projects fail.
Always verify the circuit before powering the robot.
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.
Once the program is uploaded successfully, the robot will begin operating.
3️⃣ Testing the Ultrasonic Sensor
The first step is to verify that the ultrasonic sensor is working properly.
Steps to test:
1️⃣ Open the Serial Monitor in Arduino IDE.
2️⃣ Set the baud rate to 9600.
3️⃣ Place an object in front of the ultrasonic sensor.
Example output:
Distance: 45
Distance: 25
Distance: 12
Now perform the following test:
• Move your hand closer to the sensor.
• Move your hand farther away.
You should see the distance values change in real time.
If the values change correctly, the ultrasonic sensor is working properly.
4️⃣ Testing Robot Movement
After verifying the sensor, test the robot movement.
Steps:
1️⃣ Place the robot on a flat surface.
2️⃣ Turn on the robot power supply.
3️⃣ The robot should start moving forward.
4️⃣ Place an object in front of the robot.
Expected behavior:
➡ Robot detects the obstacle.
➡ Robot moves backward.
➡ Robot turns left.
➡ Robot continues moving forward.
If the robot behaves like this, the system is working correctly.
5️⃣ Complete Robot Test
Now test the robot in a real environment.
Testing process:
1️⃣ Place the robot on the floor.
2️⃣ Allow the robot to move forward.
3️⃣ Place obstacles in its path.
4️⃣ The ultrasonic sensor will detect the obstacle.
5️⃣ The robot will change direction automatically.
This confirms that the Obstacle Avoiding Robot is functioning correctly.
6️⃣ Troubleshooting Common Problems
Students may encounter some common problems while testing.
Problem: Ultrasonic sensor not detecting objects
Possible causes:
• TRIG and ECHO pins connected incorrectly
• Sensor not receiving power
• Wrong pin numbers in the program
Solution:
Verify the wiring and check the pin numbers in the code.
Problem: Robot not moving
Possible causes:
• Motor driver wiring incorrect
• Battery not supplying enough power
• Motors not connected properly
Solution:
Check motor driver connections and battery power.
Problem: Robot always turning
Possible cause:
Distance threshold value may be too large.
Solution:
Adjust the threshold value in the program.
Example:
7️⃣ Improving the Obstacle Avoiding Robot
Once the basic robot works, several improvements can be added.
Possible improvements include:
💡 Adding a servo motor to rotate the ultrasonic sensor
📊 Adding an LCD display to show distance values
⚡ Adding PWM speed control for motors
🤖 Using multiple ultrasonic sensors for better detection
These improvements make the robot more intelligent and advanced.
8️⃣ Real-World Applications
Obstacle detection technology is widely used in modern robotics.
Examples include:
🚗 Car parking sensors
🤖 Robot vacuum cleaners
🏭 Industrial robots
📦 Warehouse automation robots
These systems use sensors to detect objects and avoid collisions.
🚀 What Happens Next
Now that you have successfully built and tested the Obstacle Avoiding Robot, the next project will introduce remote control robotics.