Skip to content

Final Project

At first, I decided to make a boat that would clean the lake from pollution as a final project, but after researching, I realized that it would take quite a long time to complete. I had a second idea, which is a PET bottle recycling machine. It will also be quite useful at my workplace, as we use a 3D printer and the children will be able to use the filament they have created, and we will also contribute to reducing environmental pollution by recycling plastic. At first, I decided to study what such machines are, how they are manufactured, and what devices will be needed. As well as how to process the bottle before turning it into filament, is it easy to print with this filament and what can we print with it?

With 3D printing, plastic bottles can be transformed into household things. Personalized containers and organizers that are intended for our specific needs.

We can make decorative vases and flower holders can add a touch of creativity to decor. Practical items like pen holders, cable organizers, soap dishes, reusable drinking cups, and key holders can all be created using 3D printing, not only reducing plastic waste but also promoting an eco-friendly lifestyle.

Sketch of my final project

Time management

Since time management is quite a challenge for me, and the hardest part is figuring out what the parts will look like and whether to include the bottle-cutting part, I set aside some time each week to clarify those questions for myself․

I will start modeling the parts of the device from April 22 in order to distribute the printing, cutting, electronics, and programming parts in the remaining weeks.

Slide

Presentation video

Research

At first, I started to do research and found a lot of interesting projects with interesting designs and solutions.

  1. Petamentor2

  2. Recreator3d

  3. Create Your own Free 3D Printing Filament from Plastic Bottles

  4. PET Filament Machine

I used Strip Director model from forth project. After that I decided to make a simple design for the first step, but if I finish it and have time I will add some other components for example bottle strip cutter.

3D and 2D Design

Here is the design process.

3D print

After finishing the design process I started 3D printing of the parts.

My 3D printed electronics box remained unfinished․

The essential part for me was understanding whether gears fit and testing the motor.

Laser cutting

I made my electronic box and bed with laser cutting and used acrylic sheet.

For making electronic box joint Elen suggested to use Adobe Fusion Add-Ins BoxJoint. I imported my SolidWorks file to the Fusion. Making joints in this way was really fast and easy.

I just needed to select faces, min and max fingers number and tool dimensions.

After that I exported all parts of box to .dxf and imported it to RDWork and cut it.

I exported the bed of my final project to .dxf file and import it to RDWork for laser cutting.

PCB design and production

PCB design

Before designing my PCBs I started to think about what devices I needed to use and which pins.

I decided to make two boards and connect them with the I2C protocol. I wanted to set the temperature and send it from my primary board and the secondary board. The PID control system would control the temperature and heat the hot end until it reached the desired temperature. And when it reached the desired value the stepper motor started work.

Here are the boards I designed.

Because I wanted to control the hot end with a pin, and my hot end works with 12V voltage. I needed to put BJT transistor and MOSFET. I found a schematic on this website and it helped me a lot. After that, I wanted to understand why I needed to use BJT transistor and MOSFET and I found the answer in this forum.

At first, I made my second board and added a BJT transistor and MOSFET on it, but it didn’t work I tried found the reason at first I removed the MOSFET and tested it with breadboard and did the same with BJT transistor. I guess the problem was with the traces.

The solution that I found was to make the BJT and MOSFET boards separately.

Board with BJT(2N3904) and MOSFET (IRFZ44N).

Also, I made the board for the Stepper motor driver and power supply.

PCB production

First is driver and power supply board.

Board with MOSFET and BJT.

Primary board.

Secondary board.

Input devices

In my final project, I used these INPUT devices.

  1. KY-040 Rotary Encoder Module

  1. MAX6675 Thermocouple Module

Output devices

In my final project, I used these OUTPUT devices.

  1. Ender hot end.

  2. Nema 17 stepper motor and TMC 2208 driver.

  1. LCD I2C screen

System integration

The hardest part for me was system integration because I needed to understand how I need design my boards and integrate them into the electronic box also where I needed to put the electronic box that would be easy to use and how to make a control menu that would be easy to use and understand. And considering all these factors I designed my electronic box. At first, I printed it but something went wrong and it stopped in the middle of printing. And because printing again was time-consuming I decided to laser cut it. That was a fast and really good decision. I made inside of electronic box holes for screwing my boards. And make a big hole for ventilation, because I have in my driver board voltage regulator that became hot when stepper motor starts to work.
Here is what my electronic box looks like.

Here is the inside of the electronic box.

Programming

I thought that programming and electronics would be the easiest part for me so decided to make it a little harder and connected them with I2C protocol. Also, Babken suggested using PID control. I never heard about it. That’s why I started to search for tutorials. After watching a few of them I understand how it works and how I can integrate them into my project. Here are the tutorials that helped me.

