Smart waste bin for environmental education
"I learned that we are never too small to make a difference" Greta Thunberg Latam online. Second Edition. 2021 is one of Greta Thunberg's famous phrases, alluding to the power of young people to change it...
A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

This archive includes automatic translations. Audio, video and text inside images remain in their original language.
"I learned that we are never too small to make a difference"
Greta Thunberg
Latam online. Second Edition. 2021
It is one of Greta Thunberg's famous phrases, alluding to the power of young people to change everything, particularly their way of seeing the world and the opportunities to do new things for their future.
But... and if that future looks gray and contaminated, then how can they make a difference today?
Mascot of ecological conscience
Currently, many young people are concerned about environmental problems, becoming proactive actors in the search for solutions. This urgency for change motivated us to create Ecological Consciousness to teach children the correct way to classify their waste in a fun way, promoting the practices of the (4Rs), Reduce, Reuse, Recycle and Recover, using technology and artificial intelligence.
This team made up of seven (07) passionate about artificial intelligence has united three countries such as: Ecuador, Mexico and Venezuela, participating in the 2nd edition of Saturdays.AI LATAM and through its method build to learn developed a project based on Deep Learning called Ecological Conscience, focused on basic education students in the city of Guayaquil — Ecuador.
If you want to know more, I invite you to continue reading.

Members of the Ecological Conscience project team
The problem
According to the National Institute of Statistics and Census (INEC), In 2017, each Ecuadorian produced 860 grams of solid waste in one day, although this number was below one kilogram of garbage per day in Latin America and the Caribbean, that year there was a growth of 48% compared to the previous year, so it is not surprising to imagine that if measures were not taken in time, these numbers would be higher today.
Of the garbage collected, 96% is buried in landfills, pop-up cells or open dumps and only 4% is recycled. To get an idea of the reasons why recycling is low, in 2016 the INEC conducted a household survey detecting that 59% of households did not classify waste.
When asked the reasons why they did not classify, 43% responded due to the lack of specific containers. However, the remaining 57% were due to cultural problems: “they do not know how to classify” (18%), “they are not interested” in waste classification (16%), they say “they do not know the benefits” (15%) or the remaining (8%) do not trust garbage collection systems.
From this reality, Guayaquil is the first city that produces garbage, generating 28% of the total daily waste in the country, and the highest in terms of percentage of disinterest: 29% of citizens are not interested in classifying, 15% do not know the benefits and 6% do not know how to classify, this disinterest is followed by Ambato (20%), Machala (14%), Quito (11%), Cuenca (9%).
For this reason our project focuses its efforts on this city and opens its first chapter called Guayaquil.

Problem detected
Children are not only the future, they are also the present of the world
Today's children will be tomorrow's adults. If we want to change the way people interact with our planet, we must start from an early age by creating environmentally friendly habits, and these can be encouraged at school through education and the creation of spaces for good environmental practices.
Aware of the above, the idea of Ecological Consciousness was born, which seeks to teach children to classify their waste in a fun way.
This project focuses on reducing disinterest and ignorance in the classification of waste among basic education students in the city of Guayaquil, through containers with intelligent vision that guide children from 5 years old to 14 years old, in the correct classification and management of waste, promoting the practices of Reduce, Reuse, Recycle and Recover (4R).
The proposal unites several concepts, first seeking to familiarize children from school age with waste management, guiding them through audio and lights towards the correct container, also to correctly manage the waste in their container, contributing to the classification from the source, and creating awareness in the child through educational messages.
The containers are designed to be able to measure the volume of waste and emit a signal when the container is full, this will allow the school to empty it in time and avoid damage to the container gate.
Genesis of ecological consciousness
At this point there were two decisions for the central module of Ecological Conscience, the first to locate a Jason Nano Nvidia, which condenses inside the camera, the computing capacity and the possibility of connecting the micro controller, or to locate a recycled Tablet, use its camera and house the computing capacity in the Tablet and have it coordinate the classification with the signals to the containers, the speakers and the lights.
The decision was made considering the budget base that a school may have, so the second option seems to be the most viable, since for less budget Ecological Consciousness could be brought to more schools. The team estimated $70 considering the donation of a recycled Tablet.
After deciding how to carry out the classification, we thought about what we wanted to classify and using the Ecuadorian Standard INEN 2841, 2014, regarding the standardization of colors for containers for deposit and temporary storage of solid waste, 5 classes were established: glass, paper, cardboard, plastic, organic.
Which were finally grouped into:
- In a green container: Organic.
- In a blue container: Plastic.
- In a white container. Glass.
- In a gray container: Cardboard and Paper.
- In a black container: Waste, which you establish as the lowest prediction percentages presented by the model.
Steps to follow
1. Dataset
The data was selected from three sources: An open repository of debris images called “Waste datasets review”, particularly with the data set Trashnet, which contains 2527 images; photos on specialized photography websites and photos captured from cell phones related to products that were considered to be labeled related to the school environment.
The dataset was built with a total of 5000 images in 5 classes: glass, paper, cardboard, plastic, organic. The metal class was not considered for the project. The dataset was divided into 80% training and 20% for validation.
2. Processing: the ABC
This was the longest phase due to the time invested to make the bounding boxes. For processing, we used LabelImg, which is a free graphical image annotation tool available in pip for python3.0 or higher.
For each labeling, care was taken to enclose the object within the bounding box, as tight as possible to the image and making as many boxes as there were objects.

