4
\$\begingroup\$

I have the following datasheet for a thermisistor: http://make-documents.s3.amazonaws.com/UGulDNLaIajWgPom.pdf

I am trying to use the formula (found here http:// iwantmyreal.name/blog/2012/09/23/measuring-the-temperature-with-an-arduino-and-a-thermistor/): $$ 1/T=1/T_0+1/B*ln(R/R_0) $$ I am not sure I'm using the correct values, my understanding is that the values provided in the datasheet are as follow: $$R_0=20,000 ohm,$$ $$T_0=25 C,$$ $$Beta=4300$$ Can anyone confirm that this is correct?

I'm trying to get a temperature reading out of that sensor using an Arduino UNO microcontroller using the following found at http://playground.arduino.cc//ComponentLib/Thermistor2 at the bottom where it says example #2 using numbers instead of episco k164 definition .... (substituting with the above values)

The results are ~41.96 degrees F, and the room is between 75-80 degrees F so that means the temperatures readings are way off, I don't understand why unless I got the wrong values from the datasheet. Also I have two of these sensors and both give about the same value.

Code currently using:

// Code obtained from http://playground.arduino.cc//ComponentLib/Thermistor2
#include <math.h>
// enumarating 3 major temperature scales
enum {
  T_KELVIN=0,
  T_CELSIUS,
  T_FAHRENHEIT
};

// manufacturer data for episco k164 10k thermistor
// simply delete this if you don't need it
// or use this idea to define your own thermistors
#define EPISCO_K164_10k 4300.0f,298.15f,10000.0f  // B,T0,R0

// Temperature function outputs float , the actual 
// temperature
// Temperature function inputs
// 1.AnalogInputNumber - analog input to read from 
// 2.OuputUnit - output in celsius, kelvin or fahrenheit
// 3.Thermistor B parameter - found in datasheet 
// 4.Manufacturer T0 parameter - found in datasheet (kelvin)
// 5. Manufacturer R0 parameter - found in datasheet (ohms)
// 6. Your balance resistor resistance in ohms  

float Temperature(int AnalogInputNumber,int OutputUnit,float B,float T0,float R0,float     R_Balance)
{
  float R,T;

  R=(1024.0f*R_Balance/float(analogRead(AnalogInputNumber)))-R_Balance;
  T=1.0f/(1.0f/T0+(1.0f/B)*log(R/R0));

  switch(OutputUnit) {
    case T_CELSIUS :
      T-=273.15f;
    break;
    case T_FAHRENHEIT :
      T=9.0f*(T-273.15f)/5.0f+32.0f;
    break;
    default:
    break;
  };

  return T;
}

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

void loop() {

 Serial.println("*************************");
 Serial.println("10k Balance");
 Serial.println(Temperature(0,T_FAHRENHEIT,4300.0f,298.15f,20000.0f,9770.0f));
 //Serial.println(Temperature(1,T_FAHRENHEIT,4300.0f,298.15f,20000.0f,9770.0f));
 Serial.println("*************************");

 delay(500);
}
\$\endgroup\$
  • \$\begingroup\$ Do you have a schematic/code? What value resistor are you using for the balance resistor? \$\endgroup\$ – Oli Glaser Aug 28 '13 at 4:58
  • \$\begingroup\$ Sure. If you look at "Thermistor Test Schematic" Under playground.arduino.cc//ComponentLib/Thermistor2 that's pretty much it, except I'm using a 9.77 Kohm resistor (I measured it with a Voltmeter). Or +5V --> thermistor <-- Node 1 --> 9.77kohm --> ground. Then I have a connection from Node 1 to port A0 of the arduino uno microcontroller. I hope it makes sense, let me know if it doesn't. \$\endgroup\$ – joze Aug 28 '13 at 5:34
  • \$\begingroup\$ That's a start, thanks (it's usually a good idea to include the schematic and any code for your setup, so everyone knows exactly what you are doing) What is the exact code you are using? \$\endgroup\$ – Oli Glaser Aug 28 '13 at 6:14
  • \$\begingroup\$ Thanks for the tip, will do for next time. The code is the following: \$\endgroup\$ – joze Aug 28 '13 at 6:24
  • \$\begingroup\$ See above in the original question for my exact code, site won't let me edit my last comment. \$\endgroup\$ – joze Aug 28 '13 at 6:31
0
\$\begingroup\$

For anyone interested in knowing how I solved this problem, I used the AREF and 3.3V from the Arduino microcontroller connected directly one of sides of the thermistors. I believe the voltage coming out of my laptop was dropping; USB +5V was dropping to ~4.7V thus making my calculations lower.

Here's the website which helped to find my answer (this site includes CODE and DIAGRAM):

http://learn.adafruit.com/thermistor/using-a-thermistor

Thanks everyone for your help.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.