NTC thermistor Temp sensor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

Derrihj wrote:
Sun Aug 30, 2020 10:30 am
your Beta version is right on the money just like " an angry female lion with cubs to feed"
:lol:
Yes that version should be accurate.
There is even an offset function for if there is a slight difference.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

I've been making some notes from the two videos, took me allot of time to get notes out of there. why? ,Indians are good but i personally, have trouble getting info from their videos due to their accent. Here is a question, how can we set 1.1v internal reference voltage in flowcode such that the Maximum voltage a pic micro-controller can read is 1.1v to be used in this calculation instead of 5v?

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: NTC thermistor Temp sensor

Post by Steve001 »

Hi Derrihj

Yes you can you will also have to consult your data sheet for your device.

see this post - it is for V7 though and the screen shots appear to have been lost

viewtopic.php?f=63&t=19014

- there is information here in the wiki (V8)

https://www.matrixtsl.com/wiki/index.ph ... heral_CAL)

Vref Option

This property is of type Fixed list of ints and can be referenced with the variable name VREFOP.

selects the reference voltage option

Vref+ (x10mV)

This property is of type Signed integer and can be referenced with the variable name VREFVOL.

sets the value of the reference voltage (used for conversion calculations)

Steve
Success always occurs in private and failure in full view.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Hi Medelec35 hope you are having a good day. Is it ok with you if i want to read about your Beta version formula in a detailed writing? That is if you have some free time to write it coz i try to make notes in my books sothat after some years i don't ask the same questions again or even my kids can find those notes and things become easier for them to understand. Thanks allot for the work you do and effort you put in.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

Hi Derrihj,
I will see what I can put together for you.
Did you sort out the internal reference side?
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

I just used what i thought can work haven't you looked at my flowchat yet? In the adc settings i used (110 x 10mV) to give me a 1.1v reference instead of (500 x 10mV) then i used the (GetVoltage macro). If you have a better way of doing it, well am ready to learn. And another question, how many samples does the GetVoltage macro take before converting the ADC value to voltage? Just want to know the accuracy.

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by chad »

Hi Martin, Just a quick update. I calibrated your algorithm with my most accurate thermometer here and it tracks exactly.
I just found out that the chip I chose is yet another one that is only half- supported but your little code chunk works great!

Thanks!

Chad

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

chad wrote:
Thu Sep 03, 2020 3:28 pm
I calibrated your algorithm with my most accurate thermometer here and it tracks exactly.
Hi Chad that's great!
Thank you, information like that is always useful to know.
chad wrote:
Thu Sep 03, 2020 3:28 pm
I just found out that the chip I chose is yet another one that is only half- supported
Best to bear in mind any company I contact, now take longer to get issues sorted due to the corna virus.
I would have thought matrix tsl is no exception.
Even though a small business I'm sure that would help you in anyway they can.
Just needs a little time to get sorted.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Added a PWM dc fan control with a percentage representation of it's speed according to temperature variations, starting at 30°C as the lower temp setting value @ 18% of fan max speed.
Attachments
IMG_20200906_025559_519_1599506855163.jpg
IMG_20200906_025559_519_1599506855163.jpg (17.68 KiB) Viewed 8083 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

Derrihj wrote:
Wed Sep 02, 2020 10:35 am
Hi Medelec35 hope you are having a good day. Is it ok with you if i want to read about your Beta version formula in detailed writing?
Hi Derrihj,
Sorry for the delay, been really busy with other projects and personal things.
I will post in two parts as it might look a bit confusing otherwise.
The first part is calculation of the thermistor value as that appears on the display:

First calculation box determines thermistor = R2 value:

Code: Select all

.ThermistorCalc = SeriesPullUpResistance * 1.0 / (1023.0 / .ReadThermistorADC * 1.0 - 1.0)
Note used *1.0 so the Float is not converted to a int which is called Type casting
Standard theory, Vout of a potential divider =

Code: Select all

R2/(R1 + R2)*VDD
Suppose we have VDD of 5V, 22K pull-up resistor and 10K thermistor.
We have

Code: Select all

Vout = 10K/(22K + 10K)*5 = 1.56V
As using a microcontroller

Code: Select all

ADC = Vin * 1023 / Vref
.
The Vin from above is really the Vout.
So you have

Code: Select all

ADC = R2/(R1 + R2)*VDD * 1023/Vref
Since Vref is the supply voltage:

Code: Select all

ADC =  10K/(22K + 10K)*5*1023/5
The two lots of 5 Cancel out:

Code: Select all

ADC =  10K/(22K + 10K)*1023 = 319.6875
This means the ADC vale is independent of supply voltage, which is a good thing.
As we know how the ADC is calculated, we need transpose for R2 = thermistor value:

Code: Select all

ADC =  R2/(R1 + R2)*1023
Therefore

Code: Select all

 R2 = R1 * ADC/(1023 – ADC)
It can be simplified to

Code: Select all

R2 = R1/(1023/ADC -1)

Code: Select all

R2 = 22K/(1023/319.6875 – 1)
R2 = 10K
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Thanks allot Medelec35, now i know why the 1.0 comes in play just for explicit casting from int to float right? another thing did i do the 1.1v internal reference the way it should be done in Flowcode?
Last edited by Derrihj on Mon Sep 14, 2020 11:04 pm, edited 1 time in total.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

But that can come in after we look at part2 that is Temp with the offset in the calculation box

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Thanks allot with that moved, we can look at part2.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Hi Mr Martin hope you are fine, just asking kindly, do you have some time for part2?

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by chad »

Rather than all of this back and forth maybe Martin and Ben need to collaborate and update the Thermistor component
?
Chad

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

chad wrote:
Fri Sep 25, 2020 3:45 am
Rather than all of this back and forth maybe Martin and Ben need to collaborate and update the Thermistor component
the thermistor component works differently to the calculations I have given.
The thermistor component requires different resistances for different temperatures.
The flowchart i posted only requires the thermistance vale at 25C and beta value.
When I can find time and can remember source, I will post details.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Learning different ways of doing something does not hurt but rather equips you with allot of info some of which can be used to solve other problems @ hand in another application. I love it when a solution is looked at in different ways in that way, you even get to choose which is better,simple and more accurate, which on the other hand i think the Thermistor component works as it should, Martin's method is just another way of doing things to choose from which is good for learning.

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Hi Medelec35, hope all is well,I've just realised that we didn't look at part two of the Thermistor cal.In my note book, i left a gap for it's notes i just pray you get some little time and have a look at it in your free time that will be great for me.Thanks for all the work and help you give out to others God Bless you.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: NTC thermistor Temp sensor

Post by medelec35 »

Hi Derrihj,
Sorry for the delay,
I have sent you a PM.
Martin

Derrihj
Posts: 348
Joined: Mon Jul 09, 2018 12:43 pm
Has thanked: 67 times
Been thanked: 33 times
Contact:

Re: NTC thermistor Temp sensor

Post by Derrihj »

Thanks the PM was helpful.

Post Reply