Welcome! Log In Create A New Profile

Advanced

Thermistor plus arduino

Posted by sloth3d 
Thermistor plus arduino
August 18, 2012 06:58AM
I am trying to measure the temperature with my arduino and an 100k thermistor (beta 4036) plus 10k resistor. I got a raw value of 95 at room temperature. Nothing i enter into the createTemperatureLookup.py script would lead to something like 95 > 25.

My wiring is like this:
(Ground) ---- (10k-Resister) -------|------- (Thermistor) ---- (+5v)
                                     |
                                Analog Pin 0


from here:
[arduino.cc]

This is the relevant code:
int read_temp()
{
   int rawtemp = analogRead(ThermistorPIN);
   int current_celsius = 0;

   byte i;
   for (i=1; i rawtemp)
      {
         int realtemp  = temptable[i-1][1] + (rawtemp - temptable[i-1][0]) * (temptable[1] - temptable[i-1][1]) / (temptable[0] - temptable[i-1][0]);

         if (realtemp > 255)
            realtemp = 255;

         current_celsius = realtemp;

         break;
      }
   }

   // Overflow: We just clamp to 0 degrees celsius
   if (i == NUMTEMPS)
   current_celsius = 0;

   return current_celsius;
}


And the lookup table is generated with these parameters in [reprap.svn.sourceforge.net]:
r0 = 100000;
    t0 = 25;
    beta = 4036;
    r1 = 0;
    r2 = 10000;
    num_temps = int(36);


Here is a datasheet of the thermistor: [de.farnell.com]

What am I doing wrong? Any hint where to debug?
Re: Thermistor plus arduino
August 18, 2012 07:06AM
The thermistor should go to ground and the resistor to 5V.


[www.hydraraptor.blogspot.com]
Re: Thermistor plus arduino
August 18, 2012 08:11AM
Thx a lot, that did the trick! smiling smiley
Sorry, only registered users may post in this forum.

Click here to login