To calculate the Celsius I've found this code snippet:
This assumes that I have a setup like this:
GND|-----|10K|-----|uC|-----|NTC*|-----|+5vdc
*10K @ 25°C
The uC is to the ADC pin on PIC18F25K22
Now it turns out that my DIY thermometer is approximately 1° lower than the commercial I've bought. (It's really cheap, so it could be wrong.)
I've measured the 10K resistor, and it shows 9 960 Ohm, so I changed 10000 in the code snippet to:
But it's still off.
So I was thinking of putting a 10K pot in series with the 10K, and change the 10K to a 5.6K. Like this:
GND|-----|10K pot|-----|5.6K|-----|uC|-----|NTC*|-----|+5vdc
This way the resistance is adjustable and I can calibrate it with my commercial one.
Is it a good idea or not?
Everything is breadboarded, so I was also wondering if stray capacitance could be an issue, but as long as I'm not doing any RF, I don't think so.
Rich (BB code):
temperature = log(((10240000/adc_raw)-10000));
temperature=1 / (0.001129148 + (0.000234125 * temperature) + (0.0000000876741 * temperature * temperature * temperature));
temperature = temperature - 273;
GND|-----|10K|-----|uC|-----|NTC*|-----|+5vdc
*10K @ 25°C
The uC is to the ADC pin on PIC18F25K22
Now it turns out that my DIY thermometer is approximately 1° lower than the commercial I've bought. (It's really cheap, so it could be wrong.)
I've measured the 10K resistor, and it shows 9 960 Ohm, so I changed 10000 in the code snippet to:
Rich (BB code):
temperature = log(((10240000/adc_raw)-9960));
temperature=1 / (0.001129148 + (0.000234125 * temperature) + (0.0000000876741 * temperature * temperature * temperature));
temperature = temperature - 273;
So I was thinking of putting a 10K pot in series with the 10K, and change the 10K to a 5.6K. Like this:
GND|-----|10K pot|-----|5.6K|-----|uC|-----|NTC*|-----|+5vdc
This way the resistance is adjustable and I can calibrate it with my commercial one.
Is it a good idea or not?
Everything is breadboarded, so I was also wondering if stray capacitance could be an issue, but as long as I'm not doing any RF, I don't think so.