mirror of
https://github.com/DerSpatz/PCB-reflow-solder-heat-plate.git
synced 2025-02-17 18:49:15 +01:00
Added better pin debouncing, voltage references, python parsing, groundtruth measurements
This commit is contained in:
parent
29451ad11f
commit
8649afd315
3
.gitignore
vendored
3
.gitignore
vendored
@ -24,3 +24,6 @@ fp-info-cache
|
|||||||
# Exported BOM files
|
# Exported BOM files
|
||||||
*.xml
|
*.xml
|
||||||
*.csv
|
*.csv
|
||||||
|
|
||||||
|
# ipynb checkpoints
|
||||||
|
.ipynb_checkpoints
|
||||||
|
6497
Firmware/analysis/data/thermal_analysis1.log
Normal file
6497
Firmware/analysis/data/thermal_analysis1.log
Normal file
File diff suppressed because it is too large
Load Diff
6503
Firmware/analysis/data/thermal_analysis2.log
Normal file
6503
Firmware/analysis/data/thermal_analysis2.log
Normal file
File diff suppressed because it is too large
Load Diff
882
Firmware/analysis/parser.ipynb
Normal file
882
Firmware/analysis/parser.ipynb
Normal file
File diff suppressed because one or more lines are too long
@ -68,7 +68,6 @@ volatile single_button_state_t dn_button_state = BUTTON_NO_ACTION;
|
|||||||
volatile unsigned long up_state_change_time = 0;
|
volatile unsigned long up_state_change_time = 0;
|
||||||
volatile unsigned long down_state_change_time = 0;
|
volatile unsigned long down_state_change_time = 0;
|
||||||
|
|
||||||
|
|
||||||
// Temperature Info
|
// Temperature Info
|
||||||
byte max_temp_array[] = {140, 150, 160, 170, 180};
|
byte max_temp_array[] = {140, 150, 160, 170, 180};
|
||||||
byte max_temp_index = 0;
|
byte max_temp_index = 0;
|
||||||
@ -197,7 +196,6 @@ void upsw_change_isr() {
|
|||||||
up_state_change_time = millis();
|
up_state_change_time = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|
||||||
// Pin Direction control
|
// Pin Direction control
|
||||||
@ -286,13 +284,9 @@ inline void setupSensors() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setFastPwm() {
|
inline void setFastPwm() { analogWriteFrequency(64); }
|
||||||
analogWriteFrequency(64);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void setVREF() {
|
inline void setVREF() { analogReference(INTERNAL1V5); }
|
||||||
analogReference(INTERNAL1V5);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool isFirstBoot() {
|
inline bool isFirstBoot() {
|
||||||
uint8_t first_boot = EEPROM.read(FIRSTTIME_BOOT_ADDR);
|
uint8_t first_boot = EEPROM.read(FIRSTTIME_BOOT_ADDR);
|
||||||
@ -467,8 +461,10 @@ buttons_state_t getButtonsState() {
|
|||||||
unsigned long cur_time = millis();
|
unsigned long cur_time = millis();
|
||||||
buttons_state_t state = BUTTONS_NO_PRESS;
|
buttons_state_t state = BUTTONS_NO_PRESS;
|
||||||
|
|
||||||
if(button_dn == BUTTON_PRESSED && button_up == BUTTON_PRESSED && abs(button_dn_time - button_up_time) < BUTTON_PRESS_TIME) {
|
if (button_dn == BUTTON_PRESSED && button_up == BUTTON_PRESSED &&
|
||||||
if(cur_time - button_dn_time > BUTTON_PRESS_TIME && cur_time - button_up_time > BUTTON_PRESS_TIME) {
|
abs(button_dn_time - button_up_time) < BUTTON_PRESS_TIME) {
|
||||||
|
if (cur_time - button_dn_time > BUTTON_PRESS_TIME &&
|
||||||
|
cur_time - button_up_time > BUTTON_PRESS_TIME) {
|
||||||
state = BUTTONS_BOTH_PRESS;
|
state = BUTTONS_BOTH_PRESS;
|
||||||
noInterrupts();
|
noInterrupts();
|
||||||
dn_button_state = BUTTON_NO_ACTION;
|
dn_button_state = BUTTON_NO_ACTION;
|
||||||
@ -621,8 +617,8 @@ bool heat(byte max_temp, int profile_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Measure Values
|
// Measure Values
|
||||||
// TODO(HEIDT) getting the temperature from the digital sensors is by far the slowest part of this loop.
|
// TODO(HEIDT) getting the temperature from the digital sensors is by far the slowest part
|
||||||
// figure out an approach that allows control faster than sensing
|
// of this loop. figure out an approach that allows control faster than sensing
|
||||||
t = getTemp();
|
t = getTemp();
|
||||||
v = getVolts();
|
v = getVolts();
|
||||||
float max_possible_amperage = v / bed_resistance;
|
float max_possible_amperage = v / bed_resistance;
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
#include <Adafruit_MAX31865.h>
|
||||||
|
|
||||||
|
// Use software SPI: CS, DI, DO, CLK
|
||||||
|
Adafruit_MAX31865 thermo = Adafruit_MAX31865(3, 4, 5, 6);
|
||||||
|
|
||||||
|
// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
|
||||||
|
#define RREF 430.0
|
||||||
|
// The 'nominal' 0-degrees-C resistance of the sensor
|
||||||
|
// 100.0 for PT100, 1000.0 for PT1000
|
||||||
|
#define RNOMINAL 100.0
|
||||||
|
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial1.begin(9600);
|
||||||
|
thermo.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t fault = thermo.readFault();
|
||||||
|
if (fault) {
|
||||||
|
Serial.print("Fault 0x"); Serial.println(fault, HEX);
|
||||||
|
if (fault & MAX31865_FAULT_HIGHTHRESH) {
|
||||||
|
Serial.println("RTD High Threshold");
|
||||||
|
}
|
||||||
|
if (fault & MAX31865_FAULT_LOWTHRESH) {
|
||||||
|
Serial.println("RTD Low Threshold");
|
||||||
|
}
|
||||||
|
if (fault & MAX31865_FAULT_REFINLOW) {
|
||||||
|
Serial.println("REFIN- > 0.85 x Bias");
|
||||||
|
}
|
||||||
|
if (fault & MAX31865_FAULT_REFINHIGH) {
|
||||||
|
Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
|
||||||
|
}
|
||||||
|
if (fault & MAX31865_FAULT_RTDINLOW) {
|
||||||
|
Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
|
||||||
|
}
|
||||||
|
if (fault & MAX31865_FAULT_OVUV) {
|
||||||
|
Serial.println("Under/Over voltage");
|
||||||
|
}
|
||||||
|
thermo.clearFault();
|
||||||
|
}
|
||||||
|
|
||||||
|
String s;
|
||||||
|
if (Serial1.available()) {
|
||||||
|
s = Serial1.readStringUntil('\n');
|
||||||
|
Serial.println(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.indexOf("Temps") >= 0) {
|
||||||
|
Serial.print("Groundtruth ");
|
||||||
|
Serial.println(thermo.temperature(RNOMINAL, RREF));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user