# Sensor Thermistor design

#### lucasromeiro

Joined Dec 17, 2022
17
Looking at the datasheet of one of the thermistors, I noticed that one of them is much more linear than most thermistors. there are some interesting formulas that maybe I can use! I found this interesting, maybe it can help me in some way.

But the other model has a table with temperature values, which also helps, I'm still thinking about which of the 2 would be better to use.

see:

Model 1

Model 2:

#### Attachments

• 3.6 KB Views: 1

#### lucasromeiro

Joined Dec 17, 2022
17
First choose your pullup resistor - you chose 10k, to go with a thermistor that reads 10k at 25°C. That's perfect providing that you are most interested in temperatures around 25°C. If you want to measure a refrigerator, choose a pullup resistor that is the same as the thermistor's resistance at 4°C.
You don't need to connect the 10k resistor to an output port unless you are desperate to save power, or you want to avoid self-heating of the thermistor by the current through it. It can connect straight to the positive supply. The 10k resistor on the processor input is also unnecessary, unless your thermistor is on really long leads. If so, a capacitor across the input is not a bad idea.
Its a fair bet that your processor will have plenty of spare memory. If so, use Excel to create a spreadsheet to work out the temperature for all possible input voltages. Then turn that into a lookup table.
The relationship between voltage and temperature is so non-linear that trying to calculate it mathematically in the processor is a waste of time.
Hello, Ian,

Yes, my interest in connecting the voltage source of the resistive divider is to meet the 2 requirements you told me: to avoid heating and to save energy.
My application requires super low power consumption.
Thanks for the tip on better choosing the resistor value of the resistive divider, I hadn't thought of that.
Now I have a doubt in mind.
My SoC will run on 2 AA batteries, it runs from 3.3v up to 1.7v.
So the input voltage of my resistive divider will change.
But since my ADC reference voltage will also change with it, will that be a problem?

You told me that you would remove the resistor at the ADC input, in my case I will use a 1 meter cable. I am thinking of retreat or not. What do you think?

As our friends showed above, there are some ways to calculate this process mathematically.

But personally I'm also evaluating using a table and doing some polynomial regression for that...
I believe this will be more accurate.

There would be no way I could make a table for all possible temperatures. It's a lot of information. I need to find a precise and more mathematical way. Maybe polynomial regression is a good idea.

Looking at the datasheet of one of the thermistors, I noticed that one of them is much more linear than most thermistors.

I posted this above

#### bassbindevil

Joined Jan 23, 2014
838
Just how accurate is the ADC on the SoC? I've noticed that the cheap LED digital panel meters don't perfectly track my Fluke DMM, possibly due to an imperfect ADC in the microcontroller. There are I2C ADC modules like this: https://www.adafruit.com/product/1085

#### Ian0

Joined Aug 7, 2020
10,277
Yes, my interest in connecting the voltage source of the resistive divider is to meet the 2 requirements you told me: to avoid heating and to save energy.
My application requires super low power consumption.
Thanks for the tip on better choosing the resistor value of the resistive divider, I hadn't thought of that.
Now I have a doubt in mind.
My SoC will run on 2 AA batteries, it runs from 3.3v up to 1.7v.
So the input voltage of my resistive divider will change.
But since my ADC reference voltage will also change with it, will that be a problem?
In that case, leave in the extra resistors and switch the circuit off with the port as you had it - it all depends on whether you are saving power or saving BOM and assembly costs!

You told me that you would remove the resistor at the ADC input, in my case I will use a 1 meter cable. I am thinking of retreat or not. What do you think?
I think you should be OK, provided you use a twisted-pair or a screened cable, and you are not somewhere that is electrically noisy.

As our friends showed above, there are some ways to calculate this process mathematically.

The design in @bertus 's link is very useful if you have a temperature that doesn't vary very much, and you are only interested in accuracy over a small range.
But personally I'm also evaluating using a table and doing some polynomial regression for that...
I believe this will be more accurate.
You can generate the table from Steinhart-Hart - see attached spreadsheet

There would be no way I could make a table for all possible temperatures. It's a lot of information. I need to find a precise and more mathematical way. Maybe polynomial regression is a good idea.
You don't need a table for all possible temperatures, you need a table for all possible voltages, and there aren't that many - 4096 if you have a 12-bit A/D, and you can't get any more precise as you have a temperature for every possible A/D reading.
Looking at the datasheet of one of the thermistors, I noticed that one of them is much more linear than most thermistors.

