Skip to content

Final Project

Recycling Bin

Introduction

At first I was working on printing some things using a 3D printer and then I noticed something which is that the printer wastes a lot of plastic and this depends on the thing that it prints. So I decided to make something that would make it easier for me to sort the plastic.

In an era where sustainable living is more crucial than ever, our Smart Recycling Bin project aims to revolutionize waste management by combining technology and eco-consciousness. This innovative solution utilizes various components to create an efficient, automated recycling system.

Key Components:

  1. Microcontroller: The brain of our project, responsible for processing inputs from sensors and controlling outputs like motors.

  2. Jumper Wires: Essential for connecting the microcontroller to various components, ensuring seamless communication and power distribution.

  3. DC Motor: Used to facilitate the movement of the bin lid or internal mechanisms, allowing for automated operations.

  4. Motor Driver: Acts as an interface between the microcontroller and the DC motor, enabling precise control of motor functions.

  5. Power Source: Supplies the necessary energy to all components, ensuring reliable operation of the recycling bin.

  6. 3D Design: The structure of the bin is crafted using 3D design techniques, allowing for customization and efficient use of space.

  7. Servo Motor: Provides the capability to open and close the bin lid based on user interaction or sensor inputs.

  8. TCS34725 Color Sensor: Detects the color of the waste material, helping to classify it into recyclable categories.

  9. Hole Effect Sensor: Monitors the position of the bin lid or other moving parts, ensuring that the recycling process is smooth and efficient.

  10. 3mm MDF Wood: The primary material for constructing the bin, chosen for its durability and ease of machining.

Together, these components create a smart recycling bin that not only makes recycling easier but also encourages users to engage in eco-friendly practices. This project demonstrates how integrating technology into everyday tasks can lead to a more sustainable future.

2D and 3D Modeling

First I drew a circle and hollowed it out using the extrude tool.

Then I downloaded the ROTATING DISK from thingiverse. And I make two hole in the bin one for gear and another for sorting.

I made a soap-like piece to isolate the pieces.

Then I designed a piece to separate the pieces to mount them on the servo motor using several tools including sweep, offcetfaces, extrude and shell.

I made bases to hold the parts and put the motor in them.

After that I made the gears and I make sure it is good to used.

I made a base so I can hold the basket and other parts on it.

I made some holes in the basket so I could put magnets.

I made a holes for scrwo and also I made cups and I put them on the base. This is the final resulet.

Click here to download

3D Print

I start printing using PLA type of filament.

Some important pieces

Laser cutter

I cut the base by use 3mm MDF wood with CO2 laser machine.

Final Result:

Circuit Diagram

In developing my circuit diagram, I leveraged a variety of tools to ensure optimal functionality and performance. At the core of the system, I utilized an Arduino UNO as the primary microcontroller, chosen for its versatility and ease of programming. To control the DC motor effectively, I integrated an L298N motor driver, which provides the necessary current and direction control, enabling precise motor operation.

In addition to the Arduino UNO, I incorporated a XIAO ESP32 microcontroller, known for its compact size and robust capabilities, to manage a servo motor and a TCS34725 RGB color sensor. The ESP32’s advanced features allow for seamless communication and control over the servo’s position, while the color sensor enables accurate detection and processing of RGB values.

Full Circuit Diagram

This image represents the electrical circuit I used in the project:

This picture also shows the locations of the wires and how to connect them:

The entire setup was programmed using the Arduino IDE, which facilitated the development and uploading of code, allowing for real-time adjustments and debugging. This comprehensive approach not only enhanced the project’s functionality but also ensured a smooth integration of all components, resulting in a cohesive and efficient system.

Programing

The following code was implemented on the XIAO ESP32 to facilitate the operation of both the servo motor and the TCS34725 RGB color sensor. This code enables precise control of the servo motor’s position while simultaneously allowing the color sensor to accurately detect and process RGB values. By integrating these functionalities, the program ensures efficient communication between the components, resulting in a cohesive and responsive system.

#include <Wire.h>
#include <Adafruit_TCS34725.h>
#include <ESP32Servo.h>
// Create an instance of the TCS34725 class
#define SERVO1_PIN D0  // Pin for Servo 1
#define SERVO_PIN D1  // Pin for the servo 2


Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);

Servo myServo;
Servo myServo1;

void setup() {
  Serial.begin(9600);
  Serial.println("TCS34725 Color Sensor Test");
    // Attach the servo objects to the respective pins
  myServo.attach(SERVO1_PIN);
  myServo1.attach(SERVO_PIN);

  // Initialize servos to a starting position
  myServo1.write(0);  // Start at 0 degrees



  if (!tcs.begin()) {
    Serial.println("No TCS34725 found ... check your connections");
    while (1);
  }
}

