Welcome to

IoT Smart Bin

Year2 Group Project!

The Smart Bin Project represents a intelligent approach to waste management, combining sophisticated technology with practical functionality to create an intelligent system designed for efficiency, safety, and convenience. At the heart of our project are two core components: an Arduino-based controller and an ESP32 module, each playing a crucial role in the system's operation.

Intelligent Waste Management

Our Smart Bin is not just any bin. It's an advanced system that leverages ultrasonic sensing, servo motor control, gas detection, and more to create a seamless waste disposal experience. With the ability to detect human presence, automatically open and close the lid, and monitor for potential fire hazards, the Smart Bin ensures a clean, safe, and efficient environment for disposing of waste.

Enhanced Safety Features

Safety is a paramount concern in waste management, and the Smart Bin is equipped to handle potential risks. Utilizing an MQ2 gas sensor, the system can detect smoke and trigger an alarm, alerting users to the danger of a fire. This feature is supported by a state-of-the-art communication protocol that allows for real-time data exchange and threshold adjustments, ensuring the system is always operating safely.

Connectivity and Remote Monitoring

The ESP32 module brings the Smart Bin into the digital age with Wi-Fi management, capacity monitoring, and email notifications. Through integration with the Blynk platform, users can remotely monitor the bin's status, receive alerts, and even adjust settings from anywhere in the world. This level of connectivity ensures that the Smart Bin is not just smart in name but also in function.

Collaboration and Integration

The synergy between the Arduino and ESP32 modules is what sets the Smart Bin apart. Through UART communication, these two components work together seamlessly, allowing for sophisticated control and monitoring capabilities. Whether it's adjusting gas detection thresholds or managing fire alerts, the Smart Bin is a testament to the power of collaboration and integration in modern technology.

Welcome to Our Story

Our Mission

Our mission with the Smart Bin Project is to revolutionize waste management by integrating technology into everyday life. We aim to provide a solution that is not only environmentally friendly but also user-friendly, ensuring that managing waste is no longer a chore but a convenient and safe part of daily life.

Join us in embracing the future of waste management and discover how the Smart Bin can make a difference in your home, office, or community.

Week One Progress Blog:

Laying the Foundation for the Smart Bin Project

This week marked the exciting kickoff of our Smart Bin project, a pioneering venture into the realm of intelligent waste management systems. The essence of this project lies in its innovative approach to managing waste more efficiently and sustainably, leveraging advanced technology to monitor trash levels, detect potential fires, and facilitate remote configurations. As we embarked on this journey, our team engaged in comprehensive discussions to outline the main functionalities and development methodologies of the project. This initial phase was crucial for setting the direction and ensuring a unified vision among our team members.

Defining Core Functionalities


Our brainstorming sessions culminated in the identification of the project's cornerstone features. We decided that the Smart Bin would not only manage waste but also incorporate safety measures against potential fire hazards. The functionalities we aim to integrate include bin lid automation for ease of access, human presence detection to optimize operation, and fire detection for enhanced safety. Additionally, the capacity to exchange data with external devices was deemed essential for user-customizable settings and remote monitoring.

Development Approach and Component Selection


  • Arduino Segment: We have designated the Arduino UNO R3 to manage all sensor-related activities, including the detection of human presence, fire hazards, and the automated control of the bin lid. This choice was influenced by Arduino's robust performance in handling sensor data and executing control commands efficiently.

A significant milestone this week was determining our development approach, which involves dividing the project into two main segments: the Arduino and ESP32 parts. This bifurcation is strategic, enabling us to allocate tasks more efficiently and focus on specialized areas within the project.

  • ESP32 Segment: The ESP32 module is set to handle the networking and Internet of Things (IoT) data transmission aspects. Its powerful Wi-Fi capabilities make it ideal for managing Wi-Fi configurations, sending email notifications for alerts and reminders, and integrating with the Blynk platform for remote data visualization and control.

Key Components

Arduino UNO R3

ESP32

VL53L0X Time-of-Flight Distance Sensor

Arduino UNO R3

Micro Servo

Buzzer

Ultrasonic Distance Sensor

18650 battery holder

  • As we wrap up an eventful first week, our team has not only laid a solid conceptual foundation but also made significant strides in the initial code version of both key segments of the project.

  • The next step is to integrate these segments, bringing together the sensor data processing and control capabilities of the Arduino with the network and IoT functionalities of the ESP32.

Milestones and Next Step