I posted this above
Because it's on a log-log graph.
Even if it follows a nice curve, by the time you add the pullup resistor into the equation that ruins it!

If you really are short of memory for the table, then I have a neat interpolation routine to use a 256-element table.

#### Attachments

• 233.1 KB Views: 1
• 102.3 KB Views: 1

#### ericgibbs

Joined Jan 29, 2010
19,121
hi lucas,
Two LTSpice plots.
One with Ro=1k and the other Ro=10k
Should give you a clue to which may best suit your application.
E

Note: Vtmp is the Temperature range

May I ask what process are you measuring over this temperature range.?

Last edited:

#### lucasromeiro

Joined Dec 17, 2022
17
In that case, leave in the extra resistors and switch the circuit off with the port as you had it - it all depends on whether you are saving power or saving BOM and assembly costs!

I think you should be OK, provided you use a twisted-pair or a screened cable, and you are not somewhere that is electrically noisy.

The design in @bertus 's link is very useful if you have a temperature that doesn't vary very much, and you are only interested in accuracy over a small range.

You can generate the table from Steinhart-Hart - see attached spreadsheet

You don't need a table for all possible temperatures, you need a table for all possible voltages, and there aren't that many - 4096 if you have a 12-bit A/D, and you can't get any more precise as you have a temperature for every possible A/D reading.

Because it's on a log-log graph.
Even if it follows a nice curve, by the time you add the pullup resistor into the equation that ruins it!

If you really are short of memory for the table, then I have a neat interpolation routine to use a 256-element table.
Hello,

Thanks for the answers, they help me to grow.
I'm evaluating everything I've been told.

Now I had a thought that is interesting to discuss here...

Wouldn't it be better to use a digital sensor?

I looked for a sensor that has a power range between 1.7 and 3.3v, with a power consumption similar to 1-50uA and with an accuracy of at least 0.1-0.5 degrees C. I didn't find good value for money options.... One good target cost for me is something less than 1 dollar for this sensor.

In the searches I found the following options and I even have them here with me:

aht-15 (3u$) TMP112AIDRLR (1.6u$)

I need something cheaper if possible.

Cost was the main reason I tried to adopt a thermistor. But after talking with you and learning a lot, I see that it is not that simple, the accuracy will not be as good as I imagined it would be.

Do you know of any CI options that would fit well with this solution? I'm still evaluating options and maybe a digital IC would be better.

#### lucasromeiro

Joined Dec 17, 2022
17
hi lucas,
Two LTSpice plots.
One with Ro=1k and the other Ro=10k
Should give you a clue to which may best suit your application.
E

Note: Vtmp is the Temperature range

May I ask what process are you measuring over this temperature range.?

View attachment 283355View attachment 283356

Hi ericgibbs,
Okay?
Thanks for the simulations.

My use will be in refrigerators and freezers.
I will use a device to read the internal temperature of refrigerators and freezers and send this data to the cloud.

Eventually this thermometer will measure room temperature, but these are uncommon cases.

Most of the time it will be inside a refrigerator, between 10 and -20 degrees C, and can reach -40.

I said above that now I'm wondering if it wouldn't be better to use a digital IC for this operation.

What do you think?

#### ericgibbs

Joined Jan 29, 2010
19,121
I would like a resolution of at least 0.1 degree celcius.
Hi lucas.
I cannot understand why you consider a +/-0.1Cdeg resolution or a freezer is required, surely +/-0.5Cdeg would be acceptable.
How accurate do you require the reading, again I would say +/-0.5Cdeg would be OK.

E

#### Ian0

Joined Aug 7, 2020
10,277
Hello,

Thanks for the answers, they help me to grow.
I'm evaluating everything I've been told.

Now I had a thought that is interesting to discuss here...

Wouldn't it be better to use a digital sensor?

I looked for a sensor that has a power range between 1.7 and 3.3v, with a power consumption similar to 1-50uA and with an accuracy of at least 0.1-0.5 degrees C. I didn't find good value for money options.... One good target cost for me is something less than 1 dollar for this sensor.

In the searches I found the following options and I even have them here with me:

aht-15 (3u$) TMP112AIDRLR (1.6u$)

I need something cheaper if possible.

Cost was the main reason I tried to adopt a thermistor. But after talking with you and learning a lot, I see that it is not that simple, the accuracy will not be as good as I imagined it would be.

Do you know of any CI options that would fit well with this solution? I'm still evaluating options and maybe a digital IC would be better.
Hello,

