Showing posts with label thermocouple. Show all posts
Showing posts with label thermocouple. Show all posts

Sunday, November 9, 2014

Reflow Toaster Oven - Part 8 - MAX6675

Just playing around a bit with the MAX6675 chip. I noticed that the temperature jumps up and down a bit, but never bothered to look into it. So I did a bit of testing.

I did three runs of 200 samples. The first run had a 1000ms pause between each sample, the second 500ms and the third 250ms. The top graph is the raw data, the bottom one is the average of 10 samples.
In order to compensate for actual temperature fluctuations I tried to visualize the standard and average deviation over 10 samples:
Just to put these numbers into perspective: the raw sample data is in centidegrees Celsius; that's one hundredth of a degree. So an average deviation of 25 means 0.25 degree.
If I look at the average of the average deviation for each of the runs then I can note the following:
1000ms has an average average deviation of 18.5
500ms has an average average deviation of 20.8
250ms has an average average deviation of 16.6

Long story short: 500ms seems to cause the most noise, but the total amount of noise does not seem to be very significant. The sample rate does not seem to have a direct relation with noise. Good. 4 samples per second it is!


And now for something completely different: driver software.
Until now I had been using an Arduino library in order to communicate with the MAX6675. After looking at its code and the datasheet I decided to ditch it and write my own. The library I used handles everything in software; it generates the clock signal in software using digitalWrite calls and reads the dataline using digitalRead calls. Furthermore it contains quite a few delays and handles the result in floats (ew).
The MAX6675's protocol is pretty similar to SPI, and since the ATmega328/2560 has hardware for that, why not use it? All you need to do is configure the SPI hardware by setting a few values in the SPI control register (SPCR) and set the pin mode for a couple of pins. Then, when you want to read the data you pull the chip select line low and start a SPI read (by writing a value to the SPDR register). Then you wait until a flag in the SPI status register is set (SPSR) and you read the received value from the SPDR register. Repeat this to get the second byte and drive the chip select line high again to start the next sample. Then it's a matter of combining the two received bytes and processing it. Easy! Just make sure to wait at least 220 ms before pulling the CS line low again.

The result is 6 lines of setup code and 10 lines of read code. Nice.

Saturday, November 8, 2014

Reflow Toaster Oven - Part 6 - PWM Fun

MAJOR WARNING NO 1: THIS COULD KILL YOU!

No, seriously, mains voltages can kill you, keep that in mind whenever you work with it. Having the cover off doesn't make it much safer, there's plenty of exposed contacts with 230V on them. That's lethal.

So now that we've cleared that up, let's have a look at what's happening here. I've replaced the thermostat with a solid state relay. There's a thermocouple connected to the heating element and plugged in to the Arduino. The Arduino monitors the temperature and turns the relay on when it's too cold, and off when it's too warm. The target temperature can be set using the serial interface. There's a bunch of other thermocouples in and around the oven to monitor the rest.

MAJOR WARNING NO 2: SOLID STATE RELAYS REQUIRE HEATSINKS!

I know it says "25Amp" on the cover, but if you check out the datasheets for these kind of relays then you'll notice they're only rated about 4A without the heatsink. That's why I've connected a thermocouple to the bottom of the SSR, so I can monitor its temperature (heatsinks are on their way). So on the thermometer I'm monitoring the following from top to bottom:
-oven temperature (large thermal mass probe)
-oven air temperature (small probe)
-oven top temperature
-SSR temperature

So after increasing the temperature a couple of times this is the result:

The blue line is the heater temperature. The red line is the target temperature and whether the element is on (high) or off (0). As you can see, lower temperatures require less frequent heating (duh) and it overshoots the target temperature sooner than with higher target temperatures.

This was to be expected, but it's good to see it in hard numbers. Next step is to also track the air temperature and see what kind of influence that has on the required dutycycle.

And yes, the SSR runs warm, 40 deg C and rising, target temperature is 250. Air temperature was 176 and the top of the oven was nearly 70 deg C.

Wednesday, November 5, 2014

Reflow Toaster Oven - Part 5 - Crispy Thermocouples

