Toby Chui 1 éve
szülő
commit
f571196d08

+ 26 - 2
README.md

@@ -1,3 +1,27 @@
-# PD_Reflow_Hoteplate
+# PD Reflow Hoteplate
 
-DIY USB PD powered automatic hotplatae
+DIY USB PD powered automatic hotplatae
+
+
+
+## LED Signals
+
+Yellow LED: Preheat
+
+Red LED: Reflow
+
+
+
+The whole reflow process will have the following LED signals
+
+- Preheat slow blinking (2s): Standby
+
+- Preheat fast blinking (0.5s): Starting reflow process in 10 seconds
+
+- Preheat on: Preheating
+
+- Reflow on: Reflowing
+
+- Reflow slow blinking: Reflow completed
+
+Press STOP button to restore to Standby state

+ 7 - 0
autopush.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+echo Enter commit notes:
+read commitmsg
+git pull
+git add *
+git commit -m "$commitmsg"
+git push

+ 109 - 0
firmware/reflow/reflow.ino

@@ -0,0 +1,109 @@
+/*
+ * 60W PD Powered Automatic Reflow Hoteplate
+ * Author: tobychui
+ * 
+ * Notes: 
+ * Temperature sensing is done using 1k 1% resistor and a 10k Thermistor
+ * You might need to change the code if you are using other values
+ * 
+ * Touch Button Mappings
+ * Start Btn: P1.4
+ * Stop Btn: P1.7
+ */
+#include <TouchKey.h>
+
+#define TEMP_PIN 11 //P1.1
+#define HEATER_PIN 34 //P3.4
+#define LED_PREHEAT 15 //P1.5
+#define LED_REFLOW 16 //P1.6
+
+#define HOLDSTART_TIME 100 //in cycles
+#define COOLDOWN_TEMP_ADC 255 //Room temperature
+//Preheat power settings
+#define PREHEAT_TEMP_ADC 155 //160 degree C
+#define PREHEAT_PWR_PWM 150 //160 degree C
+
+//Reflow power settings
+#define REFLOW_TEMP_ADC 123 //220 degree C
+#define REFLOW_PWR_PWM 255
+
+#define CUTOFF_TEMP_ADC 100 //240 degree C, overheat cutoff
+
+//Func def
+void updateHeaterPowerState();
+void updateKeyStates();
+int readTemp();
+
+
+//Runtimes
+bool reflowing = false;
+int startCountdown = HOLDSTART_TIME; //Hold for 1000ms to start
+int currentHeatplateTemp = 0; //Converted temperature in degree C (rounded)
+int cycleCounter = 0; //Record cycle time up to 10 seconds
+bool blinkState = false; //If blinking this will be switching between true and false
+bool reflowComplete = false; //Indicate if the stopping is done because of reflow complete
+
+int targetTempADC = 255; //Target ADC reading to reach, 255 = room temperature
+int targetPwrPWM = 0; //Target PWM cycle for heater, 255 = full power, 0 = off
+int offset = 1; //Allow +-offset for the ADC reading before reheating / cooling
+
+void setup() {
+  //Enable the touch buttons
+  //Enable all 6 channels:TIN2(P1.4),TIN5(P1.7)
+  TouchKey_begin((1 << 2) | (1 << 5));
+
+  //Set LED pins to output
+  pinMode(LED_PREHEAT, OUTPUT);
+  pinMode(LED_REFLOW, OUTPUT);
+  digitalWrite(LED_PREHEAT, LOW);
+  digitalWrite(LED_REFLOW, LOW);
+
+  //Set temp sense pin to input
+  pinMode(TEMP_PIN, INPUT);
+
+  //Set mosfet control pins to output and disable it
+  pinMode(HEATER_PIN, OUTPUT);
+  digitalWrite(HEATER_PIN, LOW);
+}
+
+
+void loop() {
+  //Check key status
+  updateKeyStates();
+
+  //Update current temperature value
+  if (reflowing){
+    //Reflowing. cycle time = 100ms
+    updateHeaterPowerState();
+  }else{
+    //Standby, cycle time = 10ms
+    digitalWrite(HEATER_PIN, LOW);
+    if (cycleCounter%200 == 0){
+      if (reflowComplete){
+        //Reflow done blink
+        if (blinkState){
+          digitalWrite(LED_REFLOW, HIGH);
+        }else{
+          digitalWrite(LED_REFLOW, LOW);
+        }
+      }else{
+        //Standby blink
+        if (blinkState){
+          digitalWrite(LED_PREHEAT, HIGH);
+        }else{
+          digitalWrite(LED_PREHEAT, LOW);
+        }
+      }
+      
+      blinkState = !blinkState;
+    }
+    delay(10);
+  }
+
+  //Cycle printout
+  //USBSerial_println("cycle");
+  cycleCounter++;
+  if (cycleCounter > 10000){
+    cycleCounter = 0;
+  }
+}