Example of using the LabelImg tool
The images were saved in Yolo format (*.txt). This format sets the class and coordinates of the bounding boxes with the following structure: (c, xn, yn, wn, hn)

5 Yolo format (*.txt)
Where:
- c: is the class number, in this project there are 5 classes, where c can take the value 0 for cardboard, 1 paper, 2 glass, 3 plastic and 4 organic.
- xn: center of the normalized bounding box in the x direction.
- yn: center of the bounding box normalized in the y direction.
- wn: normalized width of the bounding box (x).
- hn: normalized height of the bounding box (y).
3. The model
The selected model was YOLOv5 (You Only Look Once). This is an open source system for object detection in real time pre-trained with the COCO dataset, which uses a single convolutional neural network (CNN) to detect objects in images.
According to the literature review, Yolo in its fifth version is a good algorithm to detect objects in the field of feeding, robotics, health, among others, achieving good positioning and object recognition, more precise than other algorithms, even previous versions of Yolo. This team selected YoloV5, considering it a robust algorithm with good results in recent research related to detection.
4. Results:
The model was trained 4 times using the "Transfer Learning" technique, achieving a 50% improvement in the last training compared to the first. The following variables were used in the model:
- Model: The Small version (Yolov5s) was used since it is the fastest to train and allowed us to have a good idea of the behavior of the database and the model when faced with the problem. However, the downside to speed is that you sacrifice precision compared to other versions like the Extra Large (Yolov5x)
- Weights: for the first training, the default weights in Yolo were used, which come from the training of the COCO data set, called “yolov5.pt. During each training, a file was generated with the best weight found, which was used for the next training.
- Epochs: Training began with 10 epochs, reaching up to 30 epochs.
- Batch, remained fixed at 6 for the entire training.
- Image size: The data set was configured so that each image had a size of 640 x 640.

The latest training variables are appreciated
The results of
- confusion matrix
- Precision and Sensitivity (Recall)
The confusion matrix indicates what type of error the model is making, in the case of Yolo for calculation uses a confidence of 0.25 and an IoU (Intersection over Union) limit of 0.45. This means that to classify an object it must have a 50% probability of being in a class.

The class for the confusion matrix in the confidence calculation of 0.25 and an IoU (Intersection over Union) limit of 0.45
Yolo presents its matrix in relative values, where each element of the matrix is normalized to the total of the column, so the sum of the values in each column is equal to 1.

For the data set, we have that the cardboard is classified relatively well, in 72% of the cases it was recognized as this class, while the remaining 24% classified it as background. They recognized glass in 85% of the cases, while 10% confused it with plastic, perhaps due to the similarity of transparency. Paper 59%, this being the lowest value, sharing 8% with cardboard, and 32% with the background. In the case of plastic, 64% assertiveness was obtained, and the remaining 34% with the background. Finally, in organic, 85% true positives were obtained and only 13% background.

The average precision of all classes of the model was 0.748, which for this type of algorithm is good, it tells us that out of every 10 images, approximately 7 are classified correctly. Its sensitivity (Recall) was 0.723, which is a good measure of the number of objects per class classified correctly; in a given class, out of every 10 images, 7 are correct, only 3 are false positives.

Results of the metrics that it shows us when obtaining from the confusion matrix
5. The prototype: its growth
It is important to mention that the scope of the project was limited to carrying out the prototyping of Ecological Conscience, which consisted of the deployment, the simulation of the hardware components and a sketch of an application that connects the prediction of the model with the hardware to classify images of six (6) types of waste: organic, glass, plastic, paper, cardboard, waste.
The operation of the prototype will be explained below.
AwarenessAI Ecological will consist of five (05) containers of different colors and a central module where a Tablet with a camera will be found. The containers were designed thinking about the size of children and the easiest way to deposit waste in them.

