🧪 Lesson 4.4 — Testing and Feature Options
🎯 Lesson Objective
In this lesson, students will learn:
• How to test the Smart Dustbin project
• How to verify that the ultrasonic sensor works correctly
• How to confirm that the servo motor opens and closes the lid properly
• How to troubleshoot common problems
• Additional features that can be added to improve the project
This lesson focuses on testing the system and improving the project functionality.
1️⃣ Testing the Hardware Setup
Before running the system, it is important to check all hardware connections.
Verify the following:
✔ ESP32 is connected properly
✔ Ultrasonic sensor pins are correctly wired
✔ Servo motor wires are correctly connected
✔ All components share a common GND connection
✔ No loose wires in the circuit
Incorrect wiring is one of the most common causes of system failure.
Always double-check the connections before powering the circuit.
2️⃣ Upload and Run the Program
To start testing the Smart Dustbin system:
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 upload is complete, the system will begin running automatically.
3️⃣ Testing the Ultrasonic Sensor
To verify that the ultrasonic sensor is working correctly:
1️⃣ Open the Serial Monitor in Arduino IDE.
2️⃣ Set the baud rate to 9600.
3️⃣ Move your hand in front of the sensor.
You should see distance values printed in the Serial Monitor.
Example output:
Distance: 45
Distance: 30
Distance: 18
Distance: 10
When the distance becomes less than 20 cm, the servo motor should activate.
This confirms that the sensor is detecting objects properly.
4️⃣ Testing the Servo Motor
After verifying the sensor, the next step is to test the servo motor.
Steps to test:
1️⃣ Move your hand close to the ultrasonic sensor.
2️⃣ The servo motor should rotate and open the dustbin lid.
3️⃣ After a few seconds, the servo motor should return to its original position.
If the servo motor moves correctly, the system is functioning as expected.
5️⃣ Complete System Test
Once both the sensor and servo motor are working, test the entire system.
Testing process:
1️⃣ Place your hand near the dustbin.
2️⃣ The ultrasonic sensor detects the hand.
3️⃣ The ESP32 calculates the distance.
4️⃣ The servo motor opens the lid automatically.
5️⃣ After a few seconds, the lid closes.
This confirms that the Smart Dustbin automation system is working properly.
6️⃣ Troubleshooting Common Problems
Students may encounter some issues while testing the project.
Here are some common problems and solutions.
Problem: Servo motor not moving
Possible causes:
• Servo signal wire connected to the wrong pin
• Servo motor not receiving power
• Servo library not included in the program
Solution:
Check the servo wiring and confirm the correct pin connection.
Problem: Sensor always shows incorrect distance
Possible causes:
• TRIG and ECHO pins swapped
• Loose connections
• Sensor not receiving power
Solution:
Verify the wiring of the ultrasonic sensor.
Problem: Lid opens randomly
Possible causes:
• Distance threshold too large
• Sensor detecting unwanted objects
Solution:
Adjust the distance condition in the program.
Example:
if (distance < 15)7️⃣ Improving the Smart Dustbin
Once the basic project works, additional features can be added.
Possible improvements include:
💡 Adding an LED indicator when the lid opens
🔊 Adding a buzzer sound when the dustbin activates
📊 Adding an LCD display to show distance values
🔋 Adding battery power for portable operation
These improvements make the project more interactive and advanced.
8️⃣ Real-World Applications
The Smart Dustbin project demonstrates how automation can improve everyday systems.
Similar technologies are used in:
🏥 Hospitals
🏫 Schools
🏢 Offices
🏠 Smart homes
Automation systems like this help reduce physical contact and improve hygiene.
🚀 What Happens Next
Now that you have successfully built and tested the Smart Dustbin project, the next step is to move to the next robotics system.