hekete
• 1.3k
• 4
• 11

How accurate do you want your readings to be? 0.1 of a degree? 0.01 of a degree?

You have a couple of problems. Firstly your ADC is not very accurate to begin with. You also should be looking at reducing any noise your ADC is currently subject to. MCUs produce noise, if you have done nothing about that then your ADC is probably subject to enough noise to give you inconsistent results.

Then there is the thermistor, they aren't really super accurate devices to begin with. They suffer from self heating for a start and then there is how stable your input is.

You also need accurate calibration data on your thermistor, since there can be 5% difference to the data sheet values in some cases. But getting a reading at 25 degrees isn't easy, how do you keep the sensor at 25 degrees while you measure it? Getting a reading at 100 degrees is much easier, boiling water has to be at 100 degrees (theat sea level, the hotter parts become steam). So you can just stick it in some boiling water.

Once you have all your circuit issues squared away you can start thinking about your programming. Thermistors have a logarithmic relation with temperature to resistance. Generally they have better accuracy in some temperature range. The usual approach is to select the specific temperature range you're interested in (smaller range means greater accuracy) and then use your log functions over that range. Either generating a look-up table or if you have a fast enough chip that isn't terribly busy you can do the actual math on the fly.

But then this comes back to the accuracy of your ADC. If it can only produce 1024 discrete values, then you can only measure 1024 discrete temperatures.

Now if you only care that temperature is definitely between say 35.0 and 35.5 and you're only interested in temperatures between -20 and 50. Then this would entirely achievable with what you have. But if you wanted a larger range or a higher precision, it's not really going to be possible with what you're using.

To get more precision you would have use a smaller range and conversely for a larger range you have to reduce precision. Then at some point your ADC wont be able to tell the difference between two values or the noise will make it impossible to get a stable reading.

I highly recommend using this spreadsheet. You can play with the values and see what the error margins will be along with it providing recommended resistor values for measuring in a given temperature range.

hekete
• 1.3k
• 4
• 11

How accurate do you want your readings to be? 0.1 of a degree? 0.01 of a degree?

You have a couple of problems. Firstly your ADC is not very accurate to begin with. You also should be looking at reducing any noise your ADC is currently subject to. MCUs produce noise, if you have done nothing about that then your ADC is probably subject to enough noise to give you inconsistent results.

Then there is the thermistor, they aren't really super accurate devices to begin with. They suffer from self heating for a start and then there is how stable your input is.

You also need accurate calibration data on your thermistor, since there can be 5% difference to the data sheet values in some cases. But getting a reading at 25 degrees isn't easy, how do you keep the sensor at 25 degrees while you measure it? Getting a reading at 100 degrees is much easier, boiling water has to be at 100 degrees (the hotter parts become steam). So you can just stick it in some boiling water.

Once you have all your circuit issues squared away you can start thinking about your programming. Thermistors have a logarithmic relation with temperature to resistance. Generally they have better accuracy in some temperature range. The usual approach is to select the specific temperature range you're interested in (smaller range means greater accuracy) and then use your log functions over that range. Either generating a look-up table or if you have a fast enough chip that isn't terribly busy you can do the actual math on the fly.

But then this comes back to the accuracy of your ADC. If it can only produce 1024 discrete values, then you can only measure 1024 discrete temperatures.

Now if you only care that temperature is definitely between say 35.0 and 35.5 and you're only interested in temperatures between -20 and 50. Then this would entirely achievable with what you have. But if you wanted a larger range or a higher precision, it's not really going to be possible with what you're using.

To get more precision you would have use a smaller range and conversely for a larger range you have to reduce precision. Then at some point your ADC wont be able to tell the difference between two values or the noise will make it impossible to get a stable reading.

hekete
• 1.3k
• 4
• 11

How accurate do you want your readings to be? 0.1 of a degree? 0.01 of a degree?

You have a couple of problems. Firstly your ADC is not very accurate to begin with. You also should be looking at reducing any noise your ADC is currently subject to. MCUs produce noise, if you have done nothing about that then your ADC is probably subject to enough noise to give you inconsistent results.

Then there is the thermistor, they aren't really super accurate devices to begin with. They suffer from self heating for a start and then there is how stable your input is.

Once you have all your circuit issues squared away you can start thinking about your programming. Thermistors have a logarithmic relation with temperature to resistance. Generally they have better accuracy in some temperature range. The usual approach is to select the specific temperature range you're interested in (smaller range means greater accuracy) and then use your log functions over that range. Either generating a look-up table or if you have a fast enough chip that isn't terribly busy you can do the actual math on the fly.

But then this comes back to the accuracy of your ADC. If it can only produce 1024 discrete values, then you can only measure 1024 discrete temperatures.

Now if you only care that temperature is definitely between say 35.0 and 35.5 and you're only interested in temperatures between -20 and 50. Then this would entirely achievable with what you have. But if you wanted a larger range or a higher precision, it's not really going to be possible with what you're using.

To get more precision you would have use a smaller range and conversely for a larger range you have to reduce precision. Then at some point your ADC wont be able to tell the difference between two values or the noise will make it impossible to get a stable reading.