Smart Bin Sense - Automated Waste Sorting

by We Do Fablab in Teachers > 8

182 Views, 0 Favorites, 0 Comments

Smart Bin Sense - Automated Waste Sorting

Smart Bin Sense - Raccolta differenziata automatizzata
schema_Attivita_gruppo1.jpg
schema_Attivita_gruppo2.jpg

A robotic project based on artificial intelligence that automatically places waste into the correct bin.

The system, created through laser cutting and 3D printing, utilizes a machine learning model developed by the students, capable of identifying paper, metal, and plastic through a camera. Motors, connected to a conveyor belt and a mechanical arm, move the waste to the corresponding bin.

The software was developed using graphical blocks and text-based code; the motor control hardware board used is Arduino UNO.


40-hour project.

Two groups of 6 students involved (12 students in total).


This project was developed as the result of an interdisciplinary pathway that engages students not only in learning STEM subjects but also in creativity, data collection, and analysis.

The goal is to provide students with all the tools necessary to develop critical thinking and problem-solving skills.

To reach the robotic project stage, the two groups of students delved into various fields, as shown in the attached diagrams; by exploring topics such as 3D printing, slicing, animation development, laser cutting, the use of woodworking tools, understanding the difference between artificial intelligence and machine learning, text-based programming, and block-based programming, the students, guided by a teacher, were able to complete the final project.

Supplies

28byj-48-stepper-motor-with-uln2003-driver-and-arduino-tutorial-1.jpg
Stepper-motor-control-using-L298N-moto.png

Hardware:

  1. Laser cutting machine (minimum working area 70 x 30 cm)
  2. FDM 3D printer
  3. Arduino UNO (x 2)
  4. NEMA17 Stepper Motor + L298N driver + 12V 3,5A power supply
  5. 28BYJ-48 Stepper Motor + ULN2003 driver (x 2) + 5V 2A power supply
  6. Breadboard
  7. Jumpers
  8. Webcam
  9. Various metal fittings (bolts, washers, etc.)


Consumables:

  1. Plywood (6, 8 and 10 mm thickness)
  2. Ball bearings 9x20x6 mm (x 2)
  3. PLA filament
  4. 6 mm thick methacrylate (plexiglass)
  5. Cardboard tubes (x 6)
  6. Coarse-grit sandpaper
  7. Paper roll (30 cm width)
  8. Scrap wood for the webcam support and the tension wheel of the conveyor belt


And don't forget to set aside some waste to test the project!

Authors

Prototype developed by VCO Formazione as part of the "Laboratori Scuola Formazione" program, in collaboration with We Do Fablab and lower secondary schools in the "Verbano Cusio Ossola" province (piedmont, northern italy), supporting students at risk of dropping out.

Project design and development: Massimiliano Ferré

Teaching assistance: Alessandro Ceruti

Wiring Diagram

IMG_20240319_122215923.jpg
IMG_20240319_122221904.jpg
IMG_20240319_122225999.jpg
IMG_20240319_122210764.jpg
SALD1.jpg
IMG_20240412_090400755_HDR.jpg
Schema Lab Scuola Formazione.jpg

The wiring diagram thoroughly explains the operation of the system:

A 5V 2A power supply provides energy to the driver boards of the stepper motors that move the drive rollers (the two motors are connected in parallel via a breadboard);

An external 12V 3.5A power supply provides energy to the driver board of the stepper motor that moves the rack.

The two Arduinos share a common GND and are connected to each other via pins 8 and 12.

Note: We used two Arduino UNOs because we wanted to focus more on block programming rather than text-based coding. Unfortunately, the MBLOCK block programming software does not provide a dedicated extension for the Nema 17 motor, so we had to use the Arduino IDE with a dedicated library for this motor. We then connected the two Arduinos via a digital pin because after the conveyor belt moves, one Arduino sends a signal to the other Arduino to push the waste into the bin.

It is unlikely that 13-14-year-old students will be able to design a circuit like this independently. It is more feasible for the teacher to demonstrate the operational phases of the system and explain why two external power supplies are used and how the two Arduinos communicate with each other. The students can then follow the diagram to physically make the connections, paying close attention to the length of the jumpers and the securing of the various hardware components.

It is advisable to make some connections or cable extensions using soldering. This is an operation that, if supervised, students will greatly enjoy learning.

Mechanical Structure

bozza_progetto.png
struttura_3d2.png
struttura_3d.png
Assieme.jpg

Please have your students try sketching rough ideas with pencil and paper of how they envision the supporting structure, once the project has been explained.

They should be able to draw the framework of the structure and gradually add details to each individual component (such as the movable rollers, approximate dimensions, etc.).


The 3D design, if it involves middle school students, is simpler if the teacher creates it using Fusion 360. In high schools, the preliminary 3D drawing can be done by the students, possibly using Tinkercad.

Students must still contribute to the initial design, hypothesizing the operating dynamics and the forces at play.

We have envisioned a structure that is not too large, allowing for the classification of three types of waste. The actual conveyor belt will be made of simple paper, both due to the low torque of the 28BYJ-48 steppers and because the idea is to reduce costs and, where possible, use recycled materials.