+ 11 - 0
firmware/reflow/signals.ino

@@ -0,0 +1,11 @@
+//When the reflow starts, preheat leds will fast blink 
+//to indicate auto reflow will start in 5 seconds
+void playStartingLEDBlinks(){
+  digitalWrite(LED_PREHEAT, LOW);
+  for(int i = 0; i < 10; i++){
+    digitalWrite(LED_PREHEAT, HIGH);
+    delay(200);
+    digitalWrite(LED_PREHEAT, LOW);
+    delay(200);
+  }
+}

+ 84 - 0
firmware/reflow/utils.ino

@@ -0,0 +1,84 @@
+//Read Temp read the current temperature of the hotplate
+/*
+ * Read Current temperature from ADC
+ * The ADC is reading from a voltage divider
+ * 5V --- 1k Ohm --- (ADC) --- 100k NTC --- GND
+ * 
+ * ADC Reading / Temperature (degree C)
+ * 250 / 25 
+ * 225 / 100 
+ * 155 / 160 (Preheat Temp)
+ * 123 / 220 (Reflow Temp)
+ * 100 / 240 (Hard cutoff Temp)
+ * 
+ * Each reading takes around 100ms
+ */
+int readTemp() {
+  int numReadings = 10; // Number of readings to average
+  int totalSensorValue = 0;
+  
+  for (int i = 0; i < numReadings; ++i) {
+    totalSensorValue += analogRead(TEMP_PIN);
+    delay(10); // Optional: add a small delay between readings if needed
+  }
+
+  // Calculate the average sensor value
+  int averageSensorValue = totalSensorValue / numReadings;
+  
+  return averageSensorValue;
+}
+
+//Update heater power state base on temp reading
+//The hotter the plate, the smaller the ADC reading
+void updateHeaterPowerState(){
+  int currentADC = readTemp();
+  if (currentADC <= CUTOFF_TEMP_ADC){
+    digitalWrite(HEATER_PIN, LOW);
+    USBSerial_println("!!! OVERHEAT !!!");
+    return;
+  }
+  if (currentADC > targetTempADC + offset){
+    //Temperature too low. Turn on the heater
+    analogWrite(HEATER_PIN, targetPwrPWM);
+    USBSerial_print("+ ");
+    USBSerial_println(currentADC);
+  }else if (currentADC < targetTempADC - offset){
+    //Temperature too high. Turn off the heater
+    analogWrite(HEATER_PIN, 0);
+    USBSerial_print("- ");
+    USBSerial_println(currentADC);
+  }else{
+    //Within range. Keep the current state
+  }
+}
+
+//Update Key States handle touch button events listening and global state update
+void updateKeyStates(){
+  TouchKey_Process();
+  uint8_t touchResult = TouchKey_Get();
+
+  //Start button, require hold down for 3 seconds to start
+  if (touchResult & (1 << 2)) {
+    startCountdown--;
+    if (startCountdown <=0){
+      /* START REFLOW PROCESS - PREHEAT */
+      USBSerial_println("!!! Reflow Started !!!");
+      reflowing = true;
+      startCountdown = 0; //Prevent it from going underflow
+      playStartingLEDBlinks(); //Play fast blink start warning
+      targetTempADC = PREHEAT_TEMP_ADC; //Set the target temp to preheat
+      targetPwrPWM = PREHEAT_PWR_PWM; //Set power rating to preheat
+      digitalWrite(LED_PREHEAT, HIGH); //Light up the preheat LED
+    }
+  } else {
+    //Touch released
+    startCountdown = HOLDSTART_TIME;
+  }
+
+  //Stop button, stop immediately
+  if (touchResult & (1 << 5)) {
+    reflowing= false;
+    USBSerial_println("Reflow Stopped");
+    targetTempADC = COOLDOWN_TEMP_ADC;
+  }
+}

BIN
model/OldVersions/base.0012.ipt


BIN
model/base.ipt


BIN
model/base.stl


BIN
pcb/Gerber_PCB_Reflow Hotplate v3.zip


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 31 - 0
pcb/PCB_PCB_Reflow Hotplate v3_2023-10-23.json


BIN
schematic/CH552G.png


BIN
schematic/IP2721.png


BIN
schematic/Reflow curve.png


Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott