## Interfacing with Non-linear Thermistor

7 posts / 0 new
Author
Message

Hello everyone

This is my first post in AVRfreaks, and I hope it will be helpful. I want to interface ATmega8 with a Thermistor, that its temperature is not linear with its resistance. I connected it to A/D input in ATmega8, but the problem is, how to overcome the non-linearity problem.

If the answer is to use look-up table, please tell me how to use a look-up table in C language with ATmega8.

Thanks a lot in advance, I really appreciate it.
Regards,

She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

Depends on the temperature-range you're interested in. 10 - 25 degrC is almost linear if the 2nd resistor of the voltage-divider is the value of the NTC @ 20 degrC

If you need a larger range, a lookuptable is the way to go. If you perform linear interpolation between two points in the table, you get good results, even if the table is just 10 to 20 values long.

She is called Sylvia (2018), lives at Mint18.3 https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

The Atmel software for the Butterfly uses a table that is stored in program memory. You can get the code from Atmel written for some compiler, maybe IAR?

Or you can get Martin Thomas's GCC port here:
http://www.siwawi.arubi.uni-kl.d...

Speaking of interpolation, the Atmel code doesn't do that. It scans the table until it hits a value that is above, or maybe below, the value returned by the ADC. The table is so constructed that this introduces a small bias. Maybe 1/2 degree Celsius, I don't remember. I regenerated the table to remove the bias. The formula for making the table for the thermistor on the Butterfly is given in the user guide, if I remember correctly.

Quote:

If the answer is to use look-up table, please tell me how to use a look-up table in C language with ATmega8.

Well, that's kind of "general programming". Yes, you may struggle learning it but you should find plenty of examples. Stacks, queues, circular buffers, menu systems, ...

Quote:

I want to interface ATmega8 with a Thermistor, that its temperature is not linear with its resistance.

There have been extensive threads on NTC thermistors. We use a bias resistor to reduce the input impedance and narrow the signal range. Search for "thermistor spreadsheet" and study the hits:
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
https://www.avrfreaks.net/index.p...
etc.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Thanks guys a lot, I really appreciate it. My first post in AVRFreaks was absolutely helpful.

Regards,