Author Topic: Tracking temp changes with MCU  (Read 4513 times)

0 Members and 1 Guest are viewing this topic.

Offline anso-engineerTopic starter

  • Regular Contributor
  • *
  • Posts: 132
  • Country: ua
Tracking temp changes with MCU
« on: May 01, 2026, 07:24:41 am »
Hello, I observing the ways measuring temp of the object which can be in range 10..100 C.

Some of my implementation has DS18B20 and it works through UART (STM32 doesn't have native implementation of OneWire for it). Recently, some guy suggested me to use NTC instead of 18B20, I google it, and looks like it's pretty common way.

Do you prefer to use some concrete sensors or NTC for these purposes? I don't know how to properly handle the NTC change law, because it's not to linear, in the same tiem it's not good to hardcode most of these values.



 

Offline Xiamatsu

  • Regular Contributor
  • *
  • Posts: 59
  • Country: ru
Re: Tracking temp changes with MCU
« Reply #1 on: May 01, 2026, 12:26:34 pm »
There are interesting sensors from NOVOSENSE - NST1001, the pulses only need to be counted - very simple processing is obtained.  And the housings are different - even the small dfn2 is the same size as the 0603 resistor.
« Last Edit: May 01, 2026, 12:28:48 pm by Xiamatsu »
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #2 on: May 01, 2026, 01:24:36 pm »
I have used the old Dallas 1-wire system and it can be really unreliable.

The biggest temp variation is from a thermistor, and yes they need linearising but this is trivial with software. Also +100C is pushing it; most of them suffer migration of solder etc into the bulk at higher temps. I have used them extensively and only the glass-encapsulated ones remained accurate. But they were less accurate to start with (0.2K versus 1K for example).

Same for the old AD590. Used many thousands and they drift at +100C, despite what the data sheet claims.

A silicon diode is very cheap but needs initial cal.

What accuracy do you need, and can you do factory cal?
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 2001
  • Country: 00
Re: Tracking temp changes with MCU
« Reply #3 on: May 01, 2026, 01:54:29 pm »
A PT100 or PT1000 or PT1K sensor providers a linear change in resistance if that's what you want. Its still a resistive element, so should be easy to read with a microcontroller. A resistive divider, op-amp circuit or even wheatstone bridge if you need more accuracy.

You can get PT100/PT1000 sensors on flying lead cable. Mount them near the hot stuff, then screw or solder them into the electronics elsewhere. If you get one thats properly rated one it should be fine.
Alternatively thermocouples could be used, but those need fiddly amplifiers.

These solutions get increasingly more expensive. DS18B20 is also not a cheap chip though, but perhaps on a similar level as PT1000 if want it in a prefabricated cable.
NTC is by far the cheapest though.. and you could correct for the exponential curve in software.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17843
  • Country: fr
Re: Tracking temp changes with MCU
« Reply #4 on: May 01, 2026, 02:02:38 pm »
OP's requirements are a bit unclear, if it's to measure the temperature (surface temperature I suppose?) of some object rather than ambient temp, then the sensor will need to be thermally coupled to the object and that somewhat limits your options - for instance, that is likely making it inconvenient to use a small SMD sensor, that are available with a variety of interfaces (mostly I2C though) and accuracy, and would otherwise be the easiest.

You need to also define what distance there needs to be between the sensor and device that reads it, if you can make your own PCB, etc.

If you were considering NTCs, and there is some distance between the sensor and reading board, I would rather recommend using RTD sensors (like Pt100), which are much more accurate without requiring much calibration, but require a proper front-end. And they have a response curve that is not linear, but it's actually standard and coefficients are defined per a standard, and if your front-end is decent, they may not require calibration or maybe just the offset. In your case, a Pt1000 sensor is probably more adapted. While they require a dedicated front-end, the benefit is that the front-end can be at some distance from the sensor itself, and so the front-end won't be affected by the sensed temperature, making things also more accurate / not requiring fancy compensation. Just a thought. I have used Pt100 sensors with a relatively simple front-end, using a ADS1118 ADC and applying the response curve from the standard in software, and even without any kind of extra calibration, I was getting an error within +/-1°C. That was the least painful experience I have had with temperature sensing as far as I'm concerned, YMMV.


 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #5 on: May 01, 2026, 02:48:26 pm »
Quote
A PT100 or PT1000 or PT1K sensor providers a linear change in resistance

PT100 etc are not linear; they still need linearisation but that is trivial in software.

Yes; PT100/PT1000 is best for +100C and you can solder them.

Quote
I have used Pt100 sensors with a relatively simple front-end, using a ADS1118 ADC and applying the response curve from the standard in software, and even without any kind of extra calibration, I was getting an error within +/-1°C. That was the least painful experience I have had with temperature sensing as far as I'm concerned, YMMV.

That's funny - exactly what I have in my last project :)

I measure the sensor ratiometrically against a 0.01% resistor and the accuracy is 0.1C or whatever the sensor element is rated at. The sensor supply is from a TL431 (buffered) so very stable short-term. One may have to turn the supply on/off to reduce self-heating; I did a lot of measurements on different PT100 packages to get an idea. This is a standard technique in temperature instruments, for several decades.

The ADS1118 is also handy for measuring the PCB or whatever temperature. I use it for CJC because I also have a thermocouple option (all eight types of TCs). Got to mount the ADS1118 right up close to the terminal block.
« Last Edit: May 01, 2026, 02:51:34 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 2001
  • Country: 00
Re: Tracking temp changes with MCU
« Reply #6 on: May 01, 2026, 05:22:09 pm »
Ah you're both right, thanks for clearing up the misunderstanding. For an application I used them a while ago I simplified them as being linear. I was automating some convection helper fans for my radiators. I measure the inlet and outlet temperature on some radiator pipe to control fan speeds, and those pipes typically are at 15-65C. Small enough to say the resistance changes 3.85%/10C. I wasn't that concerned about an absolute error of +/-0.5C, as long as I could "zero" both channels with high repeatability and ensure the accuracy of the temperature curve is tightly spaced.

If I would have paid top dollar for accurate PT1000 sensors and <0.1% resistors, it could have been a lot more accurate.
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #7 on: May 01, 2026, 06:13:22 pm »
Problem with RTD is the high cost.

In a previous life I spent years making products with precision thermistors. These (Fenwal was the name then) were accurate to 0.2C which was awfully tempting when making differential temperature controllers for solar heating. The low sensor on the hot water tank and the high sensor on the solar panel. You can guess the temp of the higher sensor ;)

