*Note the "things" section of this page does not have accurate equipment information. Its just to give an idea what this project is using.
Equipment:
- Creality Ender3 Extruder Module
- Arduino Module
- PWM Module
This part is pretty straight forward. Use the button to jump over the break in the breadboard bridge. One wire will connect one corner of the button and a digital pin (4) for reading, while the other will connect to the other corner and Arduino Ground. When reading the button state, (in this case). 1 will mean the button is not pressed, while 0 will mean the button is pressed.
The following if found in the code for operating the button:
void setup(){
pinMode(4, INPUT_PULLUP);
}
void loop(){
int button = digitalRead(4);
if (button == 0){
/*actuate the stepper*/
}
}
Stepper Motor (Bipolar)This Bipolar stepper motor is used as a "pump" to force the filament into the Hot-End for melting. Stepper motors are a little tricky to control without the use of a library, and trying to use one without a library is out of scope for this project. So we wont use one. We'll be using the guide from: https://docs.arduino.cc/learn/electronics/stepper-motors. This shows us how to control a stepper motor using a Bipolar stepper motor and Quadruple H-bridge. We'll call the library, set the steps per revolution, set the speed, and actuate it once the button has been pressed. We'll need 5V to power the stepper motor and H-bridge. We'll be using pins 8, 9, 10, & 11 for actuating the stepper motor.
The following if found in the code for operating the stepper motor:
#include <Stepper.h>
int stepsPerRevolution 200;
Stepper stepper(stepsPerRevolution , 8, 9, 10, 11);
void setup(){
stepper.setSpeed(20);
}
void loop(){
stepper.step(-10);
delay(100);
}
ThermistorThe thermistor is a sensor used to read the temperature of the hotend to ensure it does not over heat and damage other parts of the extruder module. It appears that the thermistor found within the module is rated at 100K Ohms for room temperature, has a thermal coefficient of 3950, and is a NTC type (where resistance drops with increase in temperature). We'll reduce the current using a 100K Ohm resistor in series and use a analog pin (A0) to read the thermistor. We'll power is using 5V. Make sure to ground the arduino to the common ground so that the arduino has a reference voltage to sense from. For reference, I found this link to be useful: https://projecthub.arduino.cc/Marcazzan_M/81ae74bf-ba05-4813-ba39-572254cf3942
The following if found in the code for operating the thermistor:
#define THERMISTOR_PIN A0
const long Resistor = 100000.0;
const long TempResistance = 100000.0;
const int ThermoCoeff = 3950;
void setup(){
pinMode(THERMISTOR_PIN,INPUT);
}
void loop(){
float analogtemp = analogRead(A3);
delay(100);
}
Everything else from here is just converting the analog value to a temperature reading:
float analogtemp = analogRead(A3);
float tempvoltageMV = map(analogtemp, 0.0, 1023.0, 0.0, 5000.0);
float tempvoltage = tempvoltageMV / 1000.0;
float VoltageOut = (5.0 - tempvoltage);
float thermistorResistance = tempvoltage / (VoltageOut/(Resistor));
float ln = log(thermistorResistance / TempResistance);
float thermistortemperatureK = (1.0 / ((ln / ThermoCoeff) + (1.0 / (25.0+273.15))));
float thermistortemperatureC = thermistortemperatureK - 273.15;
float thermistortemperatureF = (thermistortemperatureC *1.8) +32.0 ;
Serial.println(thermistortemperatureF);
Hot-EndLast but certainly not least: the Hot-End. This device is used to melt the PLA for FDM printing. This device operates on 24V. Controlling heat with temperature is a little tricky, since using a typical "bang-bang" controller could create unwanted oscillation in temperature that we dont want. So'll for now we'll use a P controller. Where the greater the temperature error is (difference between the temperature we want and the temperature we have), the more power we give to the heater using the PWM controller. The PWM module will be controlled with digital pin (5). Vin and GND will come from the 24V source, and the hot-end will wire into the V+ and V- ports.
The following if found in the code for operating the Hot-End:
float maxtemp = 200.0;
float kp = 12;
float Perror = 0;
void setup(){
pinMode(5, OUTPUT);
}
void loop(){
Perror = abs(maxtemp - thermistortemperatureF);
float heaterpower = (kp * Perror);
if (thermistortemperatureF <= maxtemp) {
analogWrite(5, heaterpower);
}
else{
analogWrite(5,0);
}
delay(100);
}
Please reference the full code to operate all components as a system.
Comments
Please log in or sign up to comment.