Discussion in 'Embedded Systems and Microcontrollers' started by Guest3123, Jun 27, 2016.

1. ### Guest3123 Thread Starter Member

Oct 28, 2014
330
18
Alright, so I wanna get my hands dirty with Arduino.

I wanted to mess with Thermistor's as my first project. Just reading tempature from a Thermistor.

I have a product from Mouser Electronics, that I want to use as my thermistor.

That's this thermistor : GA50K6A1A

I even looked at, and have the Datasheet.

It's a nice one, very accurate, and not too expensive.

So, I see that it has a chart how the resistances relate to the temperatures. That's great !

Fantastic.

So.. 50,000 Ω @ 25°C

(°C x 1.8) + 32 = °F
25 x 1.8 = 45 + 32 = 77°F
Great.

Alright, here's the part where I need help.
50,000Ω = 25°C
47,724Ω = 26°C

50,000 - 47,724 = 2,276Ω Difference, when tempature rises 1°C

Again.. According to the chart.
26°C = 47,724Ω
27°C = 45,564Ω

47,724 - 45,564 = 2160 Difference.

That sure looks different than 2,276.

So what gives?

Why the heck doesn't it stay the same for each time the tempature changes 1°C ?

I looked online, and there is a formula, but it's EXTREMELY CONFUSING. Because I simply don't understand.

Also, my last question, why do I need a resistor for the thermistor, if the thermistor is already a resistor?

2. ### tracecom AAC Fanatic!

Apr 16, 2010
3,878
1,396
Thermistors are not linear devices, i.e., their resistance does not change by a constant value as the temperature changes (as you have already discovered.)

You can't measure resistance directly with a microcontroller; instead, you must measure voltage, and that is done with a voltage divider. In this case, the voltage divider consists of the thermistor connected to one side of a known voltage and the resistor connected to the other polarity of the voltage. Then, the thermistor is connected to the resistor, and the voltage at that junction will be proportional to the ratio of the resistances of the thermistor and the resistor. You connect that point to an input on your mcu, read the voltage, and convert that voltage to temperature.

Clear as mud? Right?

Last edited: Jun 27, 2016
djsfantasi likes this.
3. ### be80be Senior Member

Jul 5, 2008
432
57
Resistance changes as it get's warmer. That makes math a lot harder

4. ### OBW0549 Well-Known Member

Mar 2, 2015
1,385
929
Thermistors are non-linear devices. The resistance change per °C temperature change is NOT constant across temperature: it's higher at cold than it is at hot.

That's why we don't use thermistors very much for temperature measurement; although they're cheap, they can be very tricky to use.

5. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,496
511
Because the universe and everything in it is not perfect.

Sinus23 likes this.
6. ### be80be Senior Member

Jul 5, 2008
432
57
You can use a lookup table to make it easy to use one.

Feb 19, 2010
3,496
511
8. ### JohnInTX Moderator

Jun 26, 2012
2,391
1,051
A couple of additions to the good points presented here.
Besides the resistor being necessary to form a voltage divider, it frequently is necessary to prevent thermal runaway of the thermistor. Consider the case where the thermistor is a major part of the (or the only) resistance in the circuit. It heats up a bit due to the current flowing through its resistance. The resistance drops a bit because the thermister is warmer. A lower total resistance means more current which means that the thermistor gets warmer.. and so on. Back in the day, I had one melt right off its leads... yeah, I'm kind of stupid sometimes..
The real-world not-stupid effect of this self-heating is that when you pass any current through the thermistor, it will heat and throw the readings off a tiny bit. The usual fix for this is to only apply voltage to the thermistor network when you are actually doing the ADC conversion. The conversion time is fast compared to how often you need to do it so its mostly OFF and self-heating effects are minimized.

As the others have indicated, the thermistor output is very non-linear. If you are using a microcontroller, I'd use a lookup table (there's one in your datasheet) with as many points as practicable and use linear interpolation to fill in the gaps. In my personal experience with both thermistors and RTDs, the table/interpolation approach is usually better doing the kind of math required for linearization in real-time. In the stuff I've done, we do the math with C on a PC and output the table for the uC. In your application, a fixed resistor and the thermistor form the voltage divider. The ADC will read the voltage and come up with a number. That number will follow the general curve described by the datasheet table. Some arithmetic will be necessary to convert the raw ADC number to a usable temperature.