We got very badly ripped off, first by Analog Devices on the AD590 which suffered drifts of several K at those temps (TO18 case, we used). Their top sales rep took me for the biggest lunch available but to no avail. Some 4 digit # were sent back. Then we moved to the Fenwal thermistors, with similar results but it took longer for the chickens to come home to roost. Eventually we went to glass cased thermistors, name forgotten and long gone, looked like a fat 1N4148. They worked, 10s of k with zero failures, but 1C accuracy.

I doubt it is different today. Who thinks the LM35, "Rated for Full −55°C to 150°C Range" will be stable at high temps?

Also:
https://www.eevblog.com/forum/metrology/long-term-stability-of-temperature-sensors/

I doubt the OP, UKR but more likely Russia, wants to know all this, or even actually needs +100C :)

« Last Edit: May 01, 2026, 06:18:36 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 215
  • Country: es
Re: Tracking temp changes with MCU
« Reply #8 on: May 01, 2026, 10:40:18 pm »
I doubt it is different today. Who thinks the LM35, "Rated for Full −55°C to 150°C Range" will be stable at high temps?


Did you try a reverse biased 4148 as high temp NTC? I lighted it up until the red body turned into gray (maybe 500ºC or more), the tester read 10 ohm, then let it cool, the red color came back, out of ohmic scale at room temp, and Vf was the same as before the diode was abused.
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #9 on: May 02, 2026, 07:13:35 am »
For sure a glass bead diode, used for Vf, will work, but the Vf, nominally 0.6V, varies a lot, and would need factory calibration. Same for the slope, nominally -2mV/K.

