I just wanted to give a shout out and say thanks to everyone who’s contributed so far! There is still a ways to go so keep the support coming.
I just wanted to give a shout out and say thanks to everyone who’s contributed so far! There is still a ways to go so keep the support coming.
No video today but I have been working on the code and have added some new features.
It is now possible to install a jumper across pins 19 and 20 on the I/O header (with the display removed) to enable a serial terminal mode. When the terminal mode is enabled the display and push buttons get turned off, and pins 10 and 11 on the header function as RX and TX lines. There is one small issue that I will talk about later in this post. Here is a quick screenshot:
Now what can the terminal mode do? It’s still in the early stages but it already supports several commands. Currently the commands include reading the current temperature (“t”), setting desired temperature (“T”), reading the current temperature set point (“s”), reading the current PID constants (“p”,”i”,”d”), setting the constants (“P”,”I”,”D”), set display to Celsius (“C”), set display to Fahrenheit (“F”), and print all values (“v”). These commands are all working and allow using the controller without the LED display board.
The one letter commands were chosen for a couple reasons. The major reason is adding lots of strings to be displayed on screen takes up memory fast and I want the space free to include additional features in the future. The other reason is the one letter commands should be easy to remember and use. With my use of the terminal so far this has been holding true. In the future the simple serial terminal could allow a nice PC based application to be written to allow tuning the temperature controller. That’s beyond the scope of the project right now, but the serial option now makes that possible.
I spent time this past week updating the board schematics and layout to fix a few minor issues and add a few things. Mostly, I added vias that would allow 3.3V, GND, and some of the more important signals to be tied into. I also added a place for a small transistor to replace the opto-isolater on the board. This will allow the Triac to be removed and an external relay to be switched. There is no space for the relay on the board, but I added solder points to make it easy to wire one off board. These changes will make it easier for myself and others to modify the board for other uses. One that was mentioned to me was controlling a mini-fridge to use in home brewing, especially lagering. This is something I would actually like to try since I do brew my own beer. I won’t have time to try this for a while, but the temperature controller will be a good fit for controlling the mini-fridge.
Coming up, I want to add functions and commands to set the temperature to Fahrenheit or Celsius, save the new settings to the internal EEPROM, and add code to the LED display to allow the variables to the changed and saved. Now that the code for the serial communication is working the other features should progress nicely.
Now the small issue I mentioned before with the serial communication, the PIC24F08KA101 the project is based on doesn’t have 5v tolerant inputs and there isn’t going to be voltage level shifting included on the board (no space for it currently). This means that the serial port on the PC side must use 3.3V signals to safely communicate with the temperature controller. Thankfully there are several options that make this easily possible.
The one I use and recommend is a Bus Pirate. The Bus Pirate is a small board that makes working with different serial communications protocols much easier. The price is very reasonable and maybe even cheaper than a “name brand” serial port adapter. For the serial terminal I’m using the Bus Pirate in the USB-to-Serial bridge mode so it acts like a USB serial adapter.
Another option is a FT232 chip setup to work at 3.3V. Sparkfun has a breakout board that it set to work at 3.3 volt and would be perfect to use with the temperature controller. This is a good option if the board is going to be left inside a project. If the terminal is only going to be used to setup the controller the Bus Pirate mentioned above is a much more useful tool but either option will work just fine.
I also wanted to mention my kickstarter page again. If you are interested in this project and would like to get your own board(s) please take a look. With enough support I will able to do a production run of the boards and get them to someone like you.
Thanks for following the project and enjoy your day.
Last time I left you with a video showing the control board running a toaster oven. Today, I’m going to start with a video showing a PCB getting reflowed in the oven. I will cover the changes I made after the video.
The first and most important of the changes, a new temperature sensor. The diodes used in the original design are only rated to 175c and wouldn’t work at the temperatures needed to reflow solder. After doing some searching online, I found what looked like a good and cheap replacement. It’s a 50K Ohm NTC thermistor part number 135-503LAF-J01. It’s in a glass package like a small through hole diode which worked well because it made mounting the thermistor much easier.
Speaking of mounting thermistor, it isn’t as easy as running some wires and soldering it in place. Wire that will work up to 300c is expensive and the solder will melt every time a board is reflowed. The solution I settled on, with some ideas from my roommate, was to drill a hole in the side of the oven, cover the hole with epoxy, and run some thin copper tubing through 2 holes drilled in the epoxy. The thermistor leads are then crimped into the copper tubing to make the final electrical connection.
The first step in mounting the thermistor was to drill a hole in the side of the toaster oven. I used a 1/2 inch drill bit but anything close will work. The only requirement is allowing enough room for the 2 small copper tubes to pass through without shorting. I left plenty of room on all sides and drilled a little above the top oven rack slot to allow the sensor to rest on top of the board that was being reflowed. Here is a photo of the hole I drilled.
I placed a bit of duct tape on the inside of the oven to help keep the epoxy in place. I tried to put the tape on weakly and used the blunt end of a drill bit through the hole to push the tape away a little so the epoxy would be able to flow under the tape a little. That would help keep the epoxy from coming loose later. Here is what the tape looks like inside the oven. As you can see it doesn’t have to be pretty.
Next, I placed the oven on its side so gravity would help pull the epoxy through the hole onto the tape. After looking up several epoxies I settled on JB Weld. It’s rated to work up to 300C and it’s easy to find. I wasn’t sparing and made sure to work the epoxy under the tape and completely cover the hole. Here is what the wet epoxy looks like.
Now, let the epoxy cure for 24 hours. Once the epoxy is cured remove the tape from the inside and drilled 2 small holes. The holes should be just big enough to allow the small copper tubing to fit through. I got the tubing at Ace Hardware, but other hardware store should have it. It came in a pack of 3 – one foot long pieces. Here is a photo of the tubing with a small diode for size reference.
And a photo of the holes in the epoxy.
I then pushed the tubing in until it was about halfway into the oven, placed the leads of the thermistor into the tubing and crimped it down with pliers. I cut the excess tubing off with cutters and soldered wires from the tubing to the control board. Polarity doesn’t matter with a thermistor. That took care of the hardware mods, you can see the thermistor resting on a PCB in the following photo.
It’s nothing fancy, but it works quite well. The tubing has a bit of spring and gently holds the thermsitor on the board for better thermal contact.
With the hardware modified, I needed to update the software to compute the temperature from the thermistor reading. I settled on using the Steinhart–Hart equation to compute the temperature. This meant the first step was to convert the reading from the A/D converter into ohms. This was actually very easy since it was just ohms law, R = E/I. E in this case is the A/D result times VCC (3.3 Volts) divided by the total counts of the A/D (1024 for the 10bit A/D). The current “I” in the equation is set at 55uA in the CTMU module. I had the PIC do the math using floating point since I was going to need floating point later for the Steinhart-Hart equation.
Now that the resistance of the thermistor is known, all I need to know was the A,B, and C constants to plug into the Steinhart-Hart equation. This is where I ran into a bit of a issue because there isn’t really a good datasheet for the thermistor I bought. If I was to do this again, I would make sure to buy a part with a good datasheet. Thankfully, the internet came to the rescue and I found an excel spreadsheet that calculates the three constants given temperature and resistance values at 3 points. If you do a search for Stein1.exe you will find the site that has the spreadsheet. I had to heat the oven up and measure the temperature and resistance at a couple different temperatures. Once I plugged the data into the spreadsheet I had the constants I needed.
With the constants and thermistor resistance known, it was simple to have the PIC calculate the temperature. The PIC does all the math, including calculating the natural log of the resistance. The Steinhart-Hart equation provides temperature in Kelvin, so the program converts to Celsius and, if a flag is set, converts to Fahrenheit. This number is fed into the PID control loop and controls the Triac output level. The floating point math uses about 10% of the code space in the pic, but there is still room left over for additional features.
While I was working on the code, I also added a new feature. The controller on power up checks to see what the line frequency is (50Hz or 60Hz) and automatically adjusts timings for Triac control. For use outside of the USA, the only change needed will be a transformer rated at the appropriate input voltage that provides around 9V AC out.
With the code updated, I had to give the oven a try and solder a part. I settled on soldering a 44 pin TQFP part, a CPLD in this case. I will put pictures below, but it went very well. There were a couple solder bridges but that was caused by to much solder paste. This was my first time using this paste and the oven but it was nothing a little solder wick couldn’t fix. A little less paste next time and it would have been good right out of the oven. I used a ROHS solder paste from Digikey.
Solder paste on the board.
Board cooking in the oven.
Fresh out of the oven, you can see a couple of solder bridges.
After cleaning up with solder wick. It was a success!
Need to clean up the residual flux with some IPA, but the solder looks good.
Next, I want to add more options for setting up the PID control loop to the user interface. Stay tuned for that update.
Since I put up my kickstarter page, I have received a few emails asking about controlling a toaster oven using the laminator temperature control board. This is something I have been thinking about myself, so I decided to buy an oven and convert it into a SMD reflow oven. If you decide to do this, do it at your own risk and make sure you, your family, and your friends know to never use it for food!!!
My only real criteria was that it had to be cheap. I bought one that was on sale at my local big box store (Fred Meyer in my case). The exact model shouldn’t matter because the cheap ones are all pretty much built the same. For those that want to know, I got a Black and Decker “Toast-R-Oven”. Here is what it looks like:
The first step was to take the side off and see what I was getting myself into. To take the cover off, I had to remove the feet from control side of the oven (right), and a couple of screws. A small annoyance was that the manufacturer decided to make one of the screws a Torx head (star driver). Once the screws were removed, the side panel opened on the bottom and lifted off. I needed to be careful because there are 2 metal tabs that hold the side panel in place on top and I didn’t want to bend them. With the side panel off, it was easy to see the wiring inside the toaster oven. Here is what it looks like:
The main power comes in on the lower right of the photo. The ground gets tied to the oven frame for safety. The neutral gets split with one side going to the power indicator on the front of the oven and the other going to the heating element return (lower right of photo behind the main power input). The incoming “live” wire goes to the power switch/timer/bell on the left side of the photo. The output of the switch gets split with one part going to the “live” side of the indicator light, and the remaining wire going to the Function (broil/toast/bake) select switch. That switch determines which of the heating elements will be active. This oven has one element on top and one on the bottom. The output of the function switch goes to the thermostat (top left of photo).
Since some experimentation is needed to get the reflow temperature dialed in just right, I decided it might be useful to have the function switch and timer/power switch still functional so I left them connected. The function switch will allow me to pick which heating elements get turned on. The timer/power switch will be nice to control the main power to the oven, while still having a stock easy to use interface. All that is needed is to bypass the thermostat so the control board is in charge of maintaining the correct temperature and then wire the control board in between the power switch and function select switch.
The toaster oven I’m using is rated for 1200W (10Amps at 120V). Since the control board was originally designed to control up to 6Amps, I needed to do a couple small mods to beef it up; switch in a higher power triac (the BTA06 for a BTA20) and solder wire to the power traces so they could carry the higher current. Here is what it looks like:
I’m not sure the exact current rating after the mod but 10 amps won’t be a problem. Next, I just need to wire in the controller and the toaster oven will have its new brain. For this trial run, the control board’s logic circuits are always powered, but the toaster ovens timer/power switch connects the triac to the heating elements for safety. I got lucky and the vents slats in the bottom of the oven were a perfect fit for the mounting holes I designed into the controller board. If this wasn’t the case, I could have easily drilled mounting holes in the toaster oven. Here’s another picture:
You can see the diode for measuring the temperature epoxied to the side of the oven(blue and white wires in the center of the picture). The diode isn’t rated for full use at the high temperatures needed for soldering, but will work great to show that controller works until I get the high temp thermistors I ordered. For now I will have to stay below about 150c.
I programmed the PIC microcontroller with the same code I used in the laminator, no changes were made. This means I have to use the display board to set the temperature, but for debugging this will be useful. In the next rev of the code, I plan to add a feature so that the temperature can simply be set with a potentiometer so the display board won’t be needed.
Using a “Kill A Watt” to help me monitor the ovens power consumption, I began testing the modifications. By default, the controller’s set point is 50F, so the oven should be off. The Kill A Watt confirmed this with a reading of about 2 watts (a little power for the controller and a whole lot of noise). Next, I adjusted the set point to a few degrees above room temp and the control board increased the power to the heating elements as expected (and confirmed by the Kill A Watt). When I adjust the set point to several degrees above the measured temperature, the control board applies full power (about 1100 watts). Once the measured temperature nears the set point, the control board throttles back the power to minimize overshoot.
If you are interested in getting a set of boards please take a look at my Kickstarter project.
Stay tuned for further updates but in the mean time enjoy this somewhat long video of it in action:
I have a basic user interface setup that allows the temperature to be set. Currently only the right 2 buttons are used, one for up temperature and the other for down temperature. When the laminator is turned on it shows the current roller temperature. Pressing the up/down button momentarily shows the set point, which is 50F at power up. This means the laminator is off by default. Holding up/down for a couple seconds starts the temperature changing in 5 degree increments every second. Releasing the button again shows the actual temperature of the roller.
I plan on adding code that will use the extra button to allow the set temp to be saved to the PICs internal EEprom and set again just by hitting the button momentarily. This will allow a commonly used temperature to be set quickly. Also, the room temperature calibration will be entered by holding the 3rd button while powering on the laminator. The calibration will also be saved to EEprom, and will only need to be done once. After working with the the code, I also want to a feature that will allow the PID constants to be changed by entering a special mode. This will allow the board to be tuned for different uses without needing reprogram the PIC.
I have tried the laminator out at it works well. Here is a picture of the laminator heating up. Please ignore poor quality, I had to do a longer exposure because I was only getting one digit showing in the pictures. This is caused by the 3 digits being multiplexed and only a single digit being turned on at a time. The camera was fast enough to only show one digit on at a time.
I currently have the second sensor disabled, because the PID control loop does a good job heating up the laminator while preventing overshoot. I will add the second senor as a fail safe that will turn off the laminator if the first sensor stops working for some reason. The laminator heats up to normal lamination temp of about 240F in less than 2 minutes. This is a nice improvement of the original 5 minutes or so it used to take, and is an added bonus of the modification.
I ran a blank board through a few times and the laminator only lost about 15 degrees on the first pass and recovered quickly. After the 2nd pass the board was hot enough that I didn’t want to touch it. This is a big improvement on the dozen or so passes it used to take. I need to see how hot the laminator will safely work. I have tried 260F for about an hour without any issues. If it can go a bit higher, a one pass toner transfer should be in sight. Worst case it will take 2 passes, which for me is very acceptable.
The display cutout was just done with a rotary tool, and while being a bit crude, works well. If I left the bit of plastic that would have gone between the display and buttons it almost would look stock.
Seeing there might be some interest in this project, I have set up a kickstarter page to try to get this into the hands of hackers and tinkerers like you. If you are interested, please feel free to check it out.
I hope to post a video of the laminator in action soon, but it’s currently apart as I was adding some features to the code.
If you have followed along, I am making a custom temperature controller for a Scotch TL 901 laminator. I have designed and ordered a main control board based on a Microchip PIC24 microcontroller, as well as, a display board with 3 seven segment displays and 3 buttons to act as the user interface.
The first function I wanted to get working was the display. My reason for this was a working display would help with troubleshooting everything else by allowing me to display error codes and variable values. The first thing I tried was simply selecting a digit and trying to set the pin outputs to display a zero. At first, It seemed that everything was going well, but when I tried multiplexing in the other 2 digits, I started getting weird issues like the display would flicker or be very dim.
It took some checking with an oscilloscope, but I found that the 3.3V supply would cut out when the 7seg display was powered on. It ended up that the input bypass capacitor wasn’t large enough and the regulator would drop out. I fixed the problem by adding a large electrolytic capacitor to the bottom of the PCB at the 3.3V regulator inputs. I used a 470uF cap, but anything in that range will work fine. Now the 3.3V supply is solid the rest of the functionality can be tested.
After fixing the power supply, I finished the led display multiplexing, which is handled by an interrupt from a timer. The interrupt very quickly blanks all the digits, then sets the outputs to the next digits value, before enabling the next digit. The blanking is required because the leds respond so quickly that changing whats being displayed while changing the digit to be displayed causes the display to flicker with incorrect values. The interrupt routine gets the values to be displayed from an array that gets updated in the main code. This keeps the interrupt short and fast, allowing the main program to make changes when it needs, without having to be concerned with display timings.
Here is what the display look like mounted in the laminator:
The control board installed in the PCB, the wires will be cleaned up later. The board fits very well.
Once the display was working, I decided to tackle the temperature measurement. My goal was to use the PIC24 CTMU with the A/D to read the temperature from the sensors that came with the laminator. There are 2 sensors that need measured. The first is in direct contact with the roller, the second is attached to the aluminum housing that holds the heating element. The second sensor could be important because the heater will heat up much faster than the roller, and the roller might overheat. The basic idea for measuring the temperature is based on a diodes voltage drop changing with temperature. There is a lot of good info on the internet so I won’t go into detail(look up band gap voltage), but just know that for a silicon diode the voltage drops about 2mV for each degree C rise in temperature.
I had a lot of issues getting the CTMU/AD providing a correct value. I found that what I was trying to do was very possible but it’s better to take it one small step at a time. I was trying to get the PIC24 to automatically take a sample and convert 16 times, then trigger an interrupt because the A/D buffer was full. I was then going to average the samples to give better noise immunity. What I should have done is try to take one sample manually to get the circuit working right.
I ended up working through the issues with a multimeter and the 7seg display for debugging. There was lots of reading of the PIC data sheet and the PIC24 family reference manual. The biggest issue was little code errors, like forgetting to actually turn on the A/D interrupt. The PIC24 hardware worked very well once I had it setup right. Don’t forget to double-check every bit of code step by step when you run into odd problems. More than likely it’s not the hardware, but the code that is to fault. However, do make sure to check the errata document for the device too, sometimes there are hardware issues that could be causing problems.
Once I was able to get reliable data, I quickly found that the 2 temperature sensors didn’t seem to behave quite the same. There was no number on them so it was impossible to look up a datasheet. After experimenting with them, I concluded that is would just be easier to replace them. Both sensors were replaced with a very common 1N914/1N4148 diode. This made the results line up very well and allowed the temperature measurement routine to progress quickly. The diodes with the 10bit PIC AD provide about 2-3 degrees of temperature resolution. This should provide enough accuracy to allow for good control of the laminator. The accuracy could be improved by going to a PIC with a 12bit A/D or using a separate lower voltage for A/D Vref. For this project the standard 10Bit A/D and 3.3V Vref will do fine. The only issue is that the sensor will need to be calibrated once at room temperature. I plan on adding a calibration routine to the code to make this very easy, but that will be done later.
With the led display working and the temperature measurement working reliably, I decided to get the buttons setup, and allow the setting of desired temperature. With the PIC24s abundance of timers and having plenty to spare in this project, I decided to use one to help make a simple but reliable button debounce function. Every millisecond or so the buttons are read and a count incremented for each pressed button. If a button is released the count is reset. When the count passes a threshold a flag gets set, letting the rest of the program know the button is active. The main code never reads the buttons directly, but only checks the status flags that are controlled by the interrupt. The only thing that makes troubleshooting difficult is one button being shared with the programmer. The programmer must be disconnected to use the button. This was a trade-off of using a lower pin count part. With the button status now available to the main program, it will be possible to finish the user interface and actually try to set and control the temperature of the laminator. Stay tuned for part 4, the finished project.
During my last post I started working on a custom temperature controller for a Scotch TL 901 Laminator. I have finished the control PCB schematic and layout. Here is what the final PCB looks like.
Next, I removed the stock temp control PCB and did a test fit of the new board to make sure the mounting holes lined up, and there was enough clearance. Everything looked good so it was time to install the components on the board. There is a lot of surface mount components used to save space, but the packages are all easy to work with. It just takes a bit of practice.
Now that the main controller board is built , its time to work on the PCB that will hold the three 7segment displays and 3 buttons that will make up the user interface. Here is what I came up with:
On the left is the header to connect to the main control board, along the bottom there are 3 buttons for user input, and finally along the top the 3 seven segment displays.
The three 7 segment displays are a LSD3021 common anode unit. Any common anode with the correct pin out should work. If it is not a red display, the current limiting resistors will need to be changed because of the different voltage drop for each color of led. Make sure to keep the current around 10-15 mA maximum per LED. All the same segments are tied together, then go through a 100 Ohm resistor before going to the header which connects to a PIC Micro IO pin. To control each display separately, a P channel MOSFET is used to the Common Anode connections for each digit. The MOSFETs are required because each digit will draw about 80mA when showing the number 8, this is a lot more than an IO pin can provide. The digits will be multiplexed inside an interrupt routine to provide the final 3 digit output.
The three buttons are normally open momentary push buttons from Electronic Goldmine, but any similar switch will work just fine. The pull up resistors are located on the main PCB instead of the display board. This is done in case the connecting cable gets broken or disconnected so the pull up resistors will still hold the button inputs in the default state.
Overall the display board is pretty simple and designed so it could be used in many other applications that need a very readable numerical display. It will work well with a 5v microcontroller as well, but current limiting resistors might need to be changed.
Here is what the blank display board looks like.
In the next post I will start to write code and try out the functionality of the circuit.