Pages: 1 [2] 3   Go Down
Author Topic: NTC Thermistor Integration  (Read 3195 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So the multimeter gives the same voltage as the Arduino, at least that is consistent.

But seen the values of the resistors there should be a ration of 1:6 somehing like 0.7V - 4.3V

2 new measurements:

1) Can you measure the current low through the two resistors ? 
expected value 5V / 2500 ohm = 2 mA

2) Can you please measure the resistors again. I know it sounds stupid but still ..

you can always send a picture ..

Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, it turns out that Rtop was indeed wrong.  3500 instead of 350.  I apologize for that.  Also turns out that Rbottom was off reported resistance by the 1% it said it could have, so I replaced it.  Now, here is the following to report:

Code:
#include <math.h>

void setup() {
  Serial.begin(9600);
}

int delaySeconds = 5;
int masterDelay = 1000 * delaySeconds;
float Rtop = 3500;
float Vin = 5;                            // input voltage
 
void loop() {
  float sensorValue = analogRead(A0);                    // read sensor
  float Vout = (sensorValue/1024) * Vin;
  float Rbottom = -Rtop + Rtop * (Vin/Vout);
  // float myTemp = (-32.228 * log(Rtop) + 323.17);          // thermistor trendline
  float VRatio = Vout/Vin;
  float RRatio = Rtop/(Rtop + Rbottom);
 
  Serial.print("SensorValue: ");
  Serial.print(sensorValue);
 
  Serial.print("/Vout: ");
  Serial.print(Vout);

  Serial.print("/Rbottom: ");
  Serial.print(Rbottom);
 
  Serial.print("/VoltRatio: ");
  Serial.print(VRatio);
 
  Serial.print("/RRatio: ");
  Serial.print(RRatio); 
   
 
  Serial.println("");
  delay(masterDelay);
}

Result:  SensorValue: 403.00/Vout: 1.97/Rbottom: 5393.30/VoltRatio: 0.39/RRatio: 0.39

So the ratios are good.  The measured Voltage is good.  The Rbottom is wrong though.  It's measured at 2150, reported through the math at 5393.30, which is 2.5x what it should be.

Didn't take any pictures as it is taking shape now. 
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just as an aside, I replaced Rbottom with a 51 Ohm resistor, and I get this:  SensorValue: 11.00/Vout: 0.05/Rbottom: 322318.18/VoltRatio: 0.01/ResRatio: 0.01

Vout is right.  ResRatios don't mean anything because it relies on Rbottom. 

I think we need to focus on Rbottom calculations. 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Think there is a flaw in the code as the ratio between 3500 and 5393 is almost exactly the ratio between 2150 and 3500

the current flowing through the system is +> A = (Vin-Vout) / R.top
this current also flows through Rbottom resulting in Vout => A * Rbottom = Vout
or Rbottom = Vout / A;

combining these  ==> Rbottom = Vout / ( (Vin-Vout) / Rtop)  = Vout * Rtop / (Vin-Vout);

==>   float Rbottom = Vout * Rtop / (Vin - Vout);

testing with the values:   1.97 * 3500 / ( 5 - 1.97) = 2275  just 1% above the 2150  
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, I worked it out and that formula is right.  I just tried:

Rtop = 3280, Rbottom (test) = 2150
Vin = 5V, SensorValue = 357

Rbottom = (1.72 * 3280)/(5 - 1.74) = 1750 Ohms, which is wrong.

OK, I'm not sure I'm covering all aspects.  I'm using 2 multimeters here, neither of which can read Amperage. 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I don't understand it ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will mess around with it, the reporting, and see what I can find.  Anybody else, please chime in here. 
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your 'bottom ' resistor is 215 ohms mot 2150 ohms... 350 + 215 = 565 ohms 5 / 565 = .0884 A X 215 ohms = 1.90 V 3% low... well within spec I should think.

Doc
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow another resistor mis-read.  OK I'll go have a look and report back.  Thanks for noticing that and letting me know. 
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK it's completed.  Rtop during this was 3300.  I just have to recalibrate the thermistor and get a better trend line. 

Thanks for the discussion.  Got through it.   smiley-lol
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Up to the next project!
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is a BBQ thermoprobe, so now I want to send data to my database and create a refreshing page that graphs the progress. And eat more food.  

BTW where in Holland are you? 
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Brabant, near Helmond
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2808
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anderson published a table and the math to calculate any temp within the thermistor's range (10K NTC)... to at least 1% accuracy. P H Anderson... I can't remember where I found the table but it is on Anderson's website...
Somewhere,

Doc
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 98
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Doc.  Thanks for the post.  I found two links with trend lines posted. 

I guess through trial and error that I can see if the formula fits?  I have no knowledge what these probes are.  Hence the calibration. 

Cheers
Logged

Pages: 1 [2] 3   Go Up
Jump to: