Hello,
I'm putting together a project for a machine that manufactures 3D filament from a PET bottle.
So far the circuit looks like this:
The circuit is not finished yet, because this way it just turns the engine on/off, informs the status on the display and also informs the RPM. However, a temperature control for the printer nozzle via PID, inductive sensors to control the actual RPM and the status of the filament manufacturing process and a module for connection with a smartphone to function as a supervisory will still be placed in the circuit.
However, with this circuit I already have problems. I can turn on the circuit and put it to work normally, but as I increase the engine RPM, the circuit starts to lose power until everything turns off (display and engine). I've tested it by feeding the circuit only with the arduino, I've tried feeding it only with an external 5V source and I've also tried it with both. However, in all cases the same problem occurs.
Could anyone tell me what could be wrong?
I'll leave the code used so far below:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(32,16,2);
int valor=0;
int botao = 9;
int sensor = 8;
int tip = 10;
int estadoBotao = 0;
void setup(){
pinMode(botao, INPUT);
pinMode(sensor, INPUT);
pinMode(tip, OUTPUT);
lcd.begin(16,2);
lcd.init();
lcd.backlight();
}
void loop(){
estadoBotao = digitalRead(botao);
if(estadoBotao == LOW){
analogWrite(tip,0);
lcd.setCursor(0,0);
lcd.print("EXTRUSORA");
lcd.setCursor(0,1);
lcd.print("DESLIGADA");
delay(1000);
}
else{
lcd.clear();
lcd.print("EXTRUSORA");
lcd.setCursor(0,1);
lcd.print("LIGADA");
valor=map(analogRead(A3),0,1023,0,255);
Serial.print("Valor lido=");
Serial.println(valor);
delay(1000);
analogWrite(tip,valor);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("ROTACAO:");
lcd.setCursor(0,1);
lcd.print(valor);
lcd.print("rpm");
delay(5000);
}
if(digitalRead(sensor) == HIGH){
analogWrite(tip,0);
estadoBotao = 0;
}
}
