Main Content

Smart Dust Bin with RiotOS and ESP-32 v3

Dustbin with automatic lid opening system and real time web dashboard to visualize and analyze data about its usage.

The Smart Dust Bin project is an innovative IoT solution that combines the power of the ESP32 microcontroller, RIOT OS (Operating System for the Internet of Things), and the AWS (Amazon Web Services) ecosystem. The project aims to create an intelligent waste management system with real-time monitoring, data analysis, and a user-friendly web interface.

The core concept behind the project is to create a dust bin that autonomously detects nearby objects and opens its lid automatically. This eliminates the need for manual lid operation, offering a hygienic and convenient experience for users. The ESP32 board serves as the central control unit, efficiently processing sensor data and managing the lid mechanism. Overall, the Smart Dust Bin project combines the ESP32 board, an ultrasonic sensor, a servo motor and intelligent software to create an advanced waste management system. With automated lid opening, it enhances user convenience, improves waste collection efficiency, and contributes to a cleaner and more sustainable environment other than improving hygenical aspects.

ESP32v3 board and RiotOS
The ESP32v3 board is a powerful microcontroller board featuring the ESP32 chip, renowned for its versatility and capabilities. With built-in Wi-Fi and Bluetooth connectivity, ample processing power, and a rich set of I/O interfaces, the ESP32v3 board is an ideal choice for IoT projects, robotics, and advanced embedded systems.

RIOT OS is a lightweight operating system designed specifically for the Internet of Things (IoT), offering low memory footprint and energy-efficient operation.

Sensors and actuators
The HC-SR04 ultrasonic sensor is a popular distance measuring module used in various projects. It utilizes ultrasonic waves to accurately measure distances between objects and the sensor.

The servo motor is a versatile actuator commonly used in projects requiring precise control of rotational motion.

Mosquitto MQTT-Broker
Mosquitto is an open-source MQTT broker that facilitates lightweight messaging between devices in an IoT project.

AWS Ecosystem
The Smart Dust Bin project leverages the power of the AWS ecosystem to enhance its functionality and capabilities. AWS IoT Core enables secure communication between the ESP32 board and the cloud. Then the collected data such as the current date time, last distance measurement and actual status of the lid (Open, Closed) are stored into a DynamoDB table thanks to an IoT Core rule. Then making use of a AWS Lambda function it’s possible to retrieve this data and sort them by the timestamp attribute. Finally we can connect the javascript part of the web interface to the actual AWS services thanks to API Gateway which works as the Lambda function trigger. Then the whole interface is hosted using another AWS service which is Amplify.

Design and functioning of the project
The Smart Dust Bin is designed as follows. The ultrasonic HC-SR04 sensor is placed in the center of the front part of the bin, at half its height. The lid of the bin has been divided in two section, one smaller glued to the top of the bin and one larger which can be opened and closed by the servo motor. The servo infact lays on the fixed part with its arm initially placed perpendicularly to the lid with a short wire glued to the other section. The bin is coded to work as follows: Every two seconds the ultrasonic sensor makes his measurement and if it detects a value of the distance below the defined threshold of 15 cm the servo motor will open the lid. The lid will remain opened for 5 seconds, then the ultrasonic sensor takes another measurement and if the distance will be above 15 cm the lid will be closed, otherwise the lid will stay open for another 5 seconds waiting for the next measurement. Every time the sensor detects a distance below the threshold or the servo motor changes its position the ESP32 board will send a message to the mosquitto MQTT broker which will forward the message to AWS IoT Core thanks to a transparent python bridge. The message will contain the informations that will be displayed on the web interface, such as the date time, the detected distance and the actuale state of the lid. The sampling period of two seconds is dued to a compromise within the power consumption and an acceptable responsiveness of the of the model. The 5 seconds period in which the lid will stay open has been chosen because this seems to be the minimum time needed for a person to throw away the uneeded stuff. The threshold has been defined to be of 15 cm because a smaller distance would have been uncomfortable for the user, while a bigger one could have led to useless openings of the lid due to the detection of normal objects moving around the bin. The following pictures represents the final prototype version.”

Link to article