Connection Of The Heating Block Including PID Control And Menu - ARDUINO

Arduino PID Temperature Controller using MAX6675 K-Thermocouple to Digital Converter IC

Temperature PID controller - Arduino

PID control on Arduino

I read also about the Bang-Bang Temperature Control System. To understand what I wanted to use I asked Copilot about the advantages and disadvantages of each of them.

There is the result.

I decided to use PID control and started programming.

Before programming it for my board I tested components separately at first with Arduino Uno and after it with my boards. It really helped because I learned a lot when tested it with Arduino Uno and after it was easier to do it for my boards.

I also tested the hot end to understand also power consumption of my machine to understand which power supply I needed to use.

After testing all components separately and all parts were tested I started to write the program for my 2 boards. These codes are final versions that work but I had a lot of challenges with I2C protocol and encoder and also added async programming because my boards always sent and received the data and it needed to be asynchronous.

Primary board

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Rotary Encoder Inputs
#define inputCLK 10
#define inputDT 1
#define inputSW 0 // switch button
int counter = 0; 
int currentStateCLK;
int previousStateCLK; 
unsigned long previousMillis = 0; 
const long interval = 1000; 
int setTemperature = 0; // Variable to hold the set temperature

void setup() { 
  // Set encoder pins as inputs  
  pinMode (inputCLK,INPUT);
  pinMode (inputDT,INPUT);
  pinMode (inputSW,INPUT_PULLUP);
  lcd.init();
  // Setup Serial Monitor
  lcd.print("T: ");
  lcd.backlight();
  // Initialize I2C communication as Master
  Wire.begin();
} 

void loop() { 
  // Read the current state of inputCLK
  currentStateCLK = digitalRead(inputCLK);
  // If the previous and the current state of the inputCLK are different then a pulse has occurred
  if (currentStateCLK != previousStateCLK){ 

    // If the inputDT state is different than the inputCLK state then the encoder is rotating counterclockwise
    if ( digitalRead(inputDT) != currentStateCLK ) { 

      counter ++; 

    } else {

      if(counter>0){
      counter --;
      }
    }
    Serial.print("Position: ");
    Serial.println(counter);
    // Update the LCD with the new temperature value
    lcd.setCursor(2, 0); // Set the cursor on the third column and first row.
    lcd.print(counter);
    lcd.print(" C   "); // Print the temperature and clear any extra characters
  } 
  // Remember the previous state of the inputCLK state
  previousStateCLK = currentStateCLK; 
  // Check if the button is pressed
  if (digitalRead(inputSW) == LOW) {
    setTemperature = counter;
    Serial.print("Temperature set to: ");
    Serial.println(setTemperature);
    lcd.setCursor(7, 0);
    lcd.print("SetT: ");
    lcd.print(setTemperature);
    lcd.print(" C   "); // Print the set temperature and clear any extra characters
    //Send the set temperature to the secondary device
    Wire.beginTransmission(0x8); // transmit to device with address 0x08
    Wire.write(setTemperature); // sends the set temperature
    Wire.endTransmission(); // stop transmitting
  }
    unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    Wire.requestFrom(0x8,1); // request 1 byte from secondary device with address 0x08
  }  
  if (Wire.available()) { // if there's a byte to read 
    int currentTemperature=1;
    currentTemperature = Wire.read(); // read the byte
    lcd.setCursor(1, 1); 
    lcd.print("CurTemp:");  
    lcd.setCursor(11,1);
    lcd.print(currentTemperature);
    lcd.print(" C   "); // Print the current temperature and clear any extra characters

 }
}

Secondary board

#include <Arduino.h>
#include <max6675.h>
#include <Wire.h>
#define MAX6675_SO 9
#define MAX6675_CS 2
#define MAX6675_SCK 10
#define I2C_Secondary_ADDRESS 0x8
#define DIR_PIN 3
#define STEP_PIN 1
#define EN_PIN 0
unsigned long previousMillis = 0;
const long interval = 500;
int desiredTemp = 80;       // Desired hot end temperature in Celsius
const int maxPower = 1023;  // Maximum power output 
int heaterPin = 8;
#define STEPS 200 
MAX6675 thermocouple(MAX6675_SCK, MAX6675_CS, MAX6675_SO);
float Kp = 5;             // Proportional gain
float Ki = 0.15;          // Integral gain
float Kd = 5;             // Derivative gain (initially zero)
float previousError = 0;  // For integral term calculation
float totalError = 0;     // For integral term calculation
int currentTemp;

