Page 1 of 3

NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 11:15 am
by Derrihj
Hi Everyone, am trying to make a temp sensor with a 10k NTC thermistor and the Steinhart and Hart Equation, I need it to read the temperature of upto 120 degrees Celsius but am having trouble please check my code, Help show me where i go wrong.And how do we enter a coefficient of say 1.125509474e-3 into the calculation box?

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 12:38 pm
by Benj
Hello,
how do we enter a coeffient of say 1.125509474e-3 into the calculation box?
I beleive that would be...

0.001125509474

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 12:59 pm
by Derrihj
Ok that is what i used Benj but my display shows only 28.68 degrees at full range , there must be something am not doing right with the Steinhart and Hart equation as in Flowcode entry data eg the calculation box. Here is my Temperature (in Degrees C)/Resistance (in Ohms) Table of my 10K NTC Thermistor: (-40c/336,500 Ohms), (-30c/177,000 Ohms), (-20c/97,070 Ohms), (-10c/55,330 Ohms), (0c/32,650 Ohms), (10c/19,900 Ohms), (20c/12,490 Ohms), (25c/10,000 Ohms), (30c/8,057.0 Ohms), (40c/5327.0 Ohms), (50c/3,603.0 Ohms), (60c/2,488.0 Ohms), (70c/1,752.0 Ohms), (80c/1,255.0 Ohms), (90c/915.30 Ohms), (100c/678.30 Ohms), (110c/510.30 Ohms), (120c/398.30 Ohms), (130c/300.93 Ohms), (140c/235.27 Ohms), (150c/185.97 Ohms). But on my hardware, when i replace the NTC thermistor with a well known 10k 1% resistor to work as my NTC @ 25 °C , my displays shows 26.70°C on a real board this is wrong and it only goes up to 31.02°C at full range with the NTC in place.This is dead wrong.

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 6:23 pm
by mnf
Hi Derrihj,

I'm not sure the calculation of the resistance of the thermocouple is correct (for example you will get an error at vOut = 1.0 (div by 0) )- see https://circuitdigest.com/calculators/v ... calculator
and also https://www.ti.com/lit/an/sbaa439/sbaa439.pdf

Martin

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 6:47 pm
by medelec35
Hi Derrihj,
There is a thermistor component built in to Flowcode, just use search and enter therm.
If not suitable then I created a flowchart that uses a themistor based on the beta value and results are very accurate.
It does not even rely on VDD fluctuations or what the supply voltage is!
If you want me to post it then let me know.
It's part of a huge flowchart so will need to modify to your needs.

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 7:03 pm
by Derrihj
Am trying to convert an Arduino project to flowcode here is the link; https://www.ametherm.com/blog/thermisto ... hermistors

Re: NTC thermistor Temp sensor

Posted: Thu Aug 27, 2020 7:07 pm
by Derrihj
Medelec35, nice to see you please post your project i have a look at it am very sure i will learn allot from it

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 3:37 pm
by chad
Hi Martin, I also am tiring to read a thermistor. I got the sensor package and used the thermistor component. It is reading but the values don't work correct. I think there might be something broken in it.

If you have a nice flow of a temp reader it would be super cool if you could strip it out and post it. :)

I wish that flowcode had a curated user component or code chunk menu.

Thanks,
Chad

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 3:51 pm
by Derrihj
I also used the thermistor component but the results were not good am also waiting for Medelec35's flowchat

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 4:03 pm
by chad
Thanks for confirming that. Looking at the adc numbers things look ok but there is something broken with the component.
Martin is super smart so I would like to see what he comes up with too.

Thanks,
Chad

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 4:20 pm
by Derrihj
It will be so nice if Medelec35 can do for both the Beta version and also the Steinhart and Hart equation version in a flowchat example.But all in all what he has to offer i believe will be profitable.

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 7:35 pm
by medelec35
Been a busy couple of days.
Currently modifying & testing the beta version works.
Should be able to post this evening, all going well.

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 7:45 pm
by Derrihj
That is great take all your time and thanks for the Love Medelec35

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 9:26 pm
by medelec35
Hi Derrihj,
You're welcome.
Attached is beta version working for Eblocks2 PIC Multiprogrammer (16F17788).
So will need to change Target device, LCD and ADC to suit your hardware.

Re: NTC thermistor Temp sensor

Posted: Fri Aug 28, 2020 9:48 pm
by Derrihj
Thanks allot Medelec35 , let me get my self ready to have a look.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:07 am
by Derrihj
Ok now this is where it becomes interesting "learning time" i changed the code to work with my hardware running @ 8mhz external crystal with the PIC16F886 but to my supplies when i heat up the thermistor with a soldering gun interested of the temperature going up,it goes down to negatives but the resistance increases so it's the opposite of what it should do when i increase the heat may be am doing something wrong.And when i replace the NTC with a 10k res 1% it gives me -20C

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:12 am
by chad
I think you have a PTC thermistor? How to inverse all of thins I have no idea.

I just got mine up and running.

Chad

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:23 am
by Derrihj
No it's an NTC coz before i hook it up on the board i first heat it up with a soldering gun and it does what NTC does best as temp goes up resistance goes down see pics below.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:33 am
by medelec35
Can you let me know the thermistor value at 25C and have you got the themistor connected to i/p pin and GND?
What value pull-up resistor have you got between i/p and +ve?
LCD is saying it thinks the current value of thermistor is 47K which does not sound correct as if 10K thermistor, it will be really cold.
You will need to look at all the Constant variables and make sure all values are correctly entered.
The issue might be to have connected themistor between ADC i/p and + supply?

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:48 am
by medelec35
chad wrote:
Sat Aug 29, 2020 12:12 am
I just got mine up and running.
Hi chad, you getting expected results?

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 12:56 am
by Derrihj
Thanks Medelec35 issue was themistor between ADC i/p and + supply? Since i had already done the PCB before your flowchat so i changed to pull-up to +ve 5v and thermistor to GND and it obeyed like a humble dog now i have a task and that is to get to understand the code.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 1:08 am
by Derrihj
I know my thermistor Datasheet may not be that correct at the moment as i got this from an old DC to AC inverter coz when i measure it at room temp, I get around 12k but that isn't a big deal as i just wanted a code that works so that when i order a well known thermistor with the correct Datasheet am pretty sure things won't back fire on me.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 1:21 am
by medelec35
Glad you have got your issue sorted out now.
If the beta is not known,
what about using the Flowcode built-in themistor component?
Just search for therm .
You will have to enter resistance values for a few set temperatures.
Some data sheets just give those values.
Don't need to know beta or Steinhart and Hart Equation.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 1:27 am
by Derrihj
Thanks allot for the code Medelec35 God Bless u am planning to build a digital timer with a temperature sensor for my mother for her local cake cooker and mount it on the wall in an adaptable box and run sensor wires down to the cooker oven,what do you think is the best temp sensor i should use Medelec35, RTD or Thermister with that sensor distance from the wall thanks.

Re: NTC thermistor Temp sensor

Posted: Sat Aug 29, 2020 1:28 am
by medelec35
You're welcome.
What is the expected maximum temperature?