There's no reason that it can't work. Just be glad you have a uC to do the math. There was a time when all of this was done with op-amps with non-linear elements in feedback loops *shudder* - or punting and silk-screening a non-linear setpoint scale on the panel and calling it done.

Good luck.

Last edited: Jun 27, 2016
9. ### tracecom AAC Fanatic!

Apr 16, 2010
3,878
1,396
I don't know a lot about Arduinos, but I suspect there is already a "script" (probably several) on the web that will take care of the ADC and the math, and output the temperature to a display. By virtue of your questions in post 1 of this thread, I don't think you will be satisfied for very long with Arduinos because they do very little to help a hobbyist understand electronics.

panic mode likes this.
10. ### panic mode Senior Member

Oct 10, 2011
1,328
305
Guest3123 likes this.
11. ### dannyf Well-Known Member

Sep 13, 2015
2,196
417
Yeah. But how do you measure its resistance conveniently?

12. ### panic mode Senior Member

Oct 10, 2011
1,328
305
...and without heating it

13. ### dannyf Well-Known Member

Sep 13, 2015
2,196
417
it is a 50K resistor.

How much voltage do you have to apply to it to get a meaningful temperature rise out of it?

14. ### Guest3123 Thread Starter Member

Oct 28, 2014
330
18
I found this video.. Could you help? It has nothing to do with Arduino.

Looking online is kinda cheating, and I honestly wouldn't know what I was looking at, because I honestly don't understand.

So I want to learn it from scratch.

My main goal is to understand Electronics. My goal "right now" has nothing to do with Arduino. I'm requesting help with electronics please.
I know a little bit about electronics, and try everyday to learn a little more about the subject.

I think I understand a little bit about it.

Thermistor is 50,000Ω (Rt)
(Vdd) is 5vdc.

First Equation. Solve Vt.

Alright, so the first equation is

Vt = R / (R + Rt) * Vdd

Here it goes.

50,000R + 50,000Rt = 100,000 * 5Vdd = 500,000
500,000 / 50,000 = 10, Vt = 10

********************************************************

* Solve Rt *
Rt = R * ((Vdd - Vt) / Vt)

5vdd - 10Vt = 5
5 / 5Vt = 1
50,000 * 1 = 50,000, Rt = 50,000

Good so far?

I messed up, sorry, I fixed it.

Last edited: Jun 27, 2016
15. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,496
511
What is 50,000R?
What is 50,000Rt?
What is the value of R?

I have never encountered a unit of measurement that is represented by R.

16. ### Sensacell Well-Known Member

Jun 19, 2012
1,183
276
Let's look at the overall problem-

1) You need to convert a resistance to a voltage.
The ADC cannot measure resistance directly.

2) You need to remove the offset voltage.
The ADC has a limited range, you want the voltage changes due to temperature to make use of the ADC's input range as much as possible.
You don't want the basic resistance of the device creating an offset voltage that is bigger than the changes due to temperature.

3) You need to scale the voltage.
Ok, so we removed the offset, now we need to amplify the voltage to cover the ADC input range 0-5 or 0-3.3V etc.

4) Now you have a voltage change that is proportional to the temperature, but now you need to linearize and calibrate it.

As you can see, you have picked a deceptively complicated "simple" project. This is why those digital temperature sensing chips are so popular, they eliminate all the analog headaches of dealing with a thermistor, thermocouple or RTD.

17. ### Guest3123 Thread Starter Member

Oct 28, 2014
330
18

Alright, so what electronic component should I use, instead of a thermistor?

Feb 19, 2010
3,496
511
See post #7.

19. ### tracecom AAC Fanatic!

Apr 16, 2010
3,878
1,396
Have a look at DS18B20 and LM34. LM34 is very easy to understand and to use.

Guest3123 likes this.
20. ### Guest3123 Thread Starter Member

Oct 28, 2014
330
18
I'm trying.

Solve Vt

Solve Rt

Select R to maximize measurement sensitivity & range.

Write as Rt relative to R.