agregando petalot
@ -0,0 +1,38 @@
|
|||||||
|
\* These parts are not tested by me because I did not buy them. I replaced them with things I already had.
|
||||||
|
| Qty | Name | Aliexpress (for reference) |
|
||||||
|
| ------ | --------------------------------------------------------------------------------------------- | ------------------------------------------ |
|
||||||
|
| | ----------- **Bottle Cutter** ------------ | |
|
||||||
|
| 2 | Bearing 8x22x7 mm 608ZZ | https://s.click.aliexpress.com/e/_DDu60K3 |
|
||||||
|
| \*2 | M8 Hex Bolt 60mm Full Thread (instead I use 8mm rod thereaded cut to 41 and 47mm) | https://s.click.aliexpress.com/e/_DF8rC8x |
|
||||||
|
| \*3(5) | Hex Nut M8 | https://s.click.aliexpress.com/e/_DdAzvUJ |
|
||||||
|
| \*1 | Hexagonal Bolt Partial Thread M8 40mm DIN931 | https://s.click.aliexpress.com/e/_DCCHxur |
|
||||||
|
| \*3 | Flat Washer M8 16x1x1.5 | https://s.click.aliexpress.com/e/_DdBx3SF |
|
||||||
|
| \*2 | M8 Hex Nylon Insert Lock Nut Self-locking Locknut | https://s.click.aliexpress.com/e/_At5Tpj |
|
||||||
|
| \*1 | Threaded Rod 6mm (>=48cm) (any 6mm rod will work, I used a carbon fiber rod from a kite) | https://s.click.aliexpress.com/e/_DEQQjrz |
|
||||||
|
| | ----------- **Electronics** -------------- | |
|
||||||
|
| 1 | Power Supply 12v 5A | https://s.click.aliexpress.com/e/_DEF56Ef |
|
||||||
|
| 1 | Wemos D1 MINI V3.0.0 | https://s.click.aliexpress.com/e/_9GGvad |
|
||||||
|
| 1 | Mini DC-DC 12-24V To 5V 3A Step Down | https://s.click.aliexpress.com/e/_A8abPX |
|
||||||
|
| 1 | Mini Micro Limit Switch Roller Lever Arm | https://s.click.aliexpress.com/e/_DdlHBbr |
|
||||||
|
| 1 | A4988 DRV8825 Stepper Motor Driver With Heat sink | https://s.click.aliexpress.com/e/_AMKH4t |
|
||||||
|
| 1 | Nema 17 stepper motor 42 motor height 38mm 1.2A D shaped shaft | https://s.click.aliexpress.com/e/_AfngLT |
|
||||||
|
| 1 | IRLZ44N MOSFET | https://s.click.aliexpress.com/e/_Dk1JsKh |
|
||||||
|
| 1 | Hotend MK8 Extrusion Aluminum Block 20x20x10mm with Thermistor Ceramic and Heater 12V 40W | https://s.click.aliexpress.com/e/_9QSRwl |
|
||||||
|
| 1 | capacitor 100uf 16V | https://s.click.aliexpress.com/e/_DkEQAV5 |
|
||||||
|
| 3 | pin header | https://s.click.aliexpress.com/e/_DEzMmjj |
|
||||||
|
| 3 | terminal blocks 2P | https://s.click.aliexpress.com/e/_DdfJlAb |
|
||||||
|
| 2 | 10K ohms resistors | https://s.click.aliexpress.com/e/_DBcOxjR |
|
||||||
|
| \*50cm | 2 wire cable for limit switch, digital signal | https://s.click.aliexpress.com/e/_Dlnn1bd |
|
||||||
|
| \*50cm | 2 wire cable for 5A+ | https://s.click.aliexpress.com/e/_Dlnn1bdd |
|
||||||
|
| 1 | 10A 250V Inlet Module Plug Rocker Switch Male Power Socket 3 Pin IEC320 C14 switch + Fuse New | https://s.click.aliexpress.com/e/_DmuNpxf |
|
||||||
|
| | ----------- **Hardware** ---------------- | |
|
||||||
|
| 18 | Screw M2 x 16mm (100pcs) (union between large gears and pulley) | https://s.click.aliexpress.com/e/_Dcg0sln |
|
||||||
|
| 1 | MK8 Brass Nozzle 0.4MM | https://s.click.aliexpress.com/e/_ANswWD |
|
||||||
|
| 4 | Bearing 8x22x7 mm 608ZZ | https://s.click.aliexpress.com/e/_DDu60K3 |
|
||||||
|
| 1 | Stainless Steel 90 Degree Angle Bracket Corner 20x20mm | https://s.click.aliexpress.com/e/_ACOtVF |
|
||||||
|
| \*2 | M8 x 100mm A2 Hex Head Screw Bolt (instead I use 2x 8mm rod thereaded cut to 10cm) | https://s.click.aliexpress.com/e/_AY2LNb |
|
||||||
|
| \*2(4) | M8 Hex Nylon Insert Lock Nut Self-locking Locknut | https://s.click.aliexpress.com/e/_At5Tpj |
|
||||||
|
| \*1 | M3 8mm Bolt for the motor gear | https://s.click.aliexpress.com/e/_DelUMSF |
|
||||||
|
| \*3 | M3 14mm Bolt for motor mount | https://s.click.aliexpress.com/e/_DelUMSF |
|
||||||
|
| \*50cm | Paracord 2mm(nylon string) (I used polyester thread for kite handles) | https://s.click.aliexpress.com/e/_99oV2Hv |
|
||||||
|
| \*1 | 1.7mm drill bit | https://s.click.aliexpress.com/e/_DD1SYVV |
|
@ -0,0 +1,9 @@
|
|||||||
|
# How to flash the firmware
|
||||||
|
- Install this https://github.com/esphome/esphome-flasher
|
||||||
|
- Open esphome-flasher
|
||||||
|
- Select your serial port where you have connected the wemos
|
||||||
|
- Go to browser and search and open petalot.ino.d1_mini.bin
|
||||||
|
- Press Flash ESP
|
||||||
|
- Connect your phone to the WIFI "PETALOT-XXXXXX" and browser to 192.168.4.1 (If the page does not load try deactivating your mobile data connection)
|
||||||
|
- (optional) Enter SSID, password, IP address, gateway and subnet for your local WIFI
|
||||||
|
- (optional) Open the IP address used in the previous step in your browser
|
@ -0,0 +1,195 @@
|
|||||||
|
#include <ArduinoJson.h>
|
||||||
|
#include "FS.h"
|
||||||
|
|
||||||
|
String msg;
|
||||||
|
String status;
|
||||||
|
double To;
|
||||||
|
int Vo = 0;
|
||||||
|
int Tm;
|
||||||
|
double Kp;
|
||||||
|
double Ki;
|
||||||
|
double Kd;
|
||||||
|
double Max;
|
||||||
|
String LocalIP;
|
||||||
|
String Gateway;
|
||||||
|
String Subnet;
|
||||||
|
int R1;
|
||||||
|
char ssid[64];
|
||||||
|
char password[64];
|
||||||
|
String ifttt_event_name = "petalot_stopped";
|
||||||
|
String ifttt_api_key = "";
|
||||||
|
|
||||||
|
StaticJsonDocument<512> doc;
|
||||||
|
|
||||||
|
|
||||||
|
const char *confFile = "/config.json";
|
||||||
|
|
||||||
|
|
||||||
|
String printConf() {
|
||||||
|
String confString;
|
||||||
|
serializeJson(doc, confString);
|
||||||
|
return confString;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void saveConfiguration() {
|
||||||
|
SPIFFS.remove("/config.json");
|
||||||
|
File file = SPIFFS.open("/config.json", "w");
|
||||||
|
if (!file) {
|
||||||
|
msg = "Failed to create file";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
doc["To"] = To;
|
||||||
|
doc["Vo"] = Vo;
|
||||||
|
doc["Tm"] = Tm;
|
||||||
|
doc["Kp"] = Kp;
|
||||||
|
doc["Ki"] = Ki;
|
||||||
|
doc["Kd"] = Kd;
|
||||||
|
doc["Max"] = Max;
|
||||||
|
doc["ssid"] = ssid;
|
||||||
|
doc["password"] = password;
|
||||||
|
doc["LocalIP"] = LocalIP;
|
||||||
|
doc["Subnet"] = Subnet;
|
||||||
|
doc["Gateway"] = Gateway;
|
||||||
|
doc["R1"] = R1;
|
||||||
|
doc["ifttt_event_name"] = ifttt_event_name;
|
||||||
|
doc["ifttt_api_key"] = ifttt_api_key;
|
||||||
|
if (serializeJson(doc, file) == 0) {
|
||||||
|
msg = "Failed to write to file";
|
||||||
|
}
|
||||||
|
Serial.println(printConf());
|
||||||
|
file.close();
|
||||||
|
analogWrite(PIN_HEATER, 0);
|
||||||
|
ESP.restart();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetConfiguration(){
|
||||||
|
Serial.println("reset");
|
||||||
|
strcpy(ssid, "");
|
||||||
|
strcpy(password, "");
|
||||||
|
To = 220;
|
||||||
|
Vo = 40;
|
||||||
|
Tm = 230;
|
||||||
|
Kp = 23.0;
|
||||||
|
Ki = 0.043;
|
||||||
|
Kd = 160.0;
|
||||||
|
Max = 200;
|
||||||
|
LocalIP = "";
|
||||||
|
Subnet = "255.255.255.0";
|
||||||
|
Gateway = "";
|
||||||
|
R1 = 10000;
|
||||||
|
ifttt_event_name = "";
|
||||||
|
ifttt_api_key = "";
|
||||||
|
saveConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
void readConfigurationSerial(){
|
||||||
|
StaticJsonDocument<512> docInput;
|
||||||
|
|
||||||
|
if (Serial.available() > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Deserialize the JSON document
|
||||||
|
DeserializationError error = deserializeJson(docInput, Serial);
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
Serial.println(F("deserializeJson() failed: "));
|
||||||
|
Serial.println(error.c_str());
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
//Serial.println("json ok");
|
||||||
|
doc=docInput;
|
||||||
|
//serializeJson(doc,Serial);
|
||||||
|
File file = SPIFFS.open("/config.json", "w");
|
||||||
|
if (!file) {
|
||||||
|
msg = "Failed to create file";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (serializeJson(doc, file) == 0) {
|
||||||
|
msg = "Failed to write to file";
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
Serial.println("Configuration updated, restarting...");
|
||||||
|
analogWrite(PIN_HEATER, 0);
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadConfiguration(bool reset=false) {
|
||||||
|
File file = SPIFFS.open("/config.json", "r");
|
||||||
|
if (!file) {
|
||||||
|
msg = "Failed to open /config.json";
|
||||||
|
Serial.println("Failed to open /config.json");
|
||||||
|
resetConfiguration();
|
||||||
|
analogWrite(PIN_HEATER, 0);
|
||||||
|
ESP.restart();
|
||||||
|
}
|
||||||
|
DeserializationError error = deserializeJson(doc, file);
|
||||||
|
if (error) {
|
||||||
|
msg = "Failed to read file, using default configuration";
|
||||||
|
Serial.println("Failed to read file, using default configuration");
|
||||||
|
resetConfiguration();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
strlcpy(ssid,
|
||||||
|
doc["ssid"] | "",
|
||||||
|
sizeof(ssid));
|
||||||
|
|
||||||
|
strlcpy(password,
|
||||||
|
doc["password"] | "",
|
||||||
|
sizeof(password));
|
||||||
|
|
||||||
|
To = doc["To"] | 220;
|
||||||
|
//To = Tco;
|
||||||
|
Vo = doc["Vo"] | 40;
|
||||||
|
//Vo = Vco;
|
||||||
|
Tm = doc["Tm"] | 230;
|
||||||
|
Kp = doc["Kp"]?doc["Kp"].as<double>():23.0;
|
||||||
|
Ki = doc["Ki"]?doc["Ki"].as<double>():0.043;
|
||||||
|
Kd = doc["Kd"]?doc["Kd"].as<double>():160.0;
|
||||||
|
Max = doc["Max"]?doc["Max"].as<double>():200;
|
||||||
|
LocalIP = doc["LocalIP"] | "";
|
||||||
|
Subnet = doc["Subnet"] | "255.255.255.0";
|
||||||
|
Gateway = doc["Gateway"] | "";
|
||||||
|
R1 = doc["R1"] | 10000;
|
||||||
|
ifttt_event_name = doc["ifttt_event_name"] | "";
|
||||||
|
ifttt_api_key = doc["ifttt_api_key"] | "";
|
||||||
|
|
||||||
|
Serial.println();
|
||||||
|
Serial.println("To:Temperature");
|
||||||
|
Serial.println("Vo:Speed");
|
||||||
|
Serial.println("Tm:Maximum Temperature");
|
||||||
|
Serial.println("Kp:Kp");
|
||||||
|
Serial.println("Ki:Ki");
|
||||||
|
Serial.println("Kd:Kd");
|
||||||
|
Serial.println("R1:R1");
|
||||||
|
Serial.println("Max:Maximum value for MOSFET (0-255)");
|
||||||
|
Serial.println("ssid:SSID");
|
||||||
|
Serial.println("password:SSID Password");
|
||||||
|
Serial.println("LocalIP:IP address");
|
||||||
|
Serial.println("Subnet:Subnet");
|
||||||
|
Serial.println("Gateway:Gateway");
|
||||||
|
Serial.println("ifttt_event_name:IFTTT Event Name");
|
||||||
|
Serial.println("ifttt_api_key:IFTTT API Key");
|
||||||
|
Serial.println(printConf());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void initConf() {
|
||||||
|
|
||||||
|
if (!SPIFFS.begin()) {
|
||||||
|
msg = "Error mounting the file system";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadConfiguration();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
#include <PID_v1.h>
|
||||||
|
|
||||||
|
|
||||||
|
double T; //current temp
|
||||||
|
|
||||||
|
bool F = false;
|
||||||
|
bool Fc = false;
|
||||||
|
bool Fi = false;
|
||||||
|
|
||||||
|
double Output; //pid output
|
||||||
|
|
||||||
|
PID myPID(&T, &Output, &To, Kp, Ki, Kd, DIRECT);
|
||||||
|
|
||||||
|
double tempLastSample;
|
||||||
|
double tempLastFilament;
|
||||||
|
double tempLastNoFilament;
|
||||||
|
double tempLastStart;
|
||||||
|
|
||||||
|
//thermistor
|
||||||
|
float logR2, R2;
|
||||||
|
//steinhart-hart coeficients for thermistor
|
||||||
|
float c1 = 0.8438162826e-03, c2 = 2.059601750e-04, c3 = 0.8615484887e-07;
|
||||||
|
|
||||||
|
double Thermistor(float Volts) {
|
||||||
|
R2 = R1 * (1023.0 / (float)Volts - 1.0); //calculate resistance on thermistor
|
||||||
|
|
||||||
|
logR2 = log(R2);
|
||||||
|
T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2)); // temperature in Kelvin
|
||||||
|
T = T - 273.15; //convert Kelvin to Celcius
|
||||||
|
return T;
|
||||||
|
}
|
||||||
|
|
||||||
|
void start(){
|
||||||
|
if (tempLastStart==0){
|
||||||
|
status = "working";
|
||||||
|
V = Vo;
|
||||||
|
tempLastStart = millis();
|
||||||
|
if (tempLastStart==0) tempLastStart = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop(){
|
||||||
|
status = "stopped";
|
||||||
|
V = 0;
|
||||||
|
tempLastStart = 0;
|
||||||
|
ifttt();
|
||||||
|
}
|
||||||
|
|
||||||
|
void initHotend(){
|
||||||
|
myPID.SetTunings(Kp, Ki, Kd);
|
||||||
|
myPID.SetOutputLimits(0,Max);
|
||||||
|
pinMode(LED_BUILTIN , OUTPUT);
|
||||||
|
pinMode(PIN_FILAMENT , INPUT);
|
||||||
|
if (status=="") start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void hotendReadTempTask() {
|
||||||
|
if (status == "stopped" && myPID.GetMode() == AUTOMATIC){
|
||||||
|
myPID.SetMode(MANUAL);
|
||||||
|
Output = 0;
|
||||||
|
}
|
||||||
|
if (status == "working" && myPID.GetMode() != AUTOMATIC){
|
||||||
|
myPID.SetMode(AUTOMATIC);
|
||||||
|
}
|
||||||
|
if (millis() >= tempLastSample + 100)
|
||||||
|
{
|
||||||
|
Thermistor(analogRead(PIN_THERMISTOR)); //Volt to temp, update T
|
||||||
|
if (T > Tm || isnan(T)){
|
||||||
|
Output = 0;
|
||||||
|
} else {
|
||||||
|
myPID.Compute();
|
||||||
|
}
|
||||||
|
if (status == "working"){
|
||||||
|
start();
|
||||||
|
if (T > 150 || T > To + 20 ) {
|
||||||
|
digitalWrite(LED_BUILTIN , LOW);// target temperature ready
|
||||||
|
} else {
|
||||||
|
digitalWrite(LED_BUILTIN , !digitalRead(LED_BUILTIN));//reaching tarjet temp
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
digitalWrite(LED_BUILTIN , HIGH);
|
||||||
|
}
|
||||||
|
|
||||||
|
analogWrite(PIN_HEATER, Output);
|
||||||
|
|
||||||
|
Fc = digitalRead(PIN_FILAMENT);
|
||||||
|
|
||||||
|
if (Fc && !F) {
|
||||||
|
tempLastFilament = millis();
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Fc && F) {
|
||||||
|
tempLastFilament = 0;
|
||||||
|
tempLastNoFilament = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
F = Fc;
|
||||||
|
|
||||||
|
if (Fc && tempLastFilament > 0 && millis() >= tempLastFilament + 3*1000){
|
||||||
|
Fi = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Fc && Fi && tempLastNoFilament > 0 && millis() >= tempLastNoFilament + 500) { // no filament
|
||||||
|
stop();
|
||||||
|
tempLastNoFilament = 0;
|
||||||
|
Fi = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Fc && !Fi && tempLastStart > 0 && millis() >= tempLastStart + 5*60*1000) { // no filament for 5 min
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
tempLastSample = millis();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
#include <ArduinoOTA.h>
|
||||||
|
|
||||||
|
bool debugMode = false;
|
||||||
|
|
||||||
|
void initOTA() {
|
||||||
|
|
||||||
|
ArduinoOTA.onStart([]() {
|
||||||
|
String type;
|
||||||
|
if (ArduinoOTA.getCommand() == U_FLASH) {
|
||||||
|
type = "sketch";
|
||||||
|
} else {
|
||||||
|
type = "filesystem";
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("Start updating " + type);
|
||||||
|
});
|
||||||
|
ArduinoOTA.onEnd([]() {
|
||||||
|
Serial.println("\nEnd");
|
||||||
|
});
|
||||||
|
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
||||||
|
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
|
||||||
|
});
|
||||||
|
ArduinoOTA.onError([](ota_error_t error) {
|
||||||
|
Serial.printf("Error[%u]: ", error);
|
||||||
|
if (error == OTA_AUTH_ERROR) {
|
||||||
|
Serial.println("Auth Failed");
|
||||||
|
} else if (error == OTA_BEGIN_ERROR) {
|
||||||
|
Serial.println("Begin Failed");
|
||||||
|
} else if (error == OTA_CONNECT_ERROR) {
|
||||||
|
Serial.println("Connect Failed");
|
||||||
|
} else if (error == OTA_RECEIVE_ERROR) {
|
||||||
|
Serial.println("Receive Failed");
|
||||||
|
} else if (error == OTA_END_ERROR) {
|
||||||
|
Serial.println("End Failed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ArduinoOTA.begin();
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
#include "pins.hpp"
|
||||||
|
#include "conf.hpp"
|
||||||
|
#include "wifi.hpp"
|
||||||
|
#include "stepper.hpp"
|
||||||
|
#include "hotend.hpp"
|
||||||
|
#include "server.hpp"
|
||||||
|
#include "ota.hpp"
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
delay(1000);
|
||||||
|
initConf();
|
||||||
|
initWiFi();
|
||||||
|
initOTA();
|
||||||
|
initHotend();
|
||||||
|
initStepper();
|
||||||
|
InitServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
wifiTask();
|
||||||
|
server.handleClient();
|
||||||
|
hotendReadTempTask();
|
||||||
|
stepperRunTask();
|
||||||
|
ArduinoOTA.handle();
|
||||||
|
readConfigurationSerial();
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
#define PIN_EN D1
|
||||||
|
#define PIN_STEP D2
|
||||||
|
#define PIN_DIR D3
|
||||||
|
|
||||||
|
#define PIN_THERMISTOR A0
|
||||||
|
#define PIN_HEATER D0
|
||||||
|
|
||||||
|
//v1 and v1.1
|
||||||
|
#define PIN_FILAMENT D7
|
@ -0,0 +1,31 @@
|
|||||||
|
#include <AccelStepper.h>
|
||||||
|
|
||||||
|
int V;
|
||||||
|
|
||||||
|
AccelStepper stepper(AccelStepper::FULL2WIRE,PIN_STEP,PIN_DIR);
|
||||||
|
|
||||||
|
int stepsPerRevolution = 200;
|
||||||
|
|
||||||
|
bool stepperEnable = false;
|
||||||
|
|
||||||
|
void initStepper(){
|
||||||
|
stepper.setPinsInverted(true,false,true); //set enable pin inverted
|
||||||
|
stepper.setEnablePin(PIN_EN);
|
||||||
|
stepper.disableOutputs();
|
||||||
|
stepper.setMaxSpeed(40*stepsPerRevolution+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stepperRunTask(){
|
||||||
|
if (status == "stopped" && stepperEnable) {
|
||||||
|
stepper.disableOutputs();
|
||||||
|
stepperEnable = false;
|
||||||
|
}
|
||||||
|
if (status == "working" && !stepperEnable) {
|
||||||
|
stepper.enableOutputs();
|
||||||
|
stepperEnable = true;
|
||||||
|
}
|
||||||
|
if (status == "working") {
|
||||||
|
stepper.setSpeed(Vo*stepsPerRevolution);
|
||||||
|
stepper.runSpeed();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include <ESP8266HTTPClient.h>
|
||||||
|
#include <ESP8266mDNS.h>
|
||||||
|
|
||||||
|
bool apmode = false;
|
||||||
|
IPAddress local_ip;
|
||||||
|
|
||||||
|
double tempLastWifiTask;
|
||||||
|
double tempStartWifiTask;
|
||||||
|
bool wifiReady = false;
|
||||||
|
String IpAddress2String(const IPAddress& ipAddress)
|
||||||
|
{
|
||||||
|
return String(ipAddress[0]) + String(".") +\
|
||||||
|
String(ipAddress[1]) + String(".") +\
|
||||||
|
String(ipAddress[2]) + String(".") +\
|
||||||
|
String(ipAddress[3]) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AP(){
|
||||||
|
apmode = true;
|
||||||
|
WiFi.disconnect(true);
|
||||||
|
IPAddress local_IP(192,168,4,1);
|
||||||
|
IPAddress gateway(192,168,4,1);
|
||||||
|
IPAddress subnet(255,255,255,0);
|
||||||
|
WiFi.softAPConfig(local_IP, gateway, subnet);
|
||||||
|
|
||||||
|
unsigned char mac[6];
|
||||||
|
char APNAME[40];
|
||||||
|
WiFi.macAddress(mac);
|
||||||
|
|
||||||
|
sprintf(APNAME, "PETALOT-%02X%02X%02X", mac[3], mac[4], mac[5]);
|
||||||
|
if (WiFi.softAP(APNAME)) {
|
||||||
|
Serial.println("AP Ready");
|
||||||
|
apmode = true;
|
||||||
|
}else{
|
||||||
|
Serial.println("AP Failed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wifiTask(){
|
||||||
|
if (!wifiReady){
|
||||||
|
if (millis() >= tempLastWifiTask + 500){
|
||||||
|
if (WiFi.status() == WL_CONNECTED) {
|
||||||
|
MDNS.begin("Petalot");
|
||||||
|
Serial.println();
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
wifiReady=true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (WiFi.status() == WL_CONNECT_FAILED) {
|
||||||
|
AP();
|
||||||
|
wifiReady=true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (millis() >= tempStartWifiTask + 10000){
|
||||||
|
AP();
|
||||||
|
wifiReady=true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Serial.print(".");
|
||||||
|
tempLastWifiTask = millis();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void initWiFi()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!ssid){
|
||||||
|
AP();
|
||||||
|
wifiReady=true;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
IPAddress localip;
|
||||||
|
localip.fromString(LocalIP.c_str());
|
||||||
|
IPAddress subnet;
|
||||||
|
subnet.fromString(Subnet.c_str());
|
||||||
|
IPAddress gatewayip;
|
||||||
|
gatewayip.fromString(Gateway.c_str());
|
||||||
|
Serial.print("Connecting to ");
|
||||||
|
Serial.print(ssid);
|
||||||
|
WiFi.begin(ssid, password); //Conexión a la red
|
||||||
|
if (!WiFi.config(localip, gatewayip, subnet,IPAddress(8, 8, 8, 8))) {
|
||||||
|
Serial.println("config wifi ips failed");
|
||||||
|
}
|
||||||
|
tempStartWifiTask = millis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ifttt(String value_1="", String value_2="", String value_3="")
|
||||||
|
{
|
||||||
|
if (ifttt_event_name=="" || ifttt_api_key=="") return 0;
|
||||||
|
WiFiClient client;
|
||||||
|
HTTPClient http;
|
||||||
|
http.begin(client, "http://maker.ifttt.com/trigger/" +
|
||||||
|
ifttt_event_name+"/with/key/"+ifttt_api_key+
|
||||||
|
"?value1="+value_1+"&value2="+value_2+"&value3="+value_3);
|
||||||
|
int httpCode = http.GET();
|
||||||
|
http.end();
|
||||||
|
return httpCode;
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
# Petalot
|
||||||
|
|
||||||
|
## De botella de plástico PET a filamento 3D
|
||||||
|
|
||||||
|
### Si prefieres que yo te fabrique la maquina y el cortador enviame un email a functionddd@gmail.com con el pais de envio y encantado te responderé con un presupuesto. ###
|
||||||
|
|
||||||
|
Empieza aqui: [Preguntas frecuentes](https://function3d.xyz/)
|
||||||
|
|
||||||
|
![Petalot](https://github.com/function3d/petalot/raw/master/Media/petalot_v1.1.jpg)
|
||||||
|
![Petalot](https://github.com/function3d/petalot/raw/master/Media/petalot_v1.1_2.jpg)
|
||||||
|
|
||||||
|
Este es tu projecto si eres una persona concienciada por el medio ambiente, imprimes en 3D por hobby, tienes conocimientos basicos de electronica y te gusta hacer cosas.
|
||||||
|
|
||||||
|
## Lista de materiales necesarios
|
||||||
|
- [BOM](https://github.com/function3d/petalot/blob/master/BOM.md)
|
||||||
|
|
||||||
|
## Electronica
|
||||||
|
|
||||||
|
![electronics](https://github.com/function3d/petalot/raw/master/Schematic/electronics.jpg)
|
||||||
|
- [BOM](https://github.com/function3d/petalot/blob/master/BOM.md) for electronics parts.
|
||||||
|
- [Gerber para la fabricacion de la PCB](https://github.com/function3d/petalot/raw/master/Schematic/Gerber_v1.1_2023-01-02.zip)
|
||||||
|
- [Esquema electrónico](https://github.com/function3d/petalot/tree/master/Schematic)
|
||||||
|
- [Firmware](https://github.com/function3d/petalot/tree/master/Firmware)
|
||||||
|
- [Before switching on the electronics for the first time](https://github.com/function3d/petalot/blob/5b1d409dda7f66e7040381943212c45b0bf8b62b/before%20you%20switching%20on%20the%20electronics.md)
|
||||||
|
|
||||||
|
## STLs
|
||||||
|
- [carpeta con los STLs](https://github.com/function3d/petalot/tree/master/STLs)
|
||||||
|
![petalot](https://github.com/function3d/petalot/raw/master/STLs/petalot_v1.1.png)
|
||||||
|
|
||||||
|
## Cortador de botellas
|
||||||
|
- [carpeta con los STLs](https://github.com/function3d/petalot/tree/master/STLs/Cutter)
|
||||||
|
- [Video de youtube de como hacerlo](https://www.youtube.com/watch?v=eTBnhKWMYQk)
|
||||||
|
![Cortado de botellas](https://github.com/function3d/petalot/raw/master/STLs/Cutter/bottlecutter.jpg)
|
||||||
|
|
||||||
|
## Donaciones
|
||||||
|
[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=CESEXLEFEU65Q)
|
||||||
|
[![Paypal](https://i.imgur.com/SEshqeh.png)](https://www.paypal.com/donate/?hosted_button_id=CESEXLEFEU65Q)
|
||||||
|
|
||||||
|
## Redes
|
||||||
|
Sigueme en [Youtube](https://www.youtube.com/channel/UC4UBuZ5YRTo5XYFUxdkmqkg), [Tiktok](https://www.tiktok.com/@function.3d) and [Instagram](https://www.instagram.com/function.3d/) para mas tutoriales e información.
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 233 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 710 KiB |
After Width: | Height: | Size: 2.0 MiB |
@ -0,0 +1,43 @@
|
|||||||
|
# Petalot
|
||||||
|
|
||||||
|
[en Español](https://github.com/function3d/petalot/blob/master/LEEME.md)
|
||||||
|
|
||||||
|
## From PET Bottle To 3D Filament
|
||||||
|
|
||||||
|
### If you prefer that I manufacture the machine and the cutter send me an email to functionddd@gmail.com with the shipping country and I will be happy to reply with a quote. ###
|
||||||
|
|
||||||
|
Start here: [FAQs](https://function3d.xyz/)
|
||||||
|
|
||||||
|
![Petalot](https://github.com/function3d/petalot/raw/master/Media/petalot_v1.1.jpg)
|
||||||
|
![Petalot](https://github.com/function3d/petalot/raw/master/Media/petalot_v1.1_2.jpg)
|
||||||
|
|
||||||
|
This is your project if you are an environmentally conscious person, you 3D print for hobby, you have basic notions of electronics and you like to make things.
|
||||||
|
|
||||||
|
## Bill of material
|
||||||
|
- [BOM](https://github.com/function3d/petalot/blob/master/BOM.md)
|
||||||
|
|
||||||
|
## Electronics
|
||||||
|
|
||||||
|
![electronics](https://github.com/function3d/petalot/raw/master/Schematic/electronics.jpg)
|
||||||
|
- [See BOM](https://github.com/function3d/petalot/blob/master/BOM.md) for electronics parts.
|
||||||
|
- [Gerber for PCB fabrication](https://github.com/function3d/petalot/raw/master/Schematic/Gerber_v1.1_2023-01-02.zip)
|
||||||
|
- [Schematic](https://github.com/function3d/petalot/tree/master/Schematic)
|
||||||
|
- [Firmware](https://github.com/function3d/petalot/tree/master/Firmware)
|
||||||
|
- [Before switching on the electronics for the first time](https://github.com/function3d/petalot/blob/5b1d409dda7f66e7040381943212c45b0bf8b62b/before%20you%20switching%20on%20the%20electronics.md)
|
||||||
|
## STLs
|
||||||
|
- [STLs folder](https://github.com/function3d/petalot/tree/master/STLs)
|
||||||
|
![petalot](https://github.com/function3d/petalot/raw/master/STLs/petalot_v1.1.png)
|
||||||
|
|
||||||
|
## Bottle cutter
|
||||||
|
- [STLs folder](https://github.com/function3d/petalot/tree/master/STLs/Cutter)
|
||||||
|
- [Youtube video how to make it](https://www.youtube.com/watch?v=eTBnhKWMYQk)
|
||||||
|
![Bottle cutter](https://github.com/function3d/petalot/raw/master/STLs/Cutter/bottlecutter.jpg)
|
||||||
|
|
||||||
|
## Donation
|
||||||
|
[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=CESEXLEFEU65Q)
|
||||||
|
[![Paypal](https://i.imgur.com/SEshqeh.png)](https://www.paypal.com/donate/?hosted_button_id=CESEXLEFEU65Q)
|
||||||
|
|
||||||
|
## Social
|
||||||
|
Follow me on [Youtube](https://www.youtube.com/channel/UC4UBuZ5YRTo5XYFUxdkmqkg), [Tiktok](https://www.tiktok.com/@function.3d) and [Instagram](https://www.instagram.com/function.3d/) for more tutorials and information.
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
My digital files are exclusively reserved for private and personal use. It means not selling the model or any derivative of the model for economic or financial gain.
|
||||||
|
|
||||||
|
[License](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
||||||
|
|
||||||
|
|
After Width: | Height: | Size: 348 KiB |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,3 @@
|
|||||||
|
My digital files are exclusively reserved for private and personal use. It means not selling the model or any derivative of the model for economic or financial gain.
|
||||||
|
|
||||||
|
[License](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
After Width: | Height: | Size: 683 KiB |
After Width: | Height: | Size: 791 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 430 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 270 KiB |
After Width: | Height: | Size: 333 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 335 KiB |
@ -0,0 +1,24 @@
|
|||||||
|
# Before switching on the electronics for the first time
|
||||||
|
## Set to 5V output on D3 DC-DC step down
|
||||||
|
### Option 1
|
||||||
|
- You put 12v between IN and GND
|
||||||
|
- With a multimeter you measure VO and GND
|
||||||
|
- Turn the potentiometer until you measure 5V
|
||||||
|
### Option 2
|
||||||
|
- Cut the jumper on ADJ
|
||||||
|
- Put a drop of tin on the 5V jumper
|
||||||
|
|
||||||
|
|
||||||
|
# Adjust the reference voltage of the stepper drive
|
||||||
|
You have to adjust it to supply 1A to the motor, this way the motor will hardly heat up and it will have enough power.
|
||||||
|
- Turn off the electronics
|
||||||
|
- Disconnect the motor
|
||||||
|
- Turn on the electronics
|
||||||
|
- Stop from the web interface so that the hotend is not heating up
|
||||||
|
- Measure the voltage between the small potentiometer on the driver and ground
|
||||||
|
- Turn the potentiometer until you measure is about 0.4V (0.4*2.5=1A)
|
||||||
|
- Once adjusted, turn off the electronics
|
||||||
|
- Connect the motor
|
||||||
|
- Turn on the electronics again
|
||||||
|
|
||||||
|
Never connect/disconnect the motor with the electronic on
|