Lots of cheap temperature controllers use a 4148 for the CJC. They mount it inside the terminal block.

BTW I found those glass bead thermistors. Midwest was the make.
https://www.eevblog.com/forum/chat/solar-pool-heater-sensor-sunlover-csc-v3/msg2921776/#msg2921776
« Last Edit: May 02, 2026, 07:16:28 am by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline anso-engineerTopic starter

  • Regular Contributor
  • *
  • Posts: 132
  • Country: ua
Re: Tracking temp changes with MCU
« Reply #10 on: May 02, 2026, 08:44:07 am »
What accuracy do you need, and can you do factory cal?
I am not sure what is factory cal (calibration)? I have small thermal visor, it can help with calibration if needed.
Speaking about accuracy, if it will be about +-2 C in both sides that's very good.

 

Offline anso-engineerTopic starter

  • Regular Contributor
  • *
  • Posts: 132
  • Country: ua
Re: Tracking temp changes with MCU
« Reply #11 on: May 02, 2026, 08:45:07 am »
There are interesting sensors from NOVOSENSE - NST1001, the pulses only need to be counted
firstly hear about it, how expensive is it on the global market?
 

Offline anso-engineerTopic starter

  • Regular Contributor
  • *
  • Posts: 132
  • Country: ua
Re: Tracking temp changes with MCU
« Reply #12 on: May 02, 2026, 08:51:43 am »
You need to also define what distance there needs to be between the sensor and device that reads it, if you can make your own PCB, etc.
It will measure heater surface, it won't be on the same surface as PCB. 30-50cm wire will goes as connection to MCU board.

A PT100 or PT1000 or PT1K sensor providers a linear change in resistance if that's what you want. Its still a resistive element, so should be easy to read with a microcontroller. A resistive divider, op-amp circuit or even wheatstone bridge if you need more accuracy.
NTC is by far the cheapest though.. and you could correct for the exponential curve in software.
Probably to expensive for my purposes, it costs as x3 or even x5 DS18B20 or NTC with wire.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 19282
  • Country: us
  • DavidH
Re: Tracking temp changes with MCU
« Reply #13 on: May 02, 2026, 12:52:32 pm »
I would tend to use an AD590 or similar integrated sensor over that temperature range, but what kind of accuracy are you expecting?

Over such a large range, an NTC is usually combined with a couple of precision resistors to linearize its output, but it will still need digital correction for good accuracy.  The advantage of an NTC is high sensitivity.

A platinum RTD will provide better accuracy over that temperature range than the alternatives even without linearization.  With the proper circuit, calibration will not be required for moderate accuracy.

A diode, or more likely a diode connected transistor, can be used over that range *without* calibration using the delta Vbe method.  There are many example circuits but here is one:

https://www.edn.com/transistor-%E2%88%86vbe-based-oscillator-measures-absolute-temperature/

There is also a triple delta Vbe measurement method which compensates for series resistance to give a more accurate result.

 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #14 on: May 02, 2026, 04:49:02 pm »
Just been reading that LT appnote. How ingenious! Mind you, the cost of those LT chips is probably more than a PT100 with a good ADC :) But if you wanted it as a frequency, on a single wire, maybe a good solution.

It still needs a close tolerance capacitor, or factory calibration.

I just don't trust semiconductor sensors for +100C.
« Last Edit: May 02, 2026, 05:17:53 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline anso-engineerTopic starter

  • Regular Contributor
  • *
  • Posts: 132
  • Country: ua
Re: Tracking temp changes with MCU
« Reply #15 on: May 04, 2026, 11:10:05 am »
I would tend to use an AD590 or similar integrated sensor over that temperature range, but what kind of accuracy are you expecting?
Too expensive as for final design. Accuracy about +- 2°C will be very good for me.
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 215
  • Country: es
Re: Tracking temp changes with MCU
« Reply #16 on: May 04, 2026, 05:28:52 pm »
In the past, i've used the KTY81 in my designs where an accuracy of ±2 degrees celsius is enough.
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 215
  • Country: es