The supporting structure is designed to be portable and interlocking, making it easy to disassemble and construct using laser cutting.

There will be a tower dedicated to housing the Nema 17 motor, chosen for its good torque, considering that its pinion will be attached to a gear that needs to mesh with a rack (to convert rotary motion into linear motion), and the forces involved could increase; additionally, the stroke required to throw the waste into the bin is significant (about 30 cm). For the supporting structure, an 8 mm thick wood was selected, while for the supports of the Nema 17 and the containment of the rack, we chose wood with a thickness of 6 mm. For securing the two smaller stepper motors, which drive the conveyor belt, we planned for design-specific holes to ensure secure fastening.



Lasercutting

Lasercut_template.jpg
IMG_20240320_084308082.jpg
IMG_20240313_090752354.jpg
IMG_20240313_091759782_HDR.jpg
IMG_20240313_091811663.jpg


Attached are the vector files with the division of the pieces by plywood thickness.

Downloads

3D Printing of the Supports

Attached are the 3d models used for supporting the rotation of the tubes and connecting NEMA17 motor to the main gear. Please refer to the 3D assembly in Fusion 360 to understand where the parts are located.

It's not really important the resolution of printing process (0,2mm is ok), but we suggest to adopt a 40/60% infill parameter in the slicer.

The files named "mobile tube support" are designed to be tightly fitted inside the cardboard tubes. They can be easily redrawn based on the materials available, using Tinkercad.

Assembling

IMG_0504.JPG
IMG_20240923_145913232.jpg
IMG_0505.JPG
IMG_0508.JPG
Assembling9.jpg
Assembling1.jpg
Assembling2.jpg
Assembling3.jpg
Assembling4.jpg
Assembling5.jpg
Assembling6.jpg
Assembling7.jpg
Assembling8.jpg
IMG_20240313_102337993.jpg
IMG_20240320_083831728.jpg

In this phase of the work, students must absolutely be the protagonists! Provide them with diagrams, sketches, and drawings, and let them compose everything themselves. In addition to assembling the structure, there are several manual tasks to consider:

  1. Cutting the cardboard tubes
  2. Cutting and gluing sandpaper onto the cardboard tubes
  3. Inserting the bearings into the 3D-printed parts
  4. Assembling the 3D-printed pieces with the motors
  5. Wiring
  6. Securing and gluing the positioning arrow
  7. Cutting and joining the paper roll (conveyor belt)

If students identify improvements or issues during the assembly phase, let them propose new ideas and solutions.

Machine Learning

ML5.jpg
ML6.jpg
ML1.jpg
ML2.jpg
ML3.jpg
ML4.jpg
Teachable machine.png
WIN_20240916_09_26_17_Pro.jpg
WIN_20240916_09_24_25_Pro.jpg
WIN_20240916_09_25_42_Pro.jpg
test_ML.jpg

This phase involves classifying waste. In our case, we decided to limit ourselves to three types: paper, plastic, and metal.

It's one of the most fun phases because students will get to wear gloves and search through their school’s bins for various types of waste. Using a computer and the associated webcam, they can then create a set for waste identification. Some will use sheets of paper, while others will use fabrics, ensuring that no distracting elements appear in the photographs that could negatively affect recognition.

To harness the potential of artificial intelligence integrated into MBLOCK, we must necessarily discuss Machine Learning, Big Data, and cybersecurity.

To engage students, it is advisable to start by discussing tangible examples and technologies they already possess, such as smartphones.

You can talk about the advantages and disadvantages associated with the use of artificial intelligence in areas like security, where public privacy is at risk, but benefits are gained in terms of protection.

Additionally, you can discuss autonomous driving and facial recognition.

Interacting with students on these topics is essential.


To help students understand the importance of the method used for data collection, it is advisable to use the platform Teachable Machine, which has no particular limitations and actually offers advanced features that are not relevant for this age group.

An interesting first exercise to familiarize them with this tool is facial recognition.

Let’s have the students in group of two, with one computer, create two "classes" (one for each student in the group) and take pictures of themselves using the webcam in different positions or expressions. Once the model is created, the students can test the recognition percentage of their faces.

This simple exercise immediately highlights some important considerations when discussing machine learning:

  1. Number of samples
  2. Quality of samples

In our specific example, it will bring to light potential malfunctions due to some physiological similarities among students or issues related to inconsistent backgrounds.

Let the students have fun analyzing the strengths and challenges of a system like this.

To also help them become familiar with coding and microcontrollers, you can introduce the use of Arduino and MBLOCK, allowing them to control a servo motor using facial recognition, thereby simulating the opening of a door.

Note: Teachable Machine integrates perfectly within PICTOBLOX, another platform widely used for combining coding and AI in an educational context. However, in our case, we have decided to use MBLOCK (online versione) because we will need to relate SPRITES and HARDWARE, which, at the time of publishing this article, is not possible in PICTOBLOX.

As a result, we had to use the dedicated Machine Learning extension integrated within MBLOCK. The functionalities are limited and the results are less accurate, but for the type of project we are undertaking, it still works well.

