Reflow Toaster oven; profile output using COSM

The imp has just the right number of pins to do this system nicely.

rough BOM

Electric Imp Shield (but not using Arduino)
2 Sharp SSR: Digikey 425-2414-ND
1 SSR TBD for fan control
3 NPN transistors, through hole resistors
Adafruit thermocouple board MAX31855 and thermocouple
insulation (but this is optional)

  • lots of time spent building

unique features?: (anyway, I have not seen them yet in other posts)

  • Temperature is output to COSM; I can save the png for posterity after a run and I also log using the planner.

  • Oven is started using the mechanical timer on the toaster oven. When the temperature is above 40C the profile automatically starts running (the elements stand by at 20% duty). When the temperature is again below 30C the system re-arms but by then the mechanical timer is off. Because of this I did not need to build any pushbuttons or LCD screen.

  • The sparkfun shield already had LEDs on it. These correspond to the heating elements; the LED is ON when the element is OFF so I get a visual of the duty cycle. It also had a prototyping area that was perfect for the required parts.

  • Top Element, Bottom element and the fan are controlled separately (so far I have not implemented the fan control but this is trivial using a relatively small SSR for ~ 200mA)

  • the Sharp SSR used are cheaper than others I have seen. They are easy to use on this purely resistive circuit because some of the suggested external components were simply omitted by me. I just send some current to them with the transistors and hook the output directly in line with the heating elements.

  • I have two different PID functions. one targets a temperature and the other targets a slope. I think this simplifies entering new profiles. The code switches between states after certain triggers such as temperature reached or the passage of time.


pin 1 is the FAN
pin 8 is the top BURNER, when the burner is OFF, the shield LED is ON
pin 9 is the Bottom BURNER, when the burner is OFF, the shield LED is ON

pin 257 are the SPI
pin 7 is the chip select

This project is very crude , mechanically and code-wise but I have started doing test runs. I have never done a PID control before so I am fumbling through trying to determine the constants. I am checking the temperature every 0.5 seconds and modulating the burners in 1 second intervals. They are offset by .5 seconds which somewhat balances the load from the wall.

I like the idea of using the imp for this project because it is infrequently used, theoretically I can move the imp card to another project when I am not using the oven. I also like the idea of not being electrically connected to the oven with any home-made parts. I only have to turn the timer that came with the oven and off it goes!

The code for the SPI interface came from another user on this forum, not me.

I welcome questions, criticisms and especially any advice how to get the system tuned. It seems like a difficult problem because although I can modulate the elements beyond just on/off, there is no reverse! just forward and I also suspect the elements have a bit of thermal inertia behind them.

Any pictures of this? Sounds very nice, though I’m not the person to give advice about PID loops I suspect :frowning:

Take a look at this Post @pgrunwald is porting arduino PIDLibrary to the imp

good stuff, controlCloud, thanks. I remember now coming across that post a while back.

The oven works well enough with my sample board that it probably do an ok job but I still want the PID to be checked out before I spend hours doing a build and throwing it in the oven.

I started by picturing what success looks like and working backward to what the constants should be. I am using just PI for now.

One limitation or problem is the 0.25C resolution on the thermocouple amplifier. When trying to follow a slope of 2C per second this resolution is pretty rough. I am considering controlling against a running average of 2 to 4 temp readings.

Hugo, I would love to share pictures of the completed project but it is not done yet. It is so ugly now with its wires hanging out and extra test leads and such. Hopefully I will make it presentable in the coming days or few weeks.

Here is an update. I have the PID loop working and the oven re-assembled and high voltage wiring ~safely tucked away.

[…deleted photobucket link…]

Here is a link to the BOM and some design notes


Sorry, my linking skills are pretty low. I tried to add thumbnails from photobucket. It has worked in the past and elsewhere but no luck today.

Nice one “Tuna Toastee for me”, where’s the PID code running imp or arduino?

Thanks. There is no Arduino present. the PID runs from the imp. The temperature is taken every 0.5 seconds. On alternating reads it sets the top, then the bottom element so each element is being modulated at 1 per second. The SSRs switch at zero-crossing so I think that means a control resolution of 120 parts (2X 60Hz). or, since I actually have two elements perhaps ~240 resolution steps but I use a command resolution of 32768… because I can.

I used a trick found elsewhere to boost the power of the oven. The wires of the elements have been cut short and re-stretched to span the oven. It is only 1200W out of the box and I tried to get it up to 2000W. I have not taken final measurements of this but in time I will.

There is a link to the main parts of the BOM in one of my previous posts.

Could share you PID imp code?
I for one would appreciate that

I’ve got to saym, one of the pleasures of being involved with the imp is seeing it used for, not just things I wouldn’t’ve thought of, but things I never knew existed. Who knew there was a toaster-over overclocking community? :slight_smile: :slight_smile: :slight_smile:


I have attempted to attach the code as a text file. hopefully that works. The code is not totally polished. The next on my to-do list was to clean up the reporting speed. I want to have variable data rates to COSM and to the planner log but to keep the temperature reading and PID loops fixed. It is easy to do… just when I get time.

If there are questions on the code, perhaps we should have a different thread? I am very open to advice about coding techniques. I can repost the code after I improve it, if there is an audience for that.

I used the SPI code from member, rivers.

Mjkuwp94 thanks for the code


Heavy stuff. Thanks a lot!
Very interested in further developement.

a bit of an update. I have used this oven for several builds now. I think the soldering process is really stable - meaning I could have probably achieved about the same results even without a PID loop. I continue to refine the code and am happy to share it but I am waiting until it is better than the current state. It does not use agents and the COSM feature broke so I don’t have nice charts anymore.

I also learned it was not necessary to control the convection fan. That probably could have just been left on all the time-leaving an extra pin to do something else.

The pictures here are a watt meter impee using a simple energy measure chip, ADE7769. I ran this in the oven twice, first to do the socket and then the main side. I used adhesive to keep the SD socket in place and you can see that in the picture. The power supply is not on the board. I am looking at various cell phone chargers or AC to USB power units to put the main power.

The Proconn socket has worked well so far. My previous build with Amphenol had trouble with the pins connecting to the imp. That build also had more manual soldering. This one only had some spherical solder balls chipped away and then cleaning.