https://reprap.org/mediawiki/api.php?action=feedcontributions&user=TedHuntington&feedformat=atomRepRap - User contributions [en]2024-03-28T20:27:07ZUser contributionsMediaWiki 1.30.0https://reprap.org/mediawiki/index.php?title=Toaster_Oven_Reflow_Technique&diff=176971Toaster Oven Reflow Technique2016-09-28T23:04:48Z<p>TedHuntington: added link to Reflow_Toaster_Oven_using_Thermistor</p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow<br />
|status = working<br />
<!--Image--><br />
|image = smt-ga.jpg<br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = Adrianbowyer<br />
}}<br />
<br />
[[File:smt-ga.jpg|500px]]<br />
<br />
See also [[HotplateReflowTechnique]] and [[Reflow_Toaster_Oven_using_Thermistor]].<br />
<br />
==Introduction==<br />
<br />
[[File:sb-smt.jpg|300px|right]]<br />
<br />
This page describes how to reflow solder surface mount printed circuits using a cheap toaster oven. It owes a great deal to Nophead's [http://hydraraptor.blogspot.com/2009/12/cooking-with-hydraraptor.html Cooking with Hydraraptor blog post].<br />
<br />
The picture shows Sally Bowyer (Director, [http://reprapltd.com RepRap Ltd]) preparing components for soldering in the oven. For more instructions on this see the video at the bottom of this page.<br />
<br />
==Safety==<br />
<br />
This uses mains electricity, which will kill you if you touch it. So don't.<br />
<br />
It makes things hot (solder melting temperatures), which will burn you if you touch them. So don't.<br />
<br />
Solder contains lead. Lead is bad for you. Don't use the oven you use for this for food. <br />
<br />
<br clear="all"><br />
<br />
==Equipment==<br />
<br />
[[File:toaster-oven.jpg|300px|right]]<br />
<br />
The toaster oven we use is [http://www.argos.co.uk/webapp/wcs/stores/servlet/Search?storeId=10001&catalogId=1500002901&langId=-1&searchTerms=4234810 this 900W one from Argos in the UK]. It costs £25.<br />
<br />
Just about any toaster oven will do, as long as its power rating is not too high. The solid-state relay (see below) can switch 5A; power = volts x amps; do the mathematics...<br />
<br />
Try to get one with quartz halogen heaters though - these respond very fast to being switched on and off, which is good.<br />
<br />
<br clear="all"><br />
<br />
[[File:arduino.jpg|300px|right]]<br />
<br />
You will also need an [http://arduino.cc Arduino] to control it. Just about any Arduino will do; we use the Arduino Diecimila, because we happened to have a few lying about.<br />
<br />
Finally, you need a solid-state relay so the Arduino can turn the oven on and off, and a temperature sensor that will do up to 250<sup>o</sup>C.<br />
<br />
We use [http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1200289 this solid-state relay from Farnell], and a K-type thermocouple plus thermocouple amplifier (see below). Alternatively you could use the same types of thermistors that RepRap uses for its extruders as temperature sensors - the temperatures are about the same.<br />
<br />
<br clear="all"><br />
<br />
==Control==<br />
<br />
[[File:Thermocouple_1.0_schematic.png|500px|right]]<br />
<br />
This is the circuit diagram of the thermocouple amplifier. IC1 is an [http://science.cdu.edu.ua/files/pdf/1.pdf AD595]. It needs a [http://uk.rs-online.com/web/p/thermocouples/4094908/ Type K thermocouple].<br />
<br />
MakerBot sell a [http://store.makerbot.com/electronics/electronics-kits/thermocouple-sensor-v1-0-kit.html kit for the amplifier here].<br />
<br />
The thermocouple connects to pins 1 and 14. You can't solder thermocouple wire, so have a screw connector for those pins.<br />
<br />
If you get silly temperatures reported by the firmware (see below) or the warning LED lights, then the thermocouple wires are the wrong way round. Swap them.<br />
<br />
JP1 connects to the Arduino:<br />
<br />
* JP1 pin 1 -> Arduino +5v.<br />
* JP1 pin 2 -> Arduino A<sub>0</sub>.<br />
* JP1 pin 3 -> Arduino Ground.<br />
<br />
If you get noise problems on the temperature signal, solder a 100uF capacitor between Vcc and ground. Take care to get the capacitor polarity right.<br />
<br />
<br clear="all"><br />
<br />
[[File:ss-relay.jpg|300px|right]]<br />
<br />
The [http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1200289 solid-state relay] has four connections. Two go in series with the mains live wire. The other two turn the mains current on and off.<br />
<br />
The neatest thing to do with the solid-state relay is to mount it inside a mains plug patress box. You will then have a general-purpose device that will allow you to control any mains load (up to 5A) with the Arduino. Run the control wires out of the side of the box and connect them to the Arduino: + goes to the Arduino LED (D13 on an Arduino Diecimila), the other control connection goes to the Arduino ground.<br />
<br />
Note that there is no electrical connection inside the solid-state relay between the control circuit and the mains circuit. The device is optically coupled, so there is no danger that you will get mains flowing through your Arduino (as long as you wire things up right...).<br />
<br />
<br />
<br clear="all"><br />
<br />
[[File:ss-relay-etc.jpg|300px|right]]<br />
<br />
The picture shows the control system, which is all screwed down to a small wood plank. <br />
<br />
On the left is the electric socket. This is open so you can see the solid-state relay mounted inside. <br />
<br />
Run a mains cable with a plug on the end into the electric socket to power the oven.<br />
<br />
Put the relay's switched side in series with the cable's live wire on the way to the live terminal of the socket; run the neutral and earth straight through to their socket terminals. Insulate any exposed live connections carefully with heat-shrink. Run two wires from the control pins to the Arduino as described above. Colour code them so you can remember which one is + when the electric socket is put back together.<br />
<br />
In the middle is the Arduino, and on the right is the thermocouple amplifier.<br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the Arduino control program. This has an inbuilt temperature vs. time profile that it follows. The basic rules are: <br />
<br />
# heat up to 150<sup>o</sup>C - this is the flux activation temperature<br />
# heat up more slowly to 183<sup>o</sup>C - this is the solder's melting point<br />
# heat up faster to 215<sup>o</sup>C - this is the reflow temperature<br />
# cool<br />
<br />
The timings are not too critical, but you don't want the components to stay at the highest temperature for too long. The highest temperature is set to 215<sup>o</sup>C, but you will find that this overshoots a bit to 220<sup>o</sup>C, which is the actual temperature you want.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermocouple<br />
<br />
int temperature()<br />
{<br />
return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime, target, temp"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
// One second has passed<br />
<br />
time++; <br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
} else<br />
{<br />
heatState = LOW;<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print(", ");<br />
Serial.print(tg);<br />
Serial.print(", ");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermocouple to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermocouple lead, taking care that there is slack thermocouple lead in the oven so the PCB doesn't move when you do this.<br />
<br />
Hold the reset button on the Arduino down, then turn on the mains power.<br />
<br />
Let the reset button go.<br />
<br />
The device should cycle through its range of temperatures and solder your board.<br />
<br />
The oven won't cool as fast as the control curve demands, so open the door when the temperature is on its way down and the target temperature drops below 200<sup>o</sup>C.<br />
<br />
Don't move the PCB until its temperature gets down to around 150<sup>o</sup>C. If you move it while the solder is still molten the components may shift.<br />
<br />
You will find that the temperature lags behind the profile at the start (up to around 100<sup>o</sup>C), especially for large PCBs. This doesn't matter; it's the higher temperatures that are important, and the oven and controller will follow those quite faithfully.<br />
<br />
You may want to use a bit of scrap board the very first time you try it, as a test.<br />
<br />
If you are doing lots of boards, you can just press the reset button after you put each one in the oven. When each board is finished the controller will keep the oven switched off until you next press reset.<br />
<br />
==Video==<br />
<br />
<videoflash type="vimeo">33188183</videoflash><br />
<br />
[[Category:Electronics manufacturing]]</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=Reflow_Toaster_Oven_using_Thermistor&diff=176970Reflow Toaster Oven using Thermistor2016-09-28T23:03:19Z<p>TedHuntington: added 2 more images and link to stl files</p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow With Thermistor<br />
|status = working<br />
<!--Image--><br />
|image = IMG 20160816 203312.jpg<br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = TedHuntington<br />
}}<br />
<br />
[[File:IMG 20160816 203312.jpg|500px]]<br />
http://reprap.org/wiki/File:<br />
<br />
<br />
See also [[Toaster_Oven_Reflow_Technique]] and [[HotplateReflowTechnique]].<br />
<br />
==Introduction==<br />
<br />
<!--[[File:sb-smt.jpg|300px|right]]--><br />
[[File:IMG_20160816_203330.jpg|500px]]<br />
[[File:IMG_20160816_203520.jpg|500px]]<br />
<br />
This page shows hot to use a toaster oven to reflow solder mount printed circuit boards adapted from this technique: [[Toaster_Oven_Reflow_Technique]] with two main differences: 1) it uses a thermistor instead of a thermocouple and 2) it waits for the toaster oven to reach the target temperature before incrementing the timer counter.<br />
<br />
In addition, there is a 3D printable case here [http://www.thingiverse.com/thing:1796449] that uses a standard Arduino Uno, 120V relay, and power sockets easily found on Ebay ro Aliexpress.<br />
<br />
<!--[[File:arduino.jpg|300px|right]]--><br />
<br />
<br clear="all"><br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the original Arduino control program with the above mentioned adaptations.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
//2016-08-14 rev02- changed to wait until temperature is reached before incrementing timer - TPH<br />
//2016-02-06 rev01- adapted by Ted Huntington for a thermistor<br />
//with help from: http://iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor which is Copyright (C) 2012 Sam Davies<br />
#include <math.h><br />
<br />
double ThermistorResistor = 4700; //resistor used to voltage divide with the resistance of the thermistor<br />
double ThermistorBeta = 3950; //Thermistor Beta<br />
double ThermistorRefTemp = 298.15; //thermistor reference termperature (in Kelvin)<br />
double ThermistorRefResistance = 100000; //Thermistor Reference Resistance 100k ohms<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermister<br />
<br />
int temperature()<br />
{<br />
int ADCValue;<br />
double ADCVoltage;<br />
double Temp,TempC,TempF;<br />
double Resistance;<br />
<br />
//for thermocouple with amplifier:<br />
// return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
<br />
//<br />
ADCValue=analogRead(tempPin);<br />
ADCVoltage = float(ADCValue) / 1024 * 5;<br />
Serial.print("ADC: ");<br />
Serial.print(ADCVoltage);<br />
Serial.print("V ");<br />
Resistance= ThermistorResistor / (5 / ADCVoltage - 1);<br />
Temp = 1.0 / (1.0/ThermistorRefTemp + log(Resistance / ThermistorRefResistance) / ThermistorBeta);<br />
TempC = Temp - 273.15; // Convert Kelvin to Celcius<br />
TempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit<br />
Serial.print("Temp: ");<br />
Serial.print(TempF);<br />
Serial.print("F ");<br />
Serial.print(TempC);<br />
Serial.println("C");<br />
return((int)TempC);<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime\ttarget\ttemp (C)"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
<br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
<br />
//only increment timer if current temperature is >= target temp- <br />
//otherwise PCB might be underheated- and overheating for a few seconds is not too big a concern+++++++++++++<br />
if (t >= tg) //current temp is less than target temp<br />
{ <br />
// One second has passed<br />
time++; <br />
} <br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
Serial.println("on");<br />
} else<br />
{<br />
heatState = LOW;<br />
Serial.println("off");<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print("\t");<br />
Serial.print(tg);<br />
Serial.print("\t");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
(adapted from [[Toaster_Oven_Reflow_Technique]])<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermistor inside the oven or to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermistor lead, taking care that there is slack so the PCB doesn't move when you do this.<br />
<br />
Once the Arduino is connected to a computer via USB, the code should start running.<br />
[[Category:Electronics manufacturing]]</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=Reflow_Toaster_Oven_using_Thermistor&diff=176368Reflow Toaster Oven using Thermistor2016-08-17T23:54:47Z<p>TedHuntington: </p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow With Thermistor<br />
|status = working<br />
<!--Image--><br />
|image = IMG 20160816 203312.jpg<br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = TedHuntington<br />
}}<br />
<br />
[[File:IMG 20160816 203312.jpg|500px]]<br />
<br />
<br />
See also [[Toaster_Oven_Reflow_Technique]] and [[HotplateReflowTechnique]].<br />
<br />
==Introduction==<br />
<br />
<!--[[File:sb-smt.jpg|300px|right]]--><br />
<br />
This page shows hot to use a toaster oven to reflow solder mount printed circuit boards adapted from this technique: [[Toaster_Oven_Reflow_Technique]] with two main differences: 1) it uses a thermistor instead of a thermocouple and 2) it waits for the toaster oven to reach the target temperature before incrementing the timer counter.<br />
<br />
In addition, there is a 3D printable case that uses a standard Arduino Uno, 120V relay, and power sockets easily found on Ebay ro Aliexpress.<br />
<br />
<!--[[File:arduino.jpg|300px|right]]--><br />
<br />
<br clear="all"><br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the original Arduino control program with the above mentioned adaptations.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
//2016-08-14 rev02- changed to wait until temperature is reached before incrementing timer - TPH<br />
//2016-02-06 rev01- adapted by Ted Huntington for a thermistor<br />
//with help from: http://iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor which is Copyright (C) 2012 Sam Davies<br />
#include <math.h><br />
<br />
double ThermistorResistor = 4700; //resistor used to voltage divide with the resistance of the thermistor<br />
double ThermistorBeta = 3950; //Thermistor Beta<br />
double ThermistorRefTemp = 298.15; //thermistor reference termperature (in Kelvin)<br />
double ThermistorRefResistance = 100000; //Thermistor Reference Resistance 100k ohms<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermister<br />
<br />
int temperature()<br />
{<br />
int ADCValue;<br />
double ADCVoltage;<br />
double Temp,TempC,TempF;<br />
double Resistance;<br />
<br />
//for thermocouple with amplifier:<br />
// return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
<br />
//<br />
ADCValue=analogRead(tempPin);<br />
ADCVoltage = float(ADCValue) / 1024 * 5;<br />
Serial.print("ADC: ");<br />
Serial.print(ADCVoltage);<br />
Serial.print("V ");<br />
Resistance= ThermistorResistor / (5 / ADCVoltage - 1);<br />
Temp = 1.0 / (1.0/ThermistorRefTemp + log(Resistance / ThermistorRefResistance) / ThermistorBeta);<br />
TempC = Temp - 273.15; // Convert Kelvin to Celcius<br />
TempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit<br />
Serial.print("Temp: ");<br />
Serial.print(TempF);<br />
Serial.print("F ");<br />
Serial.print(TempC);<br />
Serial.println("C");<br />
return((int)TempC);<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime\ttarget\ttemp (C)"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
<br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
<br />
//only increment timer if current temperature is >= target temp- <br />
//otherwise PCB might be underheated- and overheating for a few seconds is not too big a concern+++++++++++++<br />
if (t >= tg) //current temp is less than target temp<br />
{ <br />
// One second has passed<br />
time++; <br />
} <br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
Serial.println("on");<br />
} else<br />
{<br />
heatState = LOW;<br />
Serial.println("off");<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print("\t");<br />
Serial.print(tg);<br />
Serial.print("\t");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
(adapted from [[Toaster_Oven_Reflow_Technique]])<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermistor inside the oven or to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermistor lead, taking care that there is slack so the PCB doesn't move when you do this.<br />
<br />
Once the Arduino is connected to a computer via USB, the code should start running.<br />
[[Category:Electronics manufacturing]]</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=File:Reflow_Oven_Lid_rev01.stl&diff=176367File:Reflow Oven Lid rev01.stl2016-08-17T23:51:53Z<p>TedHuntington: 3D STL file of the lid to the Reflow Taoster Oven using thermistor 3D printed case</p>
<hr />
<div>3D STL file of the lid to the Reflow Taoster Oven using thermistor 3D printed case</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=File:Reflow_Oven_rev04_(repaired).stl&diff=176366File:Reflow Oven rev04 (repaired).stl2016-08-17T23:50:48Z<p>TedHuntington: 3D STL file of Reflow oven case - houses Arduino Uno and relay.</p>
<hr />
<div>3D STL file of Reflow oven case - houses Arduino Uno and relay.</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=File:IMG_20160816_203520.jpg&diff=176365File:IMG 20160816 203520.jpg2016-08-17T23:43:54Z<p>TedHuntington: Inside electronics of Reflow Toaster Oven using Thermistor</p>
<hr />
<div>Inside electronics of Reflow Toaster Oven using Thermistor</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=File:IMG_20160816_203330.jpg&diff=176364File:IMG 20160816 203330.jpg2016-08-17T23:43:02Z<p>TedHuntington: 3D printed case for Arduino and relay of Reflow Toaster Oven using thermistor</p>
<hr />
<div>3D printed case for Arduino and relay of Reflow Toaster Oven using thermistor</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=Reflow_Toaster_Oven_using_Thermistor&diff=176363Reflow Toaster Oven using Thermistor2016-08-17T23:41:27Z<p>TedHuntington: </p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow With Thermistor<br />
|status = working<br />
<!--Image--><br />
|image = IMG 20160816 203312.jpg<br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = TedHuntington<br />
}}<br />
<br />
[[File:IMG 20160816 203312.jpg|500px]]<br />
<br />
<br />
See also [[Toaster_Oven_Reflow_Technique]] and [[HotplateReflowTechnique]].<br />
<br />
==Introduction==<br />
<br />
<!--[[File:sb-smt.jpg|300px|right]]--><br />
<br />
This page shows hot to use a toaster oven to reflow solder mount printed circuit boards adapted from this technique: [[Toaster_Oven_Reflow_Technique]] with two main differences: 1) it uses a thermistor instead of a thermocouple and 2) it waits for the toaster oven to reach the target temperature before incrementing the timer counter.<br />
<br />
In addition, there is a 3D printable case that uses a standard Arduino Uno, 120V relay, and power sockets easily found on Ebay ro Aliexpress.<br />
<br />
<!--[[File:arduino.jpg|300px|right]]--><br />
<br />
<br clear="all"><br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the original Arduino control program with the above mentioned adaptations.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
//2016-08-14 rev02- changed to wait until temperature is reached before incrementing timer - TPH<br />
//2016-02-06 rev01- adapted by Ted Huntington for a thermistor<br />
//with help from: http://iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor which is Copyright (C) 2012 Sam Davies<br />
#include <math.h><br />
<br />
double ThermistorResistor = 4700; //resistor used to voltage divide with the resistance of the thermistor<br />
double ThermistorBeta = 3950; //Thermistor Beta<br />
double ThermistorRefTemp = 298.15; //thermistor reference termperature (in Kelvin)<br />
double ThermistorRefResistance = 100000; //Thermistor Reference Resistance 100k ohms<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermister<br />
<br />
int temperature()<br />
{<br />
int ADCValue;<br />
double ADCVoltage;<br />
double Temp,TempC,TempF;<br />
double Resistance;<br />
<br />
//for thermocouple with amplifier:<br />
// return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
<br />
//<br />
ADCValue=analogRead(tempPin);<br />
ADCVoltage = float(ADCValue) / 1024 * 5;<br />
Serial.print("ADC: ");<br />
Serial.print(ADCVoltage);<br />
Serial.print("V ");<br />
Resistance= ThermistorResistor / (5 / ADCVoltage - 1);<br />
Temp = 1.0 / (1.0/ThermistorRefTemp + log(Resistance / ThermistorRefResistance) / ThermistorBeta);<br />
TempC = Temp - 273.15; // Convert Kelvin to Celcius<br />
TempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit<br />
Serial.print("Temp: ");<br />
Serial.print(TempF);<br />
Serial.print("F ");<br />
Serial.print(TempC);<br />
Serial.println("C");<br />
return((int)TempC);<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime\ttarget\ttemp (C)"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
<br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
<br />
//only increment timer if current temperature is >= target temp- <br />
//otherwise PCB might be underheated- and overheating for a few seconds is not too big a concern+++++++++++++<br />
if (t >= tg) //current temp is less than target temp<br />
{ <br />
// One second has passed<br />
time++; <br />
} <br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
Serial.println("on");<br />
} else<br />
{<br />
heatState = LOW;<br />
Serial.println("off");<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print("\t");<br />
Serial.print(tg);<br />
Serial.print("\t");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
(adapted from [[Toaster_Oven_Reflow_Technique]])<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermistor inside the oven or to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermocouple lead, taking care that there is slack thermocouple lead in the oven so the PCB doesn't move when you do this.<br />
<br />
Once the Arduino is connected to a computer via USB, the code should start running.<br />
[[Category:Electronics manufacturing]]</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=Reflow_Toaster_Oven_using_Thermistor&diff=176362Reflow Toaster Oven using Thermistor2016-08-17T23:40:32Z<p>TedHuntington: </p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow With Thermistor<br />
|status = working<br />
<!--Image--><br />
<!--|image = smt-ga.jpg--><br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = TedHuntington<br />
}}<br />
<br />
[[File:IMG 20160816 203312.jpg|500px]]<br />
<br />
<br />
See also [[Toaster_Oven_Reflow_Technique]] and [[HotplateReflowTechnique]].<br />
<br />
==Introduction==<br />
<br />
<!--[[File:sb-smt.jpg|300px|right]]--><br />
<br />
This page shows hot to use a toaster oven to reflow solder mount printed circuit boards adapted from this technique: [[Toaster_Oven_Reflow_Technique]] with two main differences: 1) it uses a thermistor instead of a thermocouple and 2) it waits for the toaster oven to reach the target temperature before incrementing the timer counter.<br />
<br />
In addition, there is a 3D printable case that uses a standard Arduino Uno, 120V relay, and power sockets easily found on Ebay ro Aliexpress.<br />
<br />
<!--[[File:arduino.jpg|300px|right]]--><br />
<br />
<br clear="all"><br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the original Arduino control program with the above mentioned adaptations.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
//2016-08-14 rev02- changed to wait until temperature is reached before incrementing timer - TPH<br />
//2016-02-06 rev01- adapted by Ted Huntington for a thermistor<br />
//with help from: http://iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor which is Copyright (C) 2012 Sam Davies<br />
#include <math.h><br />
<br />
double ThermistorResistor = 4700; //resistor used to voltage divide with the resistance of the thermistor<br />
double ThermistorBeta = 3950; //Thermistor Beta<br />
double ThermistorRefTemp = 298.15; //thermistor reference termperature (in Kelvin)<br />
double ThermistorRefResistance = 100000; //Thermistor Reference Resistance 100k ohms<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermister<br />
<br />
int temperature()<br />
{<br />
int ADCValue;<br />
double ADCVoltage;<br />
double Temp,TempC,TempF;<br />
double Resistance;<br />
<br />
//for thermocouple with amplifier:<br />
// return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
<br />
//<br />
ADCValue=analogRead(tempPin);<br />
ADCVoltage = float(ADCValue) / 1024 * 5;<br />
Serial.print("ADC: ");<br />
Serial.print(ADCVoltage);<br />
Serial.print("V ");<br />
Resistance= ThermistorResistor / (5 / ADCVoltage - 1);<br />
Temp = 1.0 / (1.0/ThermistorRefTemp + log(Resistance / ThermistorRefResistance) / ThermistorBeta);<br />
TempC = Temp - 273.15; // Convert Kelvin to Celcius<br />
TempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit<br />
Serial.print("Temp: ");<br />
Serial.print(TempF);<br />
Serial.print("F ");<br />
Serial.print(TempC);<br />
Serial.println("C");<br />
return((int)TempC);<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime\ttarget\ttemp (C)"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
<br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
<br />
//only increment timer if current temperature is >= target temp- <br />
//otherwise PCB might be underheated- and overheating for a few seconds is not too big a concern+++++++++++++<br />
if (t >= tg) //current temp is less than target temp<br />
{ <br />
// One second has passed<br />
time++; <br />
} <br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
Serial.println("on");<br />
} else<br />
{<br />
heatState = LOW;<br />
Serial.println("off");<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print("\t");<br />
Serial.print(tg);<br />
Serial.print("\t");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
(adapted from [[Toaster_Oven_Reflow_Technique]])<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermistor inside the oven or to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermocouple lead, taking care that there is slack thermocouple lead in the oven so the PCB doesn't move when you do this.<br />
<br />
Once the Arduino is connected to a computer via USB, the code should start running.<br />
[[Category:Electronics manufacturing]]</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=File:IMG_20160816_203312.jpg&diff=176361File:IMG 20160816 203312.jpg2016-08-17T23:37:14Z<p>TedHuntington: Photo of Toaster oven and 3D printed box with Arduino</p>
<hr />
<div>Photo of Toaster oven and 3D printed box with Arduino</div>TedHuntingtonhttps://reprap.org/mediawiki/index.php?title=Reflow_Toaster_Oven_using_Thermistor&diff=176360Reflow Toaster Oven using Thermistor2016-08-17T22:59:51Z<p>TedHuntington: Created page with "{{Development <!--Header--> |name = Toaster Oven Reflow With Thermistor |status = working <!--Image--> <!--|image = smt-ga.jpg--> <!--General--> |description = reflow solder s..."</p>
<hr />
<div>{{Development<br />
<!--Header--><br />
|name = Toaster Oven Reflow With Thermistor<br />
|status = working<br />
<!--Image--><br />
<!--|image = smt-ga.jpg--><br />
<!--General--><br />
|description = reflow solder surface mount printed circuits<br />
|license = GPL<br />
|author = TedHuntington<br />
}}<br />
<br />
<!--[[File:smt-ga.jpg|500px]]--><br />
<br />
<br />
See also [[Toaster_Oven_Reflow_Technique]] and [[HotplateReflowTechnique]].<br />
<br />
==Introduction==<br />
<br />
<!--[[File:sb-smt.jpg|300px|right]]--><br />
<br />
This page shows hot to use a toaster oven to reflow solder mount printed circuit boards adapted from this technique: [[Toaster_Oven_Reflow_Technique]] with two main differences: 1) it uses a thermistor instead of a thermocouple and 2) it waits for the toaster oven to reach the target temperature before incrementing the timer counter.<br />
<br />
In addition, there is a 3D printable case that uses a standard Arduino Uno, 120V relay, and power sockets easily found on Ebay ro Aliexpress.<br />
<br />
<!--[[File:arduino.jpg|300px|right]]--><br />
<br />
<br clear="all"><br />
<br />
<br clear="all"><br />
<br />
==Firmware==<br />
<br />
Here is the original Arduino control program with the above mentioned adaptations.<br />
<br />
<pre><br />
/*<br />
<br />
Toaster Oven SMT soldering control<br />
<br />
Adrian Bowyer<br />
<br />
2 November 2011<br />
<br />
Licence: GPL<br />
<br />
*/<br />
//2016-08-14 rev02- changed to wait until temperature is reached before incrementing timer - TPH<br />
//2016-02-06 rev01- adapted by Ted Huntington for a thermistor<br />
//with help from: http://iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor which is Copyright (C) 2012 Sam Davies<br />
#include <math.h><br />
<br />
double ThermistorResistor = 4700; //resistor used to voltage divide with the resistance of the thermistor<br />
double ThermistorBeta = 3950; //Thermistor Beta<br />
double ThermistorRefTemp = 298.15; //thermistor reference termperature (in Kelvin)<br />
double ThermistorRefResistance = 100000; //Thermistor Reference Resistance 100k ohms<br />
<br />
const int heatPin = 13; // the number of the LED pin. This also controls the heater<br />
int heatState = LOW; // heatState used to set the LED and heater<br />
long previousMillis = 0; // will store last time LED/heater was updated<br />
const long interval = 1000; // interval at which to sample temperature (milliseconds)<br />
const int tempPin = 0; // Analogue pin for temperature reading<br />
long time = 0; // Time since start in seconds<br />
bool done=false; // Flag to indicate that the process has finished<br />
<br />
// The temperature/time profile as {secs, temp}<br />
// This profile is linearly interpolated to get the required temperature at any time.<br />
// PLEN is the number of entries<br />
#define PLEN 6<br />
long profile[PLEN][2] = { {0, 15}, {120, 150}, {220, 183}, {280, 215}, {320, 183}, {350, 0} };<br />
<br />
// Linearly interpolate the profile for the current time in secs, t<br />
<br />
int target(long t)<br />
{<br />
if(t <= profile[0][0])<br />
return profile[0][1];<br />
if(t >= profile[PLEN-1][0])<br />
{<br />
done = true; // We are off the end of the time curve<br />
return profile[PLEN-1][1];<br />
}<br />
for(int i = 1; i < PLEN-1; i++)<br />
{<br />
if(t <= profile[i][0])<br />
return (int)(profile[i-1][1] + ((t - profile[i-1][0])*(profile[i][1] - profile[i-1][1]))/<br />
(profile[i][0] - profile[i-1][0]));<br />
}<br />
return 0;<br />
}<br />
<br />
// Measure the actual temperature from the thermister<br />
<br />
int temperature()<br />
{<br />
int ADCValue;<br />
double ADCVoltage;<br />
double Temp,TempC,TempF;<br />
double Resistance;<br />
<br />
//for thermocouple with amplifier:<br />
// return ( 5.0 * analogRead(tempPin) * 100.0) / 1024.0;<br />
<br />
//<br />
ADCValue=analogRead(tempPin);<br />
ADCVoltage = float(ADCValue) / 1024 * 5;<br />
Serial.print("ADC: ");<br />
Serial.print(ADCVoltage);<br />
Serial.print("V ");<br />
Resistance= ThermistorResistor / (5 / ADCVoltage - 1);<br />
Temp = 1.0 / (1.0/ThermistorRefTemp + log(Resistance / ThermistorRefResistance) / ThermistorBeta);<br />
TempC = Temp - 273.15; // Convert Kelvin to Celcius<br />
TempF = (TempC * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit<br />
Serial.print("Temp: ");<br />
Serial.print(TempF);<br />
Serial.print("F ");<br />
Serial.print(TempC);<br />
Serial.println("C");<br />
return((int)TempC);<br />
}<br />
<br />
// Get the show on the road<br />
<br />
void setup() {<br />
<br />
pinMode(heatPin, OUTPUT); <br />
pinMode(tempPin, INPUT); <br />
Serial.begin(9600);<br />
Serial.println("\n\n\nTime\ttarget\ttemp (C)"); <br />
done = false;<br />
}<br />
<br />
// Go round and round<br />
<br />
void loop()<br />
{<br />
int t;<br />
unsigned long currentMillis = millis();<br />
<br />
if(currentMillis - previousMillis > interval) <br />
{<br />
previousMillis = currentMillis; // set next time <br />
<br />
// Get the actual temperature<br />
<br />
t = temperature();<br />
<br />
<br />
<br />
// Find the target temperature<br />
<br />
int tg = target(time);<br />
<br />
<br />
//only increment timer if current temperature is >= target temp- <br />
//otherwise PCB might be underheated- and overheating for a few seconds is not too big a concern+++++++++++++<br />
if (t >= tg) //current temp is less than target temp<br />
{ <br />
// One second has passed<br />
time++; <br />
} <br />
<br />
// Simple bang-bang temperature control<br />
<br />
if (t < tg)<br />
{<br />
heatState = HIGH;<br />
Serial.println("on");<br />
} else<br />
{<br />
heatState = LOW;<br />
Serial.println("off");<br />
}<br />
<br />
// Turn the heater on or off (and the LED)<br />
digitalWrite(heatPin, heatState);<br />
<br />
// Keep the user amused<br />
if(done)<br />
{<br />
Serial.print((char)0x07); // Bell to wake the user up...<br />
Serial.print((char)0x07);<br />
Serial.print("FINISHED ");<br />
}<br />
Serial.print(time);<br />
Serial.print("\t");<br />
Serial.print(tg);<br />
Serial.print("\t");<br />
Serial.println(t);<br />
}<br />
}<br />
<br />
<br />
<br />
</pre><br />
<br />
Upload the firmware above into the Arduino.<br />
<br />
==Operation==<br />
<br />
(adapted from [[Toaster_Oven_Reflow_Technique]])<br />
Plug the controller into a mains socket that is, for the moment, switched off. <br />
<br />
Plug the oven into the controller.<br />
<br />
Connect the Arduino to a computer via a USB cable. You can use the terminal emulator in the Arduino development environment to monitor what is going on, or you can use stand-alone programs like Miniterm (Linux) and Hyperterminal (Windows).<br />
<br />
Tape the thermistor inside the oven or to a part of the PCB where it won't interfere with the components using Kapton tape. <br />
<br />
Place the PCB on the shelf in the middle of the oven.<br />
<br />
Close the oven door on the thermocouple lead, taking care that there is slack thermocouple lead in the oven so the PCB doesn't move when you do this.<br />
<br />
Once the Arduino is connected to a computer via USB, the code should start running.<br />
[[Category:Electronics manufacturing]]</div>TedHuntington