void setup() {
  Serial.begin(9600);
  pinMode(DIR_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);
  pinMode(EN_PIN, OUTPUT);
  digitalWrite(EN_PIN, HIGH);
  pinMode(heaterPin, OUTPUT);
  Wire.begin(I2C_Secondary_ADDRESS);
  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);  
}

void loop() {
  float error=6;
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    currentTemp = thermocouple.readCelsius();
    error = desiredTemp - currentTemp;
    // PID calculations
    float proportionalTerm = Kp * error;
    totalError += error;  // Integrate error over time
    totalError = constrain(totalError, 0, 100);
    float integralTerm = Ki * totalError;
    float derivativeTerm = Kd * (error - previousError);  // Calculate rate of change
    previousError = error;                                // Update for next iteration
    float powerOutput = proportionalTerm + integralTerm + derivativeTerm;
    powerOutput = map(powerOutput, 0, 50, 0, maxPower);  // Adjust power based on temperature difference
    // Apply safety limits
    powerOutput = constrain(powerOutput, 0, maxPower);
    powerOutput = 255 - powerOutput;
    // Control heater based on power output (PWM or analog)
    //digitalWrite(heaterPin, 1);
    analogWrite(heaterPin, powerOutput);
  }
  if (error >= -5 && error <= 5) {
      digitalWrite(EN_PIN, LOW);
      digitalWrite(DIR_PIN, HIGH);
  for(int i = 0; i < STEPS; i++) {
    digitalWrite(STEP_PIN, HIGH);
    delayMicroseconds(8000); // this delay needed for letting the motor step
    digitalWrite(STEP_PIN, LOW);
    delayMicroseconds(8000);
  }
  }

}

void receiveEvent(int numBytes) {
  byte recivedData = 0;
  if (Wire.available()) {
    recivedData = Wire.read();
    desiredTemp = recivedData;
  }
}

void requestEvent() {
  Wire.write(currentTemp);  // send actual temperature to primary board
}

Assembling and final testing

Here is the video form assembling process.

After that I prepared the bottle. To prepare a bottle, I first removed the label and residue as well as any date markings. I smoothed the bottle surface with heat
I made cutter but it didn’t worked well. And I cut the strip with scissor. I also painted the strip with markers, to get colorful filament.

Here is the testing video.

Filament that I got.

BOM

Component Quantity Price total Link
FR1 Copper Clad - Single Sided 4x6in 4 6$ online market link
KY-040 Encoder module 1 1.5 $ online market link
LCD I2C Screen 1 6$ online market link
MAX6675 K Module for Thermocouple 1 5$ online market link
Ender hot end 1 14 $ online market link
PLA fimanet 1KG 1 15$ online market link
IRFZ44N MOSFET 1 1$ Local shop
TMC2208 V1.2 driver 1 5$ online market link
2n3904 BJT 1 0.5 $ FabLab
ATTINY1614 2 4 $ Fablab
Acrylic sheet 1 10$ Fablab
Total price 68 $

Branding

It was really hard to think of the name for my final project and that’s why I asked for help from my colleague. She asked me questions about my project what it would do, how it works, and how we need to name it to be memorable and easily recognizable․ We had a few options and chose ReBOTT. Re-recycling, BOTT- bottle. It was really easy to remember and I liked this name.

Licensing

ReBoTT by Shushanik Abovyan is licensed under Creative Commons Attribution 4.0 International license.

Conclusion

I learned a lot of new things during my final project. It was really interesting and hard at the same time. Because I had less time and because I didn’t do anything for my final project during the other weeks I needed to do it from sketch. I had to do tasks parallel to test all components and do troubleshooting at the same time. The most interesting part was the challenges that I faced.

  1. The hardest part for me was to find material for my hot end holder. At first, I tested it with MDF but it got hot and the hot end didn’t reach the desired temperature. I found a solution and used Textolite.

  2. The bottle strip width. It was really hard because I tested all possible widths. When it was thin the filament was not rounded and also was very thin. When it was thick it didn’t fit in the hot end well nozzle jammed and I had to remove it with a needle. In the end, I found the middle strip width, but it is not perfect yet for me.

  3. The stepper motor was overheating. And I found the reason. The driver’s current configuration was not appropriate. I adjusted the current limit following the instructions on this website I tested also different motor speeds and different temperatures for the bottle strip. I got the filament but it was thin. In the future, I want to continue testing and make filaments that I can use for printing.

All challenges took time but I learned a lot of new things.

If I had imagined that there would be so many challenges, I would have used my previous weeks to do the final project but I am glad to have a working final project that I can improve in the future.

I also improved my time management skills during the final project. It was a huge and great experience that I could solve problems and make my project.

Files

Arduino Codes

PCBs KiCad files

Lasercut files

3D design file