Raspberry Pi Solder Reflow Oven Controller - Part 1

Posting project on behalf of user diamondjimkoehler:


A few years ago, I wrote an article , published in QST, the ARRL journal, describing how a simple toaster oven could be used for reflow soldering of printed circuit boards. This article was voted to be the "Best article of the Month' and I was given a wall plaque.

There have been a number of Web descriptions for using a toaster oven or similar but the real secret is to monitor temperature somehow, and, in that article, it was all done manually. For the MakewithMaxim contest, I proposed using a Raspberry Pi Zero W, along with a Maxim temperature sensor circuit to automate the entire process.

The project has two steps; one is to determine the thermal characteristics of the toaster oven and the second is to design a PID temperature controller using the Raspberry Pi to sense the temperature and then to turn the oven off and on. The thermal properties of the oven depend on its thermal mass, the rate of loss of temperature of the oven in its environment and the electrical power of its heater. It is not necessary to measure all these things independently but some simple measurements of temperature versus time when the oven is turned on and off can produce all the information needed to implement the PID controller.

To prepare the Raspberry Pi (abbreviated in what follows to 'R-Pi'), I followed the instructions in an Adafruit tutorial to make the R-Pi "headless"..That is, not to require a monitor, keyboard and mouse. Instead, I installed a VNC server on the R-Pi and then controlled it from my regular computer desktop interface.

While waiting for my Maxim MAX31865 Ev kit to arrive, I built a very rough 'breadboard' for the circuit and, as the kit was delayed more and more, finally bought a MAX31865 'breakout board' from Adafruit. This tiny board has just the bare SPI inputs to a MAX31865 chip with some terminals to connect to the platinum temperature sensor. I basically then completed the project using this board rather than the MAX31865 Ev kit which did not arrive until early February. If necessary, for the purpose of the contest, I can replace the Adafruit board with the Maxim EV kit board since the latter allows one to use the SPI interface without going through the USB adapter; the actual section of the circuitry of the two boards using the MAX31865 is nearly identical.

The overall circuit is very simple. The R-Pi senses the temperature using the MAX31865 via an SPI interface. I was able to find, on the net, a Python routine for interacting with the MAX31865. Also connected to the R-Pi are a 25A solid-state relay to turn the oven on and off, three push-button switches for control and four LED's to show what is happening.

The controlling program, written in Python, tries to have the oven follow a temperature profile which is a file, 'profile.txt',which the program inputs. When the process is over, the control program writes two files; one. 'temperature.txt', is basically a table giving time, oven temperature and whether the oven in on or off and the other file is a graph, 'temp.png', showing that data.

1."Reflow Soldering for the Radio Amateur", Jim Koehler, VE5FP, QST, January, 2011, pp 32-35
3. https://learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc


I did this project on the cheap! I used an old toaster oven I'd found at a yard sale. It was missing the grill which I replaced with a thin aluminum sheet. The first step in modifying the oven was to put in a platinum 1K sensor to monitor the air temperature. I used a length of 1/4" Teflon rod to hold the sensor. I drilled a 1/8" hole through the rod length and used a 1/4-28 die to thread one end as shown here.

View attachment 189057View attachment 189058View attachment 189059

View attachment 189060View attachment 189061View attachment 189062

I bought a very small 1K platinum temperature sensor from Digikey; part number 615-1045-ND and soldered it to a twisted pair of Teflon coated wires using heat shrink to cover the joints. I then threaded this through the centre of the Teflon rod and pulled it tight as shown in the photos. This rod was then mounted in the oven via a hole in the back plate of the oven.

I needed a fan inside the oven to stir the air around in order to keep the inside temperature as uniform as possible. For the fan, I mounted a small DC motor on the back plate, using long stand-off's to insulate it because the back surface of the oven gets very hot. The shaft for the fan blade is passed though the back plate of the oven and connected to the motor with a shaft coupling. The sensor-Teflon rod assembly is mounted so that the sensor will be close to where the pc-board is to be placed. The last photo of the inside of the oven door shows the sensor mounting, the fan and a small grid made from wire mesh on which the pc-board will be situated. That basically completed the modifications needed for the oven.

For the oven controller, I had an old chassis from a previous project which had an AC power receptacle on the back surface. I had a 25A solid state relay which I used to turn the oven on and off. This was controlled by the R-Pi controller. I used wire-wrap from the R-Pi pins to make connections to the various LED’s and switches. The Adafruit MAX31865 board has an SPI interface to a male header so it was easy to use wire-wrap to connect it to the R-Pi. The front of the chassis and the cover for it were built from 0.1” thick ABS sheet; it was plastic because the R-Pi communicates with the outside world via Wi-Fi. Plastic sheet like this is easy to use and ABS glue or ‘crazy glue’ bond to it very well. The wiring job I did was not pretty but it works. This photo was taken during development and the circuit was slightly different from the final. The controller was powered by a laptop power supply. There are thousands of these things discarded every day but they are very useful; they supply about 18V at more than 1 Ampere. Two voltage regulators in the circuit supply the needed 12V for the motor and 5V for the R-Pi and associated circuitry. The R-Pi supplies the 3.3V needed for the Adafruit board.

View attachment 189063

