Monday, October 10, 2011

Hot plate PI controller - Part 2: The temperature sensor

The thermometer I am using is the typical stove thermometer that you can buy from any kitchenware store. Mine came with our IKEA / Whirlpool kitchen stove.

I have no idea of the resistance of the thermistor probe that came with the thermometer so I had to set up a little experiment to find the resistance range.

I put 1 litres of water in a pot on an induction plate, turn on the heat for a while, turn it off to let the temperature settle and then measure temperature with the thermometer. Next I measure the resistance with a multimeter.

With four measurements I got this curve:

Excel shows the fitted linear curve and the nice little formula:


Where Rt is the termistor resistance and T is the temperature measured in centigrades.

I want to use the thermistor with a resistor and measure the temperature by setting them up as a voltage divider. Input voltage will be 5V:

By setting the second resistor to the value of 5 ohm I get the greatest difference between the lowest and highest measured voltage (2,85V) and thus the best resolution. The curve for voltage measured over the thermistor for the optimal resistor is shown below: 


Calculating for Rt:
1) Rt=R*F/(1-F)

From previous excel linear fitting for measured temperature:
2) T=(Rt+2.7)/0.2

1) and 2) put together:
T=25*F/(1-F)+13.5, where F=Vout/Vin

Finishing with an example:
What is the temperature when you are suppling the voltage divider with 5V and you get an ADC reading is 511?

A reading of 511 in the ADC is a measured voltage of 5V*511/1023=2.5V with a supplied voltage of 5V.


T=25*F/(1-F)+13.5=25*0.5/(1-0.5)+13.5=38.5 degrees celcius, which corresponds very well with the curve above.

The real excitement begins when I get a 5 ohm resistor, set up a measurement system and start measuring realtime temperature data. Is boiling temperature still measured to 100 degrees celcius?



Yesterday I tried setting up the voltage divider with the arduino. I found a 4.7 ohm resistor to use with the thermistor and was ready for measuring temperature with the arduino. 

I had thought very little about the consequences of using such small resistors: When I hook up a 4.7 ohm resistor with a thermistor that has close to zero ohm resistance at room temperature I get a current of 5V/5ohm=1A!! So when I set up the bridge and inserted the USB I got smoke coming out of the arduino or resistor. The arduino seems to be working fine afterwords, though, so I learned my lesson.

So I should rather find a resistor that has as low as possible reistance, without destroying the arduino. How low can it be?

Here are some of the limits:
- The USB 2.0 standard has a maximum current limit of 500 mA. 
- In the summary for the arduino UNO the I/O ports are rated for 40 mA. 
- In the data sheet for the Voltage regulator (LM340) I see a maximum current of 1 A at 5 V.
- I think the resistors I am using is 0,25 W type based on the thickness => Maximum current 50 mA.

I think the input impedance of the ADC pins are quite high, so there will not be much current going through to the ADC. That makes the resistors I am using the weakest link with maximum current 50 mA.

My new resistor will have to be at least 5 V / 0.05 A=100 ohm.

The new temperature chart will be like this:

The voltage range is too low, which means I get bad resolution (about 0.7 deg C) . I either need a different thermistor or a resistor with higher power rating.

In summary: Don't try to reuse the measurement probe from a thermometer. It's cheaper and easier to buy a thermistor with an available datasheet.