I like my thermocouples well done...
So that little blue piece of shrink tubing(?) doesn't seem to cope well with 200+ degrees C. Oh well.
Did a bit of testing tonight. I placed the four thermocouples in and around the oven:
- one attached to the heater
- one just floating in the middle of the oven
- one stuck through one of the vent holes on the side
- one attached to the top of the oven
And then I turned the oven on :) I recorded the whole thing and manually put all temperatures at 5 second intervals into a spreadsheet. Here's the result:
At one point the thermocouple on the heater fell off, that's when I turned the oven off. The interior was about 270 degrees C by then and kept rising for a short period. Then I opened the oven's door and the air temperature plummeted.The reason these readings differ so much from earlier profiling is because of the thermocouple I used. There small ones have very little mass, so they heat up much faster than the one I used earlier.
What worries me a bit are the green and purple lines. They reach about 80 degrees C, that means the oven is way too hot to put any electronic controls inside. I hope this is reduced significantly after I insulate everything.

I also played a bit with RaceRender, it can overlay various types of data on video images.
Nice :)

Tuesday, November 4, 2014

To Measure Is To Know

Mailbag time!
I got this HT-9815 4 channel K-type digital thermometer from eBay seller PerfectPrimeUSA (which of course is located in Hong Kong). Got it for a mere $26 (including free shipping) and four (cheap) thermocouples included. And it actually seems to work fairly well! Refresh rate is about once per second, it remembers lowest and highest temperatures measured as well as average temp. It can switch between degrees Celsius, degrees Fahrenheit and Kelvin and it actually appears to be reasonable accurate. The backlight is piss-poor (one LED located on the left side) but for this kind of money I can't complain really. Just shipping it back to Hong Kong would probably cost me more than what I've paid for it :)

I'll crack it open tomorrow, see what makes this thing tick, and I'll do some measurements with the oven.

Sunday, November 2, 2014

Reflow Toaster Oven - Part 3

Grounding issues

During the heat profiling I ran into some problems while trying to get stable results from the thermocouple. One of the problems was that the wire from the connector to the MAX6675 was way too long; over a meter. When I shortened this to 5 cm the readings were way more stable than before. Another issue arose when I put the thermocouple in the oven. When it touched any metal part of the oven then the readings would be all over the place. They'd jump about 10 degrees C up and down.

As it turns out, pretty much every metal part of the oven is grounded to mains earth. The thermocouple itself is shielded, but the shielding is electrically connected to the thermocouple. The thermocouple works by creating a really tiny voltage (in the order of microvolts) that rises when the temperature rises. The MAX6675 amplifies this voltage, reads it and performs some compensation. As you can imagine, it doesn't take much to throw off the readings completely. Connecting the thermocouple to mains earth is one of them...

I conducted a small experiment this afternoon to verify that this was in fact the issue. All I did was take a mains extension cord and touch the earth tab with the thermocouple.
I think the readings need no further explanation:

Averaging the values may make them a bit more useful; they're not completely random :)

Another thing I tested today was the temperature of the heating elements. The outside of the elements are connected to mains earth, so the readings aren't entirely accurate, but they should give a rough idea of the temperatures involved.

Yes, that's 400+ deg C before the thermostat cuts the power, yikes! Raw data can be found here. And 400+ deg looks a bit like this:
After the second time the thermostat cut the power I pulled the plug of the oven, disconnecting it's earth connection. You can see the signal immediately cleans up.

These grounding issues are annoying though. I need to have fairly fast and accurate temperature readings on the elements and oven, so I need to solve them some way or the other. I first thought about using kapton tape to electrically isolate the thermocouple from whatever it's connected to (while still maintaining thermal conductivity), but now that I've seen how hot these elements get I doubt that's going to be a good solution. Needs more research...

I need a different thermocouple, this one has too much thermal mass; it takes too much time to respond to temperature changes; the recorded temperature kept increasing even though the heating element just turned off. In this situation you want the thermocouple to have as little mass as possible so it will respond really fast to temperature changes. More eBay purchases coming up :)