Its always handy to have a basic temperature circuit to hand, this basic circuit is structured to be a building block for additional applications and we have at our disposal many spare pins on the 16f876 pic i have chosen here. And it was in my spares box so it was to hand.
So the basic circuit will use standard 5v rail, GND, etc. This circuit will develop as we go, capacitors will develop values, new components will appear, resistances may change, really its all about enjoying the design, and breaking it down to its bare bones, so lets walk before we run.
The temperature sensor delivers, at a steady temperature, a constant current that is proportionate to its temperature. If it is at 25degC, then the current flowing through the 10k resistor is 298uA. Remember, the sensor outputs 273uA at 0 degrees C, so the increase in 25degC= +25uA.
Therefore the voltage developed across the 10K resistor will be,
V=IxR, 298uA x 10,000 = 2.98 Volts.
This all looks too easy, just multiplying each increase in degC with 1uA gives us our perfect temperature transducer. That would be too easy!
The data sheet for the AD590 states that +4volts must remain across the device for it to behave properly, if we used a 10k resistor to sense the current would be dropping far too much volts across it to leave +4volts across the AD590 sensor.
So we move the sensor value down to an acceptable value, but what should it be?
The maximum working temperature of the sensor is 150degC, which would result in a current flowing through the 10K resistor of,
273uA (0 degreesC) + (150degC x 1uA) = 423uA
hence the voltage presented at the ADC input (AN0) will be,
10,000 x 423uA = 4.23 Volts
Way too high, as this would split the 5volt rail and leave only 0.76V across the AD590.
So if we used a 2K resistor, this would divide this maximum value by 5, so a resultant 0.846 Volts will develop across the 2K Resistor. This leaves 4.114V acrosss the AD590 ensuring it behaves within specifications stated on its datasheet.
This is the organic process that we call design, lets continue.
Now we have a 10 bit ADC that is expecting a value somewhere between 0 volts and +5 Volts , but our current design can never realise that, well, not without going seriously wrong!
A 10 bit ADC gives us 2^10 individual levels of resolution, 1,024 discrete values from min to max,
this is a resolution of (Vmax - Vmin) / 1,024 = (5v - 0v) / 1,024 = 4.88mV/bit
however this is wasted with our current design as we are limited to 150degC, which is a voltage of 0.846 volts presented at the input of the ADC.
If we input 0.846v in the ADC as it stands, the ADC result would be,
0.846 Volts / 4/88mv = 173 decimal
if we consider this as the effective reading at 150 degC then the effecitive resolution is no longer 1,024 for our purposes, its worse than an 8 bit adc, we are wasting bits!
What we need to do now is use the available hardware on the Pic to scale the ADC to our needs. We can use Pin 5, +Vref to apply a maximum value to our ADC. If we set the +Vref to 1volt, then our ADC would be better set to capture the levels and changes in our sensed voltage.
An easy way to do this is to split our voltage using a simple resistor divider.
if we wish to divide the 5v rail to 1v then we can assume that the inputs here will not load the divider greatly, we will use a 10K resistor as R1 in our divider circuit.
We also know Vin = 5Volts, and Vout = 1Volt,
We also know Vin = 5Volts, and Vout = 1Volt,
R2 = R1/((Vin/Vout)-1)
R2= 10k/((5v/1v)-1)
R2 = 10k/(4)
R2= 2.5k
So at this point we really should update our schematic to reflect our recent changes!


