v00.01
This commit is contained in:
parent
6ab1458705
commit
2decfb37cc
|
@ -0,0 +1,10 @@
|
|||
const int buzzer = 5;
|
||||
|
||||
void Buzzer_Init(void) {
|
||||
pinMode(buzzer, OUTPUT);
|
||||
tone(buzzer, 8000, 200);
|
||||
}
|
||||
|
||||
void Buzzer_Task(void) {
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifdef U8X8_HAVE_HW_SPI
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
#ifdef U8X8_HAVE_HW_I2C
|
||||
#include <Wire.h>
|
||||
#endif
|
||||
|
||||
//U8G2_ST7920_128X64_1_HW_SPI(rotation, cs [, reset]) [page buffer, size = 128 bytes]
|
||||
//U8G2_ST7920_128X64_2_HW_SPI(rotation, cs [, reset]) [page buffer, size = 256 bytes]
|
||||
//U8G2_ST7920_128X64_F_HW_SPI(rotation, cs [, reset]) [full framebuffer, size = 1024 bytes]
|
||||
U8G2_ST7920_128X64_2_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8);
|
||||
|
||||
void Display_Init(void) {
|
||||
u8g2.begin();
|
||||
}
|
||||
|
||||
void Display_Task(void) {
|
||||
char text[10] = {0};
|
||||
|
||||
u8g2.firstPage();
|
||||
do {
|
||||
u8g2.drawLine(0,15,128,15); // horizontale oben
|
||||
u8g2.drawLine(64,16,64,48); // senkrechte mitte
|
||||
u8g2.drawLine(0,49,128,49); // horizontale unten
|
||||
u8g2.setFont(u8g2_font_ncenB10_tf);
|
||||
u8g2.drawStr(1,12,process.title);
|
||||
u8g2.setFont(u8g2_font_ncenB14_tf);
|
||||
sprintf(text,"%3d C",round(process.temp));
|
||||
u8g2.drawStr(0,31,text);
|
||||
sprintf(text,"%3d C",round(oven_temp));
|
||||
u8g2.drawStr(0,47,text);
|
||||
sprintf(text,"%02d:%02d",process.timer / 60, process.timer % 60);
|
||||
u8g2.drawStr(66,31,text);
|
||||
sprintf(text,"%02d:%02d",process.countdown / 60, process.countdown % 60);
|
||||
u8g2.drawStr(66,47,text);
|
||||
} while ( u8g2.nextPage() );
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
Encoder rotEncoder(2, 3);
|
||||
|
||||
void Encoder_Init(void) {
|
||||
Serial.print("Encoder position: ");
|
||||
Serial.println(EncPos);
|
||||
}
|
||||
|
||||
void Encoder_Task(void) {
|
||||
long newEncPos;
|
||||
newEncPos = rotEncoder.read();
|
||||
|
||||
if (newEncPos != EncPos) {
|
||||
Serial.print("Encoder position = ");
|
||||
Serial.print(newEncPos);
|
||||
Serial.println();
|
||||
EncPos = newEncPos;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
void Reflow_Init(void) {
|
||||
profile[0].preheat_rate = 1;
|
||||
profile[0].preheat_temp = 130;
|
||||
profile[0].preheat_time = 20;
|
||||
profile[0].reflow_rate = 0.5;
|
||||
profile[0].reflow_temp = 235;
|
||||
profile[0].reflow_time = 40;
|
||||
|
||||
process.profile = profile[0];
|
||||
process.phase = 0;
|
||||
process.timer = 0;
|
||||
process.countdown = 5;
|
||||
process.temp = 0;
|
||||
sprintf(process.title,"Ready");
|
||||
}
|
||||
|
||||
void Reflow_Task(void) {
|
||||
switch (process.phase) {
|
||||
case 0: // standby
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 1;
|
||||
sprintf(process.title,"1/4 PreHeat");
|
||||
process.temp = process.profile.preheat_temp;
|
||||
process.countdown = 10;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: // preheat aufheizen
|
||||
process.timer++;
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 2;
|
||||
sprintf(process.title,"2/4 PreHeat");
|
||||
process.countdown = 10;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2: // preheat temp halten
|
||||
process.timer++;
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 3;
|
||||
sprintf(process.title,"3/4 Reflow");
|
||||
process.temp = process.profile.reflow_temp;
|
||||
process.countdown = 10;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3: // reflow aufheizen
|
||||
process.timer++;
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 4;
|
||||
sprintf(process.title,"4/4 Reflow");
|
||||
process.countdown = 10;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4: // reflow temp halten
|
||||
process.timer++;
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 5;
|
||||
sprintf(process.title,"Cooldown");
|
||||
process.temp = 0;
|
||||
process.countdown = 10;
|
||||
tone(buzzer, 2000, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5: // auskühlen
|
||||
if (process.countdown > 0) {
|
||||
process.countdown--;
|
||||
if (process.countdown == 0) {
|
||||
process.phase = 0;
|
||||
process.timer = 0;
|
||||
sprintf(process.title,"Ready");
|
||||
process.countdown = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
process.phase = 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
#include <Arduino.h>
|
||||
#include <U8g2lib.h>
|
||||
#include <Encoder.h>
|
||||
//#include "Adafruit_MAX31855.h"
|
||||
#include "max6675.h"
|
||||
|
||||
struct reflow_profile
|
||||
{
|
||||
float preheat_rate;
|
||||
float preheat_temp;
|
||||
int preheat_time;
|
||||
|
||||
float reflow_rate;
|
||||
float reflow_temp;
|
||||
float reflow_time;
|
||||
} profile[4];
|
||||
|
||||
struct reflow_process
|
||||
{
|
||||
reflow_profile profile;
|
||||
int phase; // 0 = standby, 1 = heizen, 2 = preheat, 3 = heizen, 4 = reflow, 5 = cooldown
|
||||
int countdown; // timer
|
||||
int timer;
|
||||
char title[20];
|
||||
float temp; // zieltemperatur
|
||||
} process;
|
||||
|
||||
float oven_temp = 0.0;
|
||||
long EncPos = 0;
|
||||
unsigned long timer100 = 0;
|
||||
unsigned long timer500 = 0;
|
||||
unsigned long timer1000 = 0;
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.println("Reflow Controller v00.01");
|
||||
|
||||
Encoder_Init();
|
||||
Buzzer_Init();
|
||||
Display_Init();
|
||||
Thermo_Init();
|
||||
Reflow_Init();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
Encoder_Task();
|
||||
|
||||
if (millis() > 100 + timer100) { // alle 100ms
|
||||
timer100 = millis();
|
||||
|
||||
Buzzer_Task();
|
||||
}
|
||||
|
||||
if (millis() > 500 + timer500) { // alle 500ms
|
||||
timer500 = millis();
|
||||
|
||||
Thermo_Task();
|
||||
}
|
||||
|
||||
if (millis() > 1000 + timer1000) { // alle 1s
|
||||
timer1000 = millis();
|
||||
|
||||
Reflow_Task();
|
||||
}
|
||||
|
||||
Display_Task(); // so oft wie möglich
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#define MAXDO 7
|
||||
#define MAXCS 8
|
||||
#define MAXCLK 9
|
||||
|
||||
MAX6675 thermocouple(MAXCLK, MAXCS, MAXDO);
|
||||
|
||||
void Thermo_Init(void) {
|
||||
|
||||
}
|
||||
|
||||
void Thermo_Task(void) {
|
||||
oven_temp = thermocouple.readCelsius();
|
||||
}
|
Loading…
Reference in New Issue