Thanks for the answers, they help me to grow.
I'm evaluating everything I've been told.

Now I had a thought that is interesting to discuss here...

Wouldn't it be better to use a digital sensor?

I looked for a sensor that has a power range between 1.7 and 3.3v, with a power consumption similar to 1-50uA and with an accuracy of at least 0.1-0.5 degrees C. I didn't find good value for money options.... One good target cost for me is something less than 1 dollar for this sensor.

In the searches I found the following options and I even have them here with me:

aht-15 (3u$) TMP112AIDRLR (1.6u$)

I need something cheaper if possible.

Cost was the main reason I tried to adopt a thermistor. But after talking with you and learning a lot, I see that it is not that simple, the accuracy will not be as good as I imagined it would be.

Do you know of any CI options that would fit well with this solution? I'm still evaluating options and maybe a digital IC would be better.
I agree with @ericgibbs on your need for accuracy.
Those two digital sensors are right at the limit of their range.
I2C doesn't do long cables (and you would need four cores).
As you might guess, I use thermistors all the time (otherwise, why would I have such useful spreadsheets to hand?)
Once you have the ability to generate the lookup table, it's a doddle. Thermistors are reliable (though RS components did sell me a batch recently that were out of spec)
I use this one
https://uk.rs-online.com/web/p/thermistor-ics/0151221
because it is a "curved matched" type,
and I have a better datasheet should you need it.
From your point of view, it can manage -80°C. That's no advantage for me, because the weather here doesn't get that cold!

#### MrChips

Joined Oct 2, 2009
31,088
You cannot have it both ways, low cost and ±0.1°C interchangeability.

You don't need ±0.1°C accuracy across the entire range of -40°C to +30°C.
You can focus on your typical application range of perhaps -20°C to +10°C and even ±0.5°C.

If you want a low cost solution, look at LM35.
If you want a high accuracy digital temperature sensor such as TMP117 you will have to pay for it.

#### Ian0

Joined Aug 7, 2020
10,277
You cannot have it both ways, low cost and ±0.1°C interchangeability.

You don't need ±0.1°C accuracy across the entire range of -40°C to +30°C.
You can focus on your typical application range of perhaps -20°C to +10°C and even ±0.5°C.

If you want a low cost solution, look at LM35.
If you want a high accuracy digital temperature sensor such as TMP117 you will have to pay for it.
LM35 isn't such a low-cost solution as it needs a negative supply to read temperatures below 0°C.
With TMP117, you have to deal with the I2C bus, which really isn't happy with long cables (and you need 4 wires)

#### lucasromeiro

Joined Dec 17, 2022
17
LM35 isn't such a low-cost solution as it needs a negative supply to read temperatures below 0°C.
With TMP117, you have to deal with the I2C bus, which really isn't happy with long cables (and you need 4 wires)
Hello guys.

LM35 is really not a good solution for me.

I've evaluated some cost/benefit scenarios here and an accuracy of 0.5 degrees C is still acceptable for me.
0.5 would be my acceptable limit. The ideal would be less than that, if possible.

I found the SHTC3 Chip which costs 0.9$in china. It looks interesting and has an accuracy of 0.2 degreesC. As for the number of threads, I can use 4 threads without a problem, if necessary. I can use i2c without problem. In most cases I will use the sensor soldered to the circuit board, without wires. But eventually I will need wires to read something external. Thread Starter #### lucasromeiro Joined Dec 17, 2022 17 You cannot have it both ways, low cost and ±0.1°C interchangeability. You don't need ±0.1°C accuracy across the entire range of -40°C to +30°C. You can focus on your typical application range of perhaps -20°C to +10°C and even ±0.5°C. If you want a low cost solution, look at LM35. If you want a high accuracy digital temperature sensor such as TMP117 you will have to pay for it. ±0.5°C are my limit, but goot yet. but the resolution, i need 0.1 °C. #### Ian0 Joined Aug 7, 2020 10,277 Hello guys. LM35 is really not a good solution for me. I've evaluated some cost/benefit scenarios here and an accuracy of 0.5 degrees C is still acceptable for me. 0.5 would be my acceptable limit. The ideal would be less than that, if possible. I found the SHTC3 Chip which costs 0.9$ in china.
It looks interesting and has an accuracy of 0.2 degreesC.

As for the number of threads, I can use 4 threads without a problem, if necessary. I can use i2c without problem.

In most cases I will use the sensor soldered to the circuit board, without wires. But eventually I will need wires to read something external.
Are the rest of your components rated down to -40°C ?