Re: Tracking temp changes with MCU
« Reply #17 on: May 04, 2026, 05:43:45 pm »
There are interesting sensors from NOVOSENSE - NST1001, the pulses only need to be counted.

Looping the loop... If we go extremelly cheap and we've already got a MCU with an internal comparator or an input with hysteresis, then, all we need is a ceramic disc capacitor with Y5V die-lectric and a resistor to ground. You set the GPIO to output HIGH and the capacitor charges. Then turn the GPIO to input compare and start a timer for monitoring the discharge time. The shorter the time, the higher the temperature.

Cheaper than that, i think it's impossible. However, reliabillity is another matter.

https://youtu.be/63r_wOEvIVY?is=JYhC5LbxnaOmbyVA
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 5852
  • Country: dk
Re: Tracking temp changes with MCU
« Reply #18 on: May 04, 2026, 06:17:58 pm »
I would tend to use an AD590 or similar integrated sensor over that temperature range, but what kind of accuracy are you expecting?
Too expensive as for final design. Accuracy about +- 2°C will be very good for me.

a !n4148 with pullup is roughly ~2mV/C

 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #19 on: May 05, 2026, 05:14:18 pm »
What absolute accuracy (i.e. Vbe spread) would you expect to see? A quick google suggests a few tens of mV, which is a LOT.
There is also this
https://www.eevblog.com/forum/projects/in-the-same-circuit-how-much-can-vbe-vary-for-different-small-signal-transistors/

My recollection from the original 1970s temperature controllers (Eurotherm) is that they used a diode, and a trimpot to set the CJ temp. It was cheap...
« Last Edit: May 05, 2026, 05:18:38 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17843
  • Country: fr
Re: Tracking temp changes with MCU
« Reply #20 on: May 05, 2026, 05:29:55 pm »
Yeah I would personally not bother with a simple junction-based temperature estimation, unless I really had no alternative or absolute accuracy was not at all a concern (for instance if you just need to detect a "high temperature" condition with a large tolerance, this would be ok.) Or if periodic calibration was ok.



 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 19282
  • Country: us
  • DavidH
Re: Tracking temp changes with MCU
« Reply #21 on: May 06, 2026, 02:12:04 pm »
I would tend to use an AD590 or similar integrated sensor over that temperature range, but what kind of accuracy are you expecting?

Too expensive as for final design. Accuracy about +- 2°C will be very good for me.

They used to be a lot less expensive.

Just been reading that LT appnote. How ingenious! Mind you, the cost of those LT chips is probably more than a PT100 with a good ADC :) But if you wanted it as a frequency, on a single wire, maybe a good solution.

It still needs a close tolerance capacitor, or factory calibration.

I just don't trust semiconductor sensors for +100C.

I linked that example from Jim Williams for the linear output version which requires no calibration.  This concept has been around for a *long* time, as shown below from 1971!

Here is the article for the triple delta Vbe circuit:

https://www.electronicdesign.com/technologies/analog/article/21762159/triple-current-modulation-delta-vbe-thermometry-cancels-ohmic-error-sources

The missing schematic from the article is shown below.  It also requires no calibration, but does require six 0.1% precision resistors and a 2.5 volt reference for a 1C accuracy analog output.  If digital calibration is available, like if you are just digitizing the output, then this part of the circuit can be considerably simplified.
« Last Edit: May 07, 2026, 07:39:18 am by David Hess »
 
The following users thanked this post: oPossum

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #22 on: May 06, 2026, 08:48:13 pm »
VERY clever :)
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 19282
  • Country: us
  • DavidH
Re: Tracking temp changes with MCU
« Reply #23 on: May 07, 2026, 07:43:12 am »
Another place to find silicon temperature sensors is some references which include a PTAT (proportional to absolute temperature) output, but an LM35 is probably less expensive at $13.30/10, and there are board mount temperature sensors much less expensive than that.
 
The following users thanked this post: niconiconi

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: Tracking temp changes with MCU
« Reply #24 on: May 07, 2026, 01:02:16 pm »
The LM35 and the AD590 are now really expensive. I wonder what has enabled this, when there are so many other ways to do it?

The 0.5C AD590 grade is about 20 quid!
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->