Skip to content

Commit

Permalink
second version code nearly finished and functional. only for low temp…
Browse files Browse the repository at this point in the history
… bismuth solder so far
  • Loading branch information
rallekralle11 committed Nov 15, 2022
1 parent 7b4d4ba commit 56274a2
Show file tree
Hide file tree
Showing 4 changed files with 254 additions and 44 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion 50x70_tiny.kicad_prl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"board": {
"active_layer": 37,
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": false,
"hidden_nets": [],
Expand Down
43 changes: 0 additions & 43 deletions tiny/tiny.ino
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ int target, lasttarget, conval, phase;
int fet = 255; //power sent to the heater
bool heat = 0, lastheat, test;

long sn64pb37[] {150, 60000, 160, 120000, 230, 20000}; //reflow temps and time. preheat 150C for 60000ms, soak 160 for 120000ms, reflow 230 for 20000ms
long sac305[] {150, 60000, 170, 120000, 250, 15000}; //first two are from compuphase
long Sn42Bi576Ag04[] {90, 5000, 110, 90000, 165, 5000}; //this one's based on chipquik paste
long testarray[] {30, 5000, 40, 10000, 50, 10000};

long *values;

int paste = 2; //used to cycle between temps, starts at bismuth mix temps

long getmillis, startmillis, timer;
Expand Down Expand Up @@ -157,42 +150,6 @@ void loop(){
}*/
}

if(phase == 0){ //if the first phase is active
target = values[0]; //get the starting temp and time
timer = values[1];

}
if(phase == 1){
target = values[2]; //next values
timer = values[3];
}
if(phase == 2){
target = values[4]; //next values
timer = values[5];
}
if(phase == 3){ //when it gets to this phase, shut down heater and reset the counter
phase == 0;
heat == 0;
}

if(T == target & !test){ //start timer and make sure it only runs once
startmillis = getmillis;
test = 1;
}
if(getmillis > (startmillis + timer)){ //if the timer's run out, run this
phase++;
test = 0;
}

if(target > T){
analogWrite(1, fet); //set heating power
oled.setCursor(0, 0);
oled.print("H"); //for heating
}
}
else{
analogWrite(1, 0);
}

lasttarget = target;
lasttemp = T2;
Expand Down
253 changes: 253 additions & 0 deletions tinycode2/tinycode2.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
#include <SmoothThermistor.h>

#include <TinyWireM.h>
#include <USI_TWI_Master.h>

#include <Tiny4kOLED.h>

float T;
float lasttemp;

int cal = 1;
int avgtemp;

int paste = 0;
int stage = 0;

bool heat = 0;

long startmillis;
long targetmillis;

SmoothThermistor therm(A3, ADC_SIZE_10_BIT, 100000, 100000, 3950, 25, 5);


void setup(){
pinMode(1, OUTPUT);

oled.begin();
oled.setFont(FONT8X16);
oled.on();


//SmoothThermistor smoothThermistor(A0, // the analog pin to read from
// ADC_SIZE_10_BIT, // the ADC size
// 10000, // the nominal resistance
// 10000, // the series resistance
// 3950, // the beta coefficient of the thermistor
// 25, // the temperature for nominal resistance
// 10); // the number of samples to take for each measurement

}

void loop(){

T = therm.temperature();

avgtemp = T;

if(avgtemp != lasttemp){ //checks if the temps or targets have changed and only then updates the screen
oled.clear();
}

oled.setCursor(0, 0);
oled.print(avgtemp);

while(analogRead(A2) > 300 & analogRead(A2) < 550){ //probably overcomplicated button-reading
while(analogRead(A2) > 300 & analogRead(A2) < 550){ //checks if you're holding the button
oled.clear();
oled.setCursor(0, 0);
oled.print("Settings changed to:");
delay(500);
paste++;

if(paste == 4){ //cycle back
paste = 0;
}

if(paste == 0){
oled.clear();
oled.setCursor(0, 0);
oled.print("Sn64 Pb37");
delay(1000);
}

if(paste == 1){
oled.clear();
oled.setCursor(0, 0);
oled.print("SAC 305");
delay(1000);
}

if(paste == 2){
oled.clear();
oled.setCursor(0, 0);
oled.print("Sn42 Bi57,6 Ag\n0,6");
delay(1000);
}

if(paste == 3){
oled.clear();
oled.setCursor(0, 0);
oled.print("testval");
delay(1000);
}
oled.clear();
}
}



while(analogRead(A2) > 600){ //more overcomplicated button-reading
while(analogRead(A2) > 600){}
oled.clear();
oled.setCursor(0, 0);
oled.print("Heat enabled");
delay(1000);
heat = 1;
oled.clear();
}


if(heat && paste == 0){
sn64();
}

if(heat && paste == 1){
SAC();
}

if(heat && paste == 2){
sn42();
}

lasttemp = avgtemp;
}

/*
Sn64 Pb37 soak 125C 90 sec, reflow 230C
SAC 305 soak 160C 90 sec, reflow 250C
Sn42 Bi57,6 Ag\n0,6 soak 110C 90 sec, reflow 165C
*/

void sn64(){

}

void SAC(){

}

void sn42(){
startmillis = millis();
while(1){
T = therm.temperature();
avgtemp = T;

// if(avgtemp != lasttemp){ //checks if the temps or targets have changed and only then updates the screen
oled.clear();
// }

oled.setCursor(0, 0);
oled.print(avgtemp);

oled.setCursor(25, 0);
oled.print("C");

analogWrite(1, 255);

oled.setCursor(0, 26);
oled.print("heating");

if(avgtemp >= 110){
break;
}

delay(500);
// lasttemp = T;
}

while(1){
T = therm.temperature();
avgtemp = T;

oled.setCursor(0, 0);
oled.print(avgtemp);

oled.setCursor(0, 26);
oled.print("soaking");

if(avgtemp < 110){
analogWrite(1, 255);
}
else{
analogWrite(1, 0);
}
if(millis() > startmillis + 90000){
break;
}

delay(500);

lasttemp = T;
}




while(1){
T = therm.temperature();
avgtemp = T;

// if(avgtemp != lasttemp){ //checks if the temps or targets have changed and only then updates the screen
oled.clear();
// }

oled.setCursor(0, 0);
oled.print(avgtemp);

oled.setCursor(25, 0);
oled.print("C");

analogWrite(1, 255);

oled.setCursor(0, 26);
oled.print("heating");

if(avgtemp >= 160){
break;
}

delay(500);
// lasttemp = T;
}

startmillis = millis();

while(1){
T = therm.temperature();
avgtemp = T;

oled.setCursor(0, 0);
oled.print(avgtemp);

oled.setCursor(0, 26);
oled.print("reflowing");

if(avgtemp < 160){
analogWrite(1, 255);
}
else{
analogWrite(1, 0);
}
if(millis() > startmillis + 60000){
break;
}

delay(500);

lasttemp = T;
}
digitalWrite(1, 0);
heat == 0;
}

0 comments on commit 56274a2

Please sign in to comment.