We strongly recommend not taking photos directly within the application because, by doing so, the files are not saved locally, and in case of a malfunction, you could lose all your work. Instead, take the photos and save them on your computer, then upload them into the extension in MBLOCK.

By creating three classes of waste, they will be able to take multiple photos of the same object, ideally rotating it in all possible angles. We recommend carefully selecting the waste and photographing it in adequate lighting.

The extensions that can be used for this purpose are:

  1. Machine Learning 2.0
  2. Teachable Machine (the one we used).

The best approach would be to perform sampling directly from the webcam mounted on our system. If the system is not yet completed and you still want to conduct exercises with multiple computers, students can work in pairs using one computer, as previously mentioned.

Coding

Flow_chart_coding.jpg
SPRITE.png
Arduino UNO.png

The final phase of work involves programming. As explained earlier, due to the lack of an extension in MBLOCK for the NEMA17 motor, we will need to program it using the classic Arduino IDE. The code is attached.

Pay attention to the timing and speed of the NEMA17 motor! It should not exceed the rack's effective travel range; otherwise, we risk overloading and damaging the motor.

We will thus focus on explaining block programming in MBLOCK, that will affect the Arduino connected to the little motors. We will not only need to program the motors that drive the conveyor belt differently, depending on the identified waste, but we will also (by our choice) create an interaction between the virtual world (sprites) and hardware (motors).

In the DEVICES tab, ensure you have added the Arduino UNO. You’ll also need to add:

  1. The "ULN2003 Step Motor NODE" extension to program the 28BYJ-48 stepper motors connected in parallel
  2. The "Upload Mode Broadcast" extension for communication between hardware and sprite

In our case, we’ll keep the PANDA sprite to program the user interaction component. Here as well, it’s necessary to add both the "Upload Mode Broadcast" and "Text to Speech" extensions for a more engaging animation.

To ensure the program’s operation is as clear as possible, we’ve included screenshots directly from the Mblock online software, as well as the program's source link file. Additionally, the workflow can be outlined by following the attached flowchart.

As shown in the screenshots, reset and pause blocks have been added for effective hardware management. Additionally, the students decided to incorporate "text to speech" mode with representative texts for the waste types:

  1. For paper: "Respect trees, always use recycled paper."
  2. For plastic: "Better in the bin than in the sea."
  3. For metal: "Ferrous materials can be recycled an unlimited number of times."
  4. To accompany the recognition, confirmation sounds and applause are played when the waste is correctly expelled.

The three different step counts that the stepper motors execute are used to move the conveyor belt for varying durations, ensuring that the waste is properly aligned with the correct bin.

Conclusions

This project has offered students an engaging pathway into technology, fostering both technical skills and soft skills that are crucial for modern education. Through the hands-on application of Artificial Intelligence (AI), Machine Learning (ML), and Coding, students not only gained a foundational understanding of these concepts but also learned how to implement them in real-world contexts. By designing and programming a waste sorting system, they applied AI to classify and manage waste types, bringing abstract notions into a tangible project. The use of block-based coding in mBlock made learning accessible, encouraging creative problem-solving and providing an effective introduction to more complex topics.

Additionally, the project emphasized the importance of teamwork and collaboration. Working in pairs and groups, students navigated challenges together, enhancing their communication and collaboration skills. Each participant contributed uniquely to the project, creating an inclusive environment where diverse ideas and perspectives could thrive. This experience not only enriched their technical knowledge but also fostered a strong sense of responsibility, social awareness, and environmental consciousness. Ultimately, the project succeeded in making technology education both fun and socially relevant, preparing students with valuable skills for future challenges.


This project presented a considerable challenge for the age group involved (13–14 years), as students lacked the foundational skills necessary to handle all phases of the design. Nevertheless, they actively participated in conceptualizing the system's structure, estimating the motor steps required for accurate conveyor belt movement, performing wiring, and engaging in extensive hands-on work. These tasks offered valuable learning experiences, allowing students to contribute meaningfully while strengthening their problem-solving skills.


Throughout the project, two key issues emerged, which, if unaddressed, could lead to system malfunctions over time:

  1. Unreliable Wiring: Given the number of cables and the need to extend connections, there is a high chance that cables may become disconnected. To secure the connections, we suggest using adhesive tape, hot glue, soldering, or heat-shrink tubing to ensure a stable bond.
  2. mBlock Extensions: Since mBlock extensions consist of code blocks created by third parties, any updates, renaming, or removal of blocks by the extension’s developer could cause errors or missing components upon program loading. It’s crucial to be aware of these potential changes to maintain the program’s integrity.


it’s also essential to remember that the Machine Learning extension we used stores the captured images for waste recognition online. This reliance on internet connectivity means that if there are any network slowdowns or issues with the server hosting these images, our entire system could be disrupted.

This consideration underscores the interconnected nature of cloud-based technologies in educational projects. It also presents an additional learning opportunity: students can reflect on the importance of stable internet connections and server reliability in systems that depend on remote data access.