Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How do you calculate temprature from ADC value

Status
Not open for further replies.

jab99407

Member
I have general question if we have 10 bits ADC that gives range from 0 - 1024

What's formula to get temprature value in Celsius ?
 
Last edited:
That depends on the sensor or transducer that is connected to the ADC?

As a general principle, for a linear scale sensor: Call the values at 0'C "LO" and 100'C "HI" :

Temperature = ( ADC - LO ) * ( 100 / ( HI-LO ) )
eg. if 0'C was 177 and 100'C is 620

C = ( ADC - 177 ) * ( 100 / ( 620 - 177 ) );

The multiplier part is a constant so the compiler should calculate it, rather than it being re-calculated every time the calculation is performed.

If it's not a linear sensor input, eg. such as a thermistor and resistor divider, the calculation is somewhat more complex.
 
Last edited:
You cannot read a thermocouple directly with a normal ADC, the signal level is far too low - only about 4mV change from 0 to 100'C

You need to use a conditioning amplifier, and ideally a dedicated device made for K type interfacing, that has the cold junction compensation built in.

Something like this, that has compensation and linearization built in:

You can build one with separate components, like in this article, but it still uses a dedicated thermocouple-related device:

Note that every connection from a thermocouple through to it's conditioning circuit is critical.

A thermocouple is just two different metal conductors clamped or welded together, pretty much the same as many basic electrical connectors.

You need to use the matching Type K connectors and extension cable if the built-in cable is not long enough, and make sure any other connections or joints are identical construction (so adding the same offset voltages) in both wires, like where the thermocouple cable connects to the amplifier.

The amplifier output (and ground) can connect directly to the ADC input, if it has suitable gain.

The module in the first link has its output levels printed on the back; 1.25V offset at 0'C [LO] and 5mV per 'C scaling, making 500mV over 100'C, 1.75V out at 100'C [HI]

Convert those to the ADC count at whatever ADC ref voltage is in use, and plug them in the calculation I gave before.
eg. With 2.5V ref, 1.25 / (2.5 / 1023) for LO and 1.75 / (2.5 / 1023) for HI; 512 and 716

[A ten bit ADC has a range of 1024 values, 0 to 1023 inclusive].
 
Single chip solutions for this -



1647087150472.png


1647087191958.png


The above a 1 chip solution. And most of chip resources still left for other tasks.

Here are the other additional chip capabilities -

1647087526225.png





Regards, Dana.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top