void loop() {

  uint16_t r, g, b, c;
  tcs.getRawData(&r, &g, &b, &c);

  Serial.print("R: "); Serial.print(r);
  Serial.print(" G: "); Serial.print(g);
  Serial.print(" B: "); Serial.print(b);
  Serial.print(" C: "); Serial.print(c);

  // Determine the color name based on RGB values
  String colorName = getColorName(r, g, b, c);
  Serial.print("Detected Color: "); Serial.println(colorName);
  if (colorName == "Blue"){

   // Red color detected
   myServo.write(45);  // Move slide to red container
   Serial.println("Blue color detected");

  } 
  else if (colorName == "Green"){
     myServo.write(135);  // Move slide to red container
     Serial.println("Green color detected");
  }
   // Move to 180 degrees
  myServo1.write(180);
  delay(6500);  // Wait for 10 seconds

  // Move back to 0 degrees
  myServo1.write(0);
  delay(6500);  // Wait for 10 seconds

}

String getColorName(uint16_t r, uint16_t g, uint16_t b, uint16_t c) {
  if (r > g && r > b) {
    return "Red";
  } else if (g > r && g > b) {
    return "Green";
  } else if (b > r && b > g) {
    return "Blue";
  } else {
    return "Unknown";
  }
}

The following code was developed for the Arduino UNO to control the DC motor connected to the L298N motor driver. This code facilitates precise operation of the motor, allowing for both directional control and speed regulation. By leveraging the capabilities of the L298N motor driver, the program ensures efficient power management and smooth execution of motor commands, thus optimizing the overall performance of the system.

// Define motor control pins
const int motorPinD1 = D9;   // IN1 on L298N
const int motorPinD2 = D10;  // IN2 on L298N

// Define timing
const int runTime = 5000;    // Motor running time in milliseconds
const int pauseTime = 2000;  // Pause time before reversing

void setup() {
  // Start serial communication for debugging
  Serial.begin(115200);

  // Set motor control pins as output
  pinMode(motorPinD1, OUTPUT);
  pinMode(motorPinD2, OUTPUT);

  // Start with the motor off
  digitalWrite(motorPinD1, LOW);
  digitalWrite(motorPinD2, LOW);

  Serial.println("Setup complete. Starting motor test.");
}

void loop() {
  // Spin motor in one direction
  Serial.println("Motor spinning forward.");
  digitalWrite(motorPinD1, HIGH);
  digitalWrite(motorPinD2, LOW);
  delay(runTime);  // Run for defined time

  // Stop the motor
  Serial.println("Motor stopping.");
  digitalWrite(motorPinD1, LOW);
  digitalWrite(motorPinD2, LOW);
  delay(pauseTime);  // Pause before reversing

  // Spin motor in the opposite direction
  Serial.println("Motor spinning backward.");
  digitalWrite(motorPinD1, LOW);
  digitalWrite(motorPinD2, HIGH);
  delay(runTime);  // Run for defined time

  // Stop the motor
  Serial.println("Motor stopping.");
  digitalWrite(motorPinD1, LOW);
  digitalWrite(motorPinD2, LOW);
  delay(pauseTime);  // Pause before restarting the loop
}

Discussion

This model serves as a foundational prototype intended for emulation and further development by future users.

The project features a dual microcontroller system where each microcontroller has a distinct function. The XIAO ESP32 is responsible for operating the color sensor, which detects the colors of various components. Based on the detected color, the microcontroller sends a signal to a servo motor, prompting it to rotate either 45 degrees or 135 degrees.

The second microcontroller is tasked with driving a DC motor through a motor driver.

The overall design incorporates components fabricated from 3D-printed plastic and a wooden base that has been precision-cut using a laser machine.

bitware photo coverage

Conclusion

In conclusion, the Smart Recycling Bin project represents a significant step towards integrating technology into waste management, fostering sustainable practices among users. By combining a dual microcontroller system with a range of carefully selected components—including sensors, motors, and a custom 3D-printed structure—we have created an innovative solution that not only simplifies the recycling process but also promotes environmental awareness.

As we move towards a more eco-conscious future, projects like this highlight the importance of innovative solutions in addressing pressing environmental challenges. By encouraging responsible waste management through engaging technology, we aim to inspire a broader adoption of sustainable practices within our communities. Future iterations of this project can build upon this framework, further enhancing functionality and user experience, ultimately contributing to a cleaner, greener planet.


Last update: September 22, 2025