The upcoming week is poised to be even more exciting as we focus on connecting the Arduino and ESP32 parts and conducting tests on the physical circuit. This phase is critical as it will allow us to assess the real-world performance of our system, identify and rectify any issues, and refine the functionalities to ensure the Smart Bin operates seamlessly.

“Our journey with the Smart Bin project is just beginning, and we're thrilled to see our ideas come to life. Stay tuned for further updates as we continue to develop and test this innovative waste management solution.”

Looking Forward

Week Two Progress: Successful Integration and Functional Milestones Achieved

During this week, our team achieved seamless integration between the Arduino code and the ESP32 module, alongside meticulous assembly of the circuit. Throughout the process, we addressed and resolved specific challenges, which led to code refinement and circuit improvements, culminating in a functional prototype.

Code Flowchart

Main Challenges in Week Two:

About the Servo

Problem: The servo motor was frequently activating without detecting any objects and would sometimes rotate rapidly without command.

Solution: In addressing the challenge where the servo motor was inadvertently activating without detecting any objects, our investigation pinpointed the cause to interference affecting the PWM (Pulse Width Modulation) signal on the Arduino, triggered by other connected components. To resolve this issue, we implemented a two-fold solution aimed at ensuring the servo motor operates only as intended:

  1. Independent Power Supply for the Servo Motor: We allocated a separate power source exclusively for the servo motor. This strategic move was aimed at isolating the motor's power supply from the rest of the electronic components connected to the Arduino. By doing so, we significantly reduced the risk of electrical noise and interference from other parts of the circuit affecting the servo motor's PWM signal.

  2. Unified Ground Connection: Alongside the independent power source, we emphasized the importance of grounding by connecting all components, including the servo motor, to a common ground. This approach is crucial for preventing potential ground loop problems that could arise from having multiple, separate ground paths, which might introduce inconsistencies in the circuit's performance. A shared ground ensures that the entire system has a reference point of zero volts, thereby stabilizing the PWM signal received by the servo motor.

About the Distance Sensor

Problem: Occasional measurement errors from the ultrasonic distance sensor led to incorrect readings, resulting in inappropriate actions by the smart bin. The VL53L0X Time-of-Flight Distance Sensor often failed to respond or initiate.

Solution: To address the occasional measurement errors from the ultrasonic distance sensor and the issues with the VL53L0X Time-of-Flight Distance Sensor, we implemented targeted solutions for each sensor to ensure accurate readings and reliable sensor operation.

Ultrasonic Distance Sensor Solution:

For the ultrasonic distance sensor, which experienced occasional measurement errors leading to incorrect readings, we adopted a sorting and median-taking approach. By taking multiple measurements in quick succession, sorting these measurements, and then selecting the median value, we significantly reduced the impact of outliers and sporadic errors. This method enhances the reliability of the distance measurements, ensuring the smart bin's actions are based on accurate sensor data.

VL53L0X Time-of-Flight Distance Sensor Solution:

We identified that the VL53L0X sensor often failed to respond or initiate due to its operating voltage of 3.3V, whereas the Arduino operates at 5V. Additionally, with multiple sensors connected to the Arduino, there was a concern that the Arduino might not provide sufficient current to the VL53L0X sensor. To resolve these issues, we made both code and circuit modifications:

  1. ESP32 Operation: We shifted the operation of the VL53L0X sensor from the Arduino to an ESP32 module. The ESP32 operates natively at 3.3V, which is compatible with the VL53L0X's operating voltage, ensuring stable power supply and sensor operation.

  2. Circuit Adjustments: We reviewed and adjusted the circuit design to ensure that the VL53L0X sensor receives adequate current for its operation when connected with the ESP32. This involved optimizing the power distribution within the circuit to accommodate all connected sensors efficiently.

Code for Optimization:

VL53L0X Time-of-Flight Distance Function Demonstration

About the Response Speed

Problem:The smart bin's lid exhibited a slower than expected response time when opening and closing.
Solution:To directly address the slow response time of the smart bin's lid, we implemented a state machine in our Arduino code. This approach significantly improved the lid's operational efficiency by structuring its behavior into distinct, manageable states. Here’s a concise overview of the solution focusing solely on the state machine aspect:

  •  State Machine Configuration: We defined several states within the state machine to manage the lid's operations: Idle, Detecting Human, Bin Open, Waiting for Human to Leave, Bin Closing, and Fire Detected. This organization allows for precise control over the lid's actions, tailored to the current situation.

  • Streamlined Operational Logic: By adopting a state machine, we streamlined the decision-making process for the lid's movements. Transitions between states are triggered by specific conditions, such as the detection of a user by the ultrasonic sensor or the detection of smoke by the MQ2 sensor.

  • Optimized Response Times: The state machine facilitates immediate transitions between states, reducing the latency previously observed in the lid's operation. For example, once a user is detected, the system swiftly transitions from Idle to Detecting Human and then to Bin Open, minimizing delay in lid opening.

  • Enhanced Control Over Lid Actions: The servo motor, which drives the lid, is now more efficiently controlled through state changes. This ensures that the lid opens and closes at the appropriate times, enhancing the user experience by providing timely access to the bin.

