I wanted a temperature in the Arduino and I didn't have anything active or nice, but I found a KTY81-220 I ordered a while back.
Spend the whole afternoon reading the datasheet, then working out how to get an accurate reading off it.
I ended up with this:
With R0*C fixed with a trimmer (actually should be 1630) and R80*C being the thermistor. With R1 and R2 forms a wheatstone bridge.
Two unity gain op amps (LM324) buffer off the voltages from either side of the bridge. A final opamp amplifies the differential so that 80*C should be about 3.5V - the upper limit for the LM324 for Vcc-1.5V on a 5V supply and 0C should be 0V.
This is fed to the Arduino ADC pin.
Then I spent a bit of time on how to read the Arduino voltage reference and calculate Vcc as it sees it. In the end I copy and pasted the code.
This got me to within 10mV of my DMM on the analogue read. WooHoo!
I read all my resistors with the DMM and (using a webpage) calculated my differential gain as 4.584
So I used some code to calculate back through the opamp gain, the differential and finally to get the wheatstone voltage for the thermistor divider. Then solved the divider for R2.
With a value for R2 (the thermistor resistance, R80*C in the schematic) I used a lookup table from the data sheet, giving me temp and resistance.
Scanning the lookup table for the two rows either side of the actual value and calculating the partial amount I was done.
Here's the rubbish bit. The value of Vcc is so critical that being out by 10mV will through the R2 calculation off to with a matter of 40-50Ohms. Which gives an error of ~ +-3*C. The temp sensor itself (around 25*C) has a max error of 2.7*C.
So as an ambient temperature sensors it's fecking useless!
I tested it with my kitchen probe from ETI Ltd and found it was surprisingly only out by about 1*C.
BUT! It's still useless as the temp of the sensor is between 2 and 3 *C above ambient.
A few things I can do with it. I can calibrate it for the current flow self-heating to see if that makes a big difference or I can pulse a digital pin as the input to the wheat stone bridge pause for 5 ms and read the voltage. This way current is only flowing for circa 5ms per second, to prevent self heating.
To be honest, it would have been far simplier using a nice digital active temp sensor like the Dallas 1-Wire devices.
Still a lot of fun and my first op amp circuit that worked first time! All 3 of them too! Woohoo!
Also my first go at using LTSpice.