Regarding RTD sensors this may be of interest for people who struggle to get them working and accurate due to lack on information on how to interface them...
In case you like to make a decent interface yourself, read the below.
Normal thermistors are accurate but suffer from the metal oxide limit on temp range, so it stops at ca. 260’C.
Platinum RTD are easy to use over a very wide range (e.g. -70’C to 500 ‘C ) or even higher and a nice design advantage is that you can get them in really small and flat dimension (2x3x0.8mm). So you can build them into any difficult position and measure accurately.
So here is a guideline for interfacing a 2-lead RTD with an ATMega328p (nano, uno, or whatever): (for hardware)
-
To be able to monitor a PT1000 resistance sensor, we need a voltage divider to enable a small current through the sensor.
Here it is important to take the selfheating property of RTD sensors into account. For a PT1000 , the advised maximum current to use is 0.3mA. If you go over this, the sensor will drift due to self heating. -
Define the temp range you want to measure.
The lowest point is the resistance at which you need to stay below the 0.3mA.
So e.g. a PT1000 is 1000 Ohm at 0'C , so this means, that at this temp, the voltage over the sensor should be 0.0003 x 1000 = 0.3V. So, incase you use 5 Volt as source , the 2nd resistor of the divider is then 4.7/0.0003 = ~15.7kOhm.
From the above you can maybe already notice that the voltage range from 0 to e.g. 100'C is rather small, about 110mV.
So solve this, a few things you can do:
- set the Vref of the ADC to the internal 1.1V and decouple the Vref with a 100nF capacitor (ceramic)
(set bit 7 and 6 of ADMUX registor to 1):
lda r16,0x60
ld r17,0x7c
and r17,r16
sts 0x7c,r17
Now you have the 10 bits resolution (1024) steps in the 0 to 1.1V range
Using the interal Vref gives more accurate long term measurements then when using the Vcc line...
now we amplify the sensor signal (mv range) in such away that the highest temp you need to measure is close to the 1.1V level.
This we do with a general purpose operational amplifier as non-inv amplifier. lot of choices, but still the LM324 or LM224 (you have 4 in one) is good to go after decades ....
You can set the gain by tweaking the feedback resistor and the divider resistor to get close to the 1.1V on the positive input.
on the negative input you use the same divider but use 1000 ohm for the lower one to make a 1:1 comparison.
The resistors are as critical as you want to measure, but as we in case of an ATmega 328P only have 10 bits you can do 0.1'C resolution over a range of 100 degrees at ease when you use stable 1% resistors (low TC ppm) the absolute tolerance does actually not matter too much: you can tune by software.
1% metal film resistors with 50ppm temp coeff. is more then ok.
Don't use too high Ohm resistors for the dividor as they introduce too much noise into your amplifier (depending on environment).
For e.g -30'C to + 90'C range use 18 kOhm for both dividers and 8k2 Ohm for the feedback resistor, the LM324 works fine at single voltage supply of 5 V and its rail-to-rail amplifier so no issue. A few small capacitors and a low pass (R of 400 Ohm with a 0.1uF to Gnd) on the ADCinput to filter out HF noise (if you live near a large Transmitter Antenna, have crappy PC or other HF emittors.
In total its for about 4.8 euro on parts and yeah 8 euro shipping. .But you can make multiple range RTD sensors with one LM 224 (4) and do much more accurate measurements (0.01'C) over a 50' or 0.001'C on 25' range of your interest even with a limited 10 bit ADC.
An RTD sensor is not expensive at all, ~3.2 Euro for a 2 lead .... type B just look for it as component.
Thats it.
Alex