Proposed design
The aim will be for learning to be carried out through the child's interaction with the containers, for this the child will present a waste to the Tablet camera and through a model, up to six (6) types of waste will be recognized: organic, glass, plastic, paper, cardboard and waste in general. After recognizing the waste, the prediction will be sent to an App hosted on the Tablet in the central module, which will show what has been recognized on the screen and emit a sound with the name of the categorized material and the color of the container.

An outline of the prototype process is presented
At the same time, the Tablet will send a signal to a microcontroller to open the container intended to collect the waste and a signal will be sent that will turn on a light located in the container. The App will issue information about the practice of the 4Rs to promote its use. The child will finally go to the indicated container and deposit the waste.

An outline of the prototype process is presented
An ultrasonic sensor will be installed in each container to measure the volume of accumulated waste. The sensor will send a signal to three LEDs that will indicate three levels: Available (green), Intermediate (yellow) and Full (red). This is in order to prevent the containers from exceeding their capacity, since, if this occurs, they can hinder the opening of the door with the entry of waste, causing damage to the servomotors.

Internal structure of the container (ultrasonic sensor above)
6. Deployment
On the other hand, the application in this phase will not have physical interaction with the child, for the moment it will serve as a centralizer of the information that comes from the model and that directs the action of opening the containers, showing the result on the screen, emitting sound and turning on the lights of the containers.
The App must be started by the administrator, who can start running Ecological Consciousness through his username and password.

Design of the proposed application
Immediately, a menu is displayed which will show a “start recycling” button that will put Ecological Consciousness in waste recognition mode. Pressing the button turns on the proximity sensor and the optical sensor (camera); In the future we plan to implement a statistics module visible in the menu, for the purposes of this project idea it will be placed as disabled.

Design of the proposed application - starting the process
In recognition mode, when the approach sensor is activated, a message will be displayed for the child to present the object to the camera; when the object is detected, the prediction will be made.

Android app for classification, showing categorization in real time.
Once done, the identified class will be displayed on the screen and will emit a sound with the name of the container, then it will emit a short educational message.

Design of the proposed application with sound interaction
At the same time, the App will send the information via Bluetooth to the microcontroller, which will be responsible for opening the correct gate and emitting the signal to turn on the LEDs. Below is a simulated diagram in Tinkercad.

Circuit sketch
Your Future: Next Steps
Up to this point, we have an idea of how Ecological Consciousness in a simple way can guide children in creating habits to Reduce, Reuse, Recycle and Recover. But...
have we come this far?
In the short term, the first thing would be to bring this conceptualization to reality, improving each of the technical aspects contemplated in the prototype. Financing from the Municipality of Guayaquil or an interested institution would be the spark to propel the project.
In the medium term, increase the database and include other materials for classification, such as metal, and even scale the project to companies for hazardous materials such as batteries, energy-saving light bulbs, fluorescent light bulbs, which are causing a serious problem for the environment.
In principle, the design of educational containers is adjusted to the needs of each region and even country, since currently there is no international regulation that dictates the standards for the colors of the containers or what type of material is recycled, Ecological Consciousness can be adapted to the needs of the user.
Why don't we look for artificial intelligence to answer the child's concerns and doubts? The App can be improved to include interaction with the child and a conversation could be had about recycling and aspects of interest for the education of children according to the educational programs of each region or country.
Thinking about the future of information. The ultrasonic sensor could generate data through the volume estimation of each container. These data will help keep the statistics accumulated over time, both by container and in its 5 categories; as well as by schools.
This information will be housed in a database to later feed a dashboard of indicators that will allow its monitoring, as well as other functionalities such as: control of devices that are not working; schools that are not being proactive; unmanaged full container time; inter alia. In short, a series of primary indicators, which allows the entities in charge to monitor “container” units per school and encourage them so that their students learn by playing.
Members:
- Luis Reyes
- Lady Sangacha
- Jostin Maldonado
- Karely Mayorquín
- Jorge Chiquito
- Veronica Abad
- Carlos González
Project presentation: DemoDay
Repository:
GitHub: https://github.com/SaturdaysAI/Projects/tree/master/LATAM_remote/ConcienciaEcologica
More artificial intelligence!
The mission of Saturdays.ai is to make artificial intelligence more accessible (#ai4all) through intensive courses and programs where projects for good are carried out (#ai4good).
If you want to learn more about artificial intelligence join our community at community.saturdays.ai or visit us on our website www.saturdays.ai Join us!
A history of the Saturdays.AI community. Originally published on March 9, 2022.
← More community stories


