Smart-Dustbin Module
Smart-Dustbin Module
using Arduino
Circuit Board
Connect signals to
sensors / digital pins
Read analog
sensor
Wire Connection
Ultra-sonic Sensor:
VCC to 5V
GND to GND
Trig to Pin 5
Echo to Pin 6
Servo Motor:
VCC to 5V
GND to GND
Signal to Pin 7
Code Explaination
Introduction
This function opens the dustbin's cap by rotating the servo motor.
It attaches the servo, sets the angle to open the cap, waits for a
moment, then closes the cap slightly.
Loop Function
This function continuously
loops.
It takes multiple distance
readings, averages them, and
checks if the average distance
is less than the minimum
distance.
If the condition is met, it opens
the cap.
It also prints the average
distance to the serial monitor
for debugging purposes.
Happy Coding!