Through the dedicated implementation of a state machine, we effectively addressed the issue of the smart bin's lid slow response times. This method brought clarity and efficiency to the control logic, ensuring that the lid operates promptly and predictably in response to user interaction and emergency conditions.

About the Smoke Sensor

Problem: The smoke sensor displayed erratic data, showing maximum values even when disconnected from the circuit

Solution: To resolve the issue of the smoke sensor displaying erratic data, specifically showing maximum values even when disconnected from the circuit, we identified the root cause as floating pins. Floating pins occur when an input pin is not connected to a definite voltage, leading it to pick up random noise from the surrounding environment, which can cause unpredictable readings.

We addressed this issue by adding a pull-down resistor to the circuit. This resistor is connected between the input pin (used for reading the smoke sensor data) and the ground. The pull-down resistor ensures that when the smoke sensor is disconnected, the input pin is pulled to a low logical level (0V), thus preventing it from floating and stabilizing the readings at 0 in the absence of an active connection.

Benefits:

  1. Stable Readings: With the pull-down resistor in place, the input pin's state is defined even when the sensor is not connected, eliminating erratic readings.

  2. Accurate Sensor Data: This solution ensures that the smoke sensor's data reflects actual environmental conditions, improving the reliability of the smoke detection feature.

  3. Enhanced System Reliability: By addressing the floating pin issue, the overall reliability of the system's sensor readings is significantly improved, leading to more dependable operation.

State Machine:

Assembling the Trash Bin in Lab Session

User Interface and Email

Fire Alert Email

WiFi Connected Email

Bin Full Email

Customized Remind Email

 WEEK THREE

 Refining Notification Logic in Our Smart Bin


In the evolution of our Smart Bin project, we encountered a challenge: avoiding repeated email notifications when the bin was full. Despite our original code implementing a debounce logic, the notification system was still triggering redundantly under certain conditions. This blog will share how we successfully resolved this issue by refining our code logic. After resolving this problem, we proceeded to document the Smart Bin's full functionality through video recording, capturing the enhanced system in action and demonstrating the function of our smart bin.

Diagnosing the Issue

Our initial step was to confirm that the existing debounce logic effectively reduced false positives, yet the issue of repeated notifications persisted. Further analysis revealed that while the debounce counter effectively managed sensor reading fluctuations, the management of the trashFullNotified flag did not prevent repeated notifications when the bin remained full.

Implementing the Solution

We took the following steps to optimize the notification logic:

  1. Refined Flag Management: We revisited the logic behind the trashFullNotified flag usage. Ideally, this flag should be reset in the transition process where the bin goes from full to not full and back to full.

  2. Accurate Reset Conditions: To precisely control the state of trashFullNotified, we introduced a condition that resets this flag only when the bin's capacity significantly decreases (indicating the bin has been emptied by the user). This ensures that notifications are only sent under new full bin conditions.

  3. Continuous Monitoring and Adjustment: We enhanced the system's continuous monitoring of the bin's status to ensure that while capacity information is updated in real-time, the state of trashFullNotified is adjusted appropriately. This approach not only addressed the issue of redundant notifications but also improved the overall responsiveness and accuracy of the system.

Original Version

Update Version

Smart Bin Functionality Demonstration Video

A significant milestone this week was the completion of our smart bin, along with the filming of a demonstration video.

The Final Touch - Our Project Poster

WEEK FOUR:

As we wrap up the fourth week of our journey with the Smart Bin project, we've reached a pivotal moment that not only encapsulates our efforts but also visually communicates the essence of our work. This week was dedicated to discussing, designing, and finalizing a project poster, effectively drawing a period at the end of this chapter of our innovation story. The completion of the poster marks an important milestone for us, effectively summarizing our project in a visual document. It’s a testament to our teamwork and the hard work we've put into making the Smart Bin a reality. As we conclude this phase, the poster stands as a proud representation of our journey and achievements.