The first job after assembly was to implement a PID controller for the oven. Because a re-flow solder oven only operates for a few minutes at a time, the integral part of PID is not really necessary so, strictly speaking, this implementation should be called a PD controller. In order to calculate the co-efficient for the differential part of the controller program, it is first necessary to determine how the oven behaves when just a proportional controller is used. I wrote a program to test this in Python for the R-Pi in which the oven was set to run at a temperature of 200 degrees C with just the proportional part of the controller being used. In this case, the oven will turn on till the temperature reaches 200 at which point, the oven will be turned off. The temperature will continue to rise for some seconds and then start to coast down. When it reaches 200 C,the oven will turn on again and the temperature decrease will slow down and then start to rise again. The overall result is an oscillatory behavior. Figure 1 shows the actual temperature as measured during this test. I then added a term to the feedback control in which I could insert a differential co-efficient. This co-efficient was then varied, by trial an error, to produce a graph in which the temperature over-shoot was reduced to just a fraction of a degree. The resultant graph is shown in Figure 2. Having determined the correct co-efficient for this particular oven, it was now just necessary to write a program for the R-Pi controller to cause the oven to follow a temperature profile which would do the job.

View attachment 189064

View attachment 189065

I will now digress to discuss the normal procedure for reflow soldering. In big commercial pcb houses, reflow soldering is done in a commercial oven costing tens of thousands of dollars. The solder paste is applied to the board, the components mounted and then the board goes through an oven on a conveyor belt, passing through regions where the temperature varies, to produce a temperature profile similar to this. The temperature is first raised to about 150 C and then left there for a ‘soak’ interval. Then it is quickly raised to a temperature where the solder will flow easily and, after a brief time there, quickly reduced back to room temperature. The whole process takes just five or six minutes. There are various constraints on temperatures and rates of change of temperatures which I will not discuss but the basic process is fairly straight forward. Domestic toaster ovens do not have the power of commercial solder reflow ovens so it is not really possible to duplicate their performance; their rate of temperature increase is not obtainable, for example.

Normal 60/40 solder melts at 188 C and eutectic solder, 63/37, melts at about 183 C. I have found that, for the solder flow phase of the operation, if I can keep the temperature at or about 210 C for twenty or thirty seconds, I get good results. Secondly, because toaster oven rate of temperature increase is much less that that of commercial ovens, the pause in temperature increase to ‘soak’ the board is really not necessary because the board is heated more slowly already. So, the actual temperature profile just needs to be the maximum rate of change possible in the oven to get to 210 C and then turn the oven off. After ten or twenty seconds, the toaster oven door should be opened after which time the board will cool at a rate which is acceptably low.

Nevertheless, it is possible that one might have an oven which does allow one to actually have the temperature follow a profile so I wrote the controlling programming so that it would normally input a file, a desired temperature vs time profile, and then follow it. The program is called “oven.py” and it inputs a temperature profile file named “profile.txt”. profile.txt is a simple text file where each line is a time and a temperature separated by white space (tabs or spaces)., thus;

0 20

1 21

2 22

etc. Each line has a time change of one second. Because such a profile file would be exceedingly tedious to write by hand, I have written another Python program which will take an abbreviated temperature-time profile and expand it to make a profile.txt file. This abbreviated file would contain lines like;

0 20

150 150

180 150

200 250

210 250

300 20

and the program, “make_profile.py”, will read that file and produce the “profile.txt” file needed by the oven program. I also wrote a bash file which has two commands in it; the first to run the “make_profile.py” program and then the “oven.py” program; it is called, simply “oven”. While the program is running, it looks at the push-button switches on the front panel of the controller and, for example, starts the reflow sequence only when the “Start” button is pressed.

The oven.py program needs to know the value of the differential co-efficient for the particular oven used. When oven.py run, it tries to read a file named “k_d.txt”. This simple text file contains a single line consisting of a single floating point number which is the co-efficient. For the oven I used, the value of k_d which gave the appropriate oven behavior was -9.0.

To summarize, there is a single computer command needed to start the reflow process and it is named ‘oven’. When it starts, it needs to find a short description of the needed temperature profile and it needs to find the co-efficient file and then it starts the reflow sequence.

Finally, it is not really convenient to have an oven program which is controlled via a computer interface. So, in the R-Pi, I amended the start-up code when the R-Pi is booted, it will automatically start the oven program running. So, out in my workshop where I do not have a computer near the work area, I just need to turn on the controller.

While running, the operation is controlled by three push-button switches. “Start” starts the reflow sequencee. The fan is turned on and the controller tries to make the oven temperature follow the desired profile. The “Stop” button stops it at any time. The “Halt” button starts the R-Pi power-down process. After the “Halt” button has been pressed, it will take 5 or 10 seconds for the R-Pi to power-down normally.

There are four LED’s to describe what is happening. The “ON” LED is turned on when the oven heating element is turned on; the “OFF” LED is illuminated when the heating element is off. The “FAN” LED is illuminated when the fan is turned on an, finally, the “READY” LED flashes on and off when it is time to open the oven door so as to cool the pc-board after reflow is completed.

View attachment 189066

It could hardly be simpler. The setup on my very cluttered workshop bench is shows the oven with the controller beside it.

Continue reading Part 2
  • Like
Reactions: hetztronics

Blog entry information

Last update

More entries in General

More entries from jrap

Share this entry