An Arduino-based prototype that uses a moisture sensor to classify waste as wet or dry. Based on the sensor reading, a servo motor rotates toward the corresponding waste-bin position.
The Smart Dustbin is an embedded-system prototype designed to demonstrate automatic wet and dry waste segregation.
A soil-moisture sensor measures the moisture level of the detected material. The Arduino compares the sensor reading with a configurable threshold and controls a servo motor:
- Dry waste position:
0° - Neutral position:
90° - Wet waste position:
180°
The servo remains in the selected position for two seconds before returning to neutral.
- Automatic wet and dry waste classification
- Analog moisture-level measurement
- Servo-controlled waste direction
- Real-time sensor readings through Serial Monitor
- Adjustable moisture threshold
- Low-cost and beginner-friendly Arduino design
- Included circuit diagram
| Component | Quantity | Purpose |
|---|---|---|
| Arduino UNO | 1 | Processes sensor data and controls the servo |
| Soil-moisture sensor | 1 | Measures the moisture level |
| SG90 servo motor | 1 | Directs waste toward the selected position |
| Breadboard | 1 | Provides temporary circuit connections |
| Jumper wires | As required | Connects the components |
| External 5V supply | Recommended | Provides stable power to the servo |
| USB cable | 1 | Uploads code and powers the Arduino |
| Sensor Pin | Arduino Pin |
|---|---|
| VCC | 5V |
| GND | GND |
| AO | A0 |
| Servo Wire | Connection |
|---|---|
| Signal | Digital pin 9 |
| VCC | 5V supply |
| GND | GND |
For reliable operation, power the servo from a suitable external 5V supply and connect the external supply ground to Arduino GND. Avoid powering a high-load servo directly from the Arduino 5V pin.
- Arduino IDE
- Arduino Servo library, included with Arduino IDE
SmartDustbin/
├── Circuit.png
├── SmartDustbin.ino
├── LICENSE
└── README.md
Clone the repository:
git clone https://github.com/Ankit-ku-panda/SmartDustbin.git
cd SmartDustbinIf the code file is named SmartDustbin.ino.txt, rename it:
Rename-Item SmartDustbin.ino.txt SmartDustbin.inomv SmartDustbin.ino.txt SmartDustbin.ino- Connect the Arduino UNO to your computer.
- Open
SmartDustbin.inoin Arduino IDE. - Select Tools → Board → Arduino AVR Boards → Arduino Uno.
- Select the correct port from Tools → Port.
- Click Verify.
- Click Upload.
- Open Tools → Serial Monitor.
- Set the baud rate to
9600.
- The moisture sensor sends an analog reading to Arduino pin
A0. - Arduino compares the reading with
dryThreshold. - When the reading is below the threshold, the program classifies the material as dry waste.
- When the reading is equal to or above the threshold, it classifies the material as wet waste.
- The servo moves to the appropriate position.
- After two seconds, the servo returns to the neutral position.
- The process repeats after a two-second delay.
The default threshold is:
int dryThreshold = 500;Sensor behavior varies depending on the sensor, material and environment. Calibrate it before regular use:
- Open Serial Monitor at
9600baud. - Record several readings from representative dry materials.
- Record several readings from representative wet materials.
- Select a threshold between the two ranges.
- Update
dryThresholdin the Arduino sketch. - Upload the code again and test it.
If your sensor produces higher readings for dry material and lower readings for wet material, reverse the comparison logic.
- A soil-moisture sensor alone cannot reliably identify every type of waste.
- Metal, glass, plastic and mixed materials may be classified incorrectly.
- Repeated sensor exposure to waste can cause contamination and corrosion.
- The current program continuously classifies the sensor reading every two seconds.
- The prototype uses one servo and three positions; the mechanical design must route waste appropriately.
- This is an educational prototype, not an industrial waste-management system.
- Add an ultrasonic sensor for touch-free lid activation
- Add bin-level monitoring
- Use separate servos for separate bin lids
- Add metal and proximity sensors
- Add an ESP32 or ESP8266 for IoT monitoring
- Send full-bin alerts to a mobile application
- Add an LCD or OLED status display
- Improve classification using multiple sensors
- Add a detection cooldown to prevent repeated servo movement
Use a separate regulated 5V supply for the servo and connect all grounds together.
Take multiple readings and use their average. Also check the sensor wiring and recalibrate the threshold.
Adjust dryThreshold or reverse the < comparison according to the behavior of your sensor.
Make sure the filename ends in .ino, not .ino.txt.
Contributions are welcome.
-
Fork the repository.
-
Create a branch:
git checkout -b feature/your-feature
-
Commit your changes:
git commit -m "Add your feature" -
Push the branch:
git push origin feature/your-feature
-
Open a pull request.
For bugs and suggestions, use the repository’s Issues page.
Ankit Kumar Panda
- GitHub: Ankit-ku-panda
- Repository: SmartDustbin
This project is distributed under the MIT License.
If this project helped you, consider giving the repository a star.
