This is an old revision of the document!
What it does The “Smart Bin” is an automated trash receptacle that opens its lid automatically when it detects a user's hand approach. Additionally, it continuously monitors the internal trash level, providing comprehensive feedback through an LCD display (showing the exact fill percentage and system status), an LED interface (Green, Yellow, Red for quick visual capacity indication), and an active buzzer (emitting an auditory warning while refusing to open if the bin is completely full).
The purpose of the project The main purpose is to create a hygienic, hands-free waste disposal experience while preventing the common issue of overfilling the bin.
The initial idea The idea stems from the everyday inconvenience of disposing of messy waste (e.g., while cooking) without dirtying the bin's lid. Furthermore, in shared spaces (offices, kitchens), bins often get overfilled because people don't realize the capacity is reached until they force the lid open. Combining motion-sensing opening with a precise, screen-based capacity-monitoring system solves both issues effectively.
Why it is useful This project is highly useful for improving hygiene and sanitation in environments like hospitals, kitchens, or public restrooms by eliminating cross-contamination. For the user, the addition of an LCD display provides clear, precise data regarding the bin's status and when it's time to empty the trash, ultimately promoting better waste management habits.
The system is built around a central microcontroller (AVR ATmega328p) which acts as the main processing unit, orchestrating the inputs and outputs through a non-blocking state machine design. The main loop evaluates sensor data every 500ms to ensure real-time responsiveness without overloading the processor.
Interaction Flow:
The system operates in three main states: CLOSED, OPEN, and COOLDOWN.
CLOSED state.To build this project, the following hardware components are used:
The project is currently in the advanced breadboard prototyping phase. All critical hardware subsystems (distance measurement, visual/auditory feedback, and PWM mechanical actuation) have been successfully wired, integrated, and validated against the microcontroller's logic. The finite state machine correctly drives the hardware inputs and outputs without blocking the CPU execution. The next planned step is the physical mechanical assembly onto the bin chassis and soldering the I2C backpack to the LCD module for the final interface integration.
The hardware pinout was carefully designed to map specific components to their required internal AVR hardware modules, while explicitly avoiding the SPI pins (PB2-PB5) to prevent programming (ISP) conflicts during development.
| Component | ATmega328P Pin | Signal Type | Technical Justification |
|---|---|---|---|
| Green LED | PD2 | Digital OUT | Standard GPIO for state indication. |
| Yellow LED | PD3 | Digital OUT | Standard GPIO for state indication. |
| Red LED | PD4 | Digital OUT | Standard GPIO for state indication. |
| Active Buzzer | PD5 | Digital OUT | Standard GPIO. Active buzzers require only a high DC voltage to emit sound. |
| Trig 0 (Exterior) | PC0 | Digital OUT | Moved to Port C to avoid SPI line interference during USB code flashing. |
| Echo 0 (Exterior) | PC1 | Digital IN | General input for reading the 10µs ultrasonic echo pulse length. |
| Trig 1 (Interior) | PC2 | Digital OUT | Mapped to Port C for grouping and clean breadboard wiring. |
| Echo 1 (Interior) | PC3 | Digital IN | Input for reading the interior trash level echo. |
| Servo Motor | PB1 (OC1A) | PWM OUT | Driven by the 16-bit Timer1 Output Compare register (OC1A) to ensure a highly stable and precise 50Hz PWM signal for servo angle control. |
| LCD I2C SDA | PC4 | I2C Data | Hardwired internal TWI (Two-Wire Interface) data line on the AVR. |
| LCD I2C SCL | PC5 | I2C Clock | Hardwired internal TWI (Two-Wire Interface) clock line on the AVR. |
The electrical circuit utilizes the breadboard's side power rails as a central power distribution bus.
The images below demonstrate the successful wiring and the functional proof of the hardware logic running on the microcontroller.
1. General Breadboard Prototyping Setup
Explanation: This image presents the complete hardware prototype. The components are wired using the power rails for optimal cable management. The HC-SR04 sensors, the servo, and the LED/Buzzer sub-circuit are successfully interfaced with the Xplained Mini board.
2. Proof of Functionality: The Interlocking Logic (Full Capacity)
Explanation: This test validates the interlocking safety state. An obstacle is placed physically close (< 7cm) to the interior ultrasonic sensor (simulating a trash capacity of > 85%). The microcontroller correctly processes the echo timing, updates the logic state, and physically turns on the Red LED. Simultaneously, the active buzzer is triggered on pin PD5, and the servo motor is software-locked, proving that the hardware responds accurately to environmental inputs.