Go Down

Topic: Arduino NTC thermistor test (Read 5 times) previous topic - next topic


Jun 05, 2009, 11:54 pm Last Edit: Jun 06, 2009, 11:19 pm by Jokse Reason: 1
#include <LCD4Bit_mod.h>
#include <stdio.h>
#include <math.h>
LCD4Bit_mod lcd = LCD4Bit_mod(2);
int value=0;
int analoginput=5;
int R1=1000;
int Vin=5;
float tmp=0.0;
float Vout=0.0;
float f=0.0;
char text[16];
char temp[16];

void setup() {
 pinMode(analoginput, INPUT);

void loop()
 Vout=1023-analogRead(5); // Invert the number because of setup
 f=1000*exp(-3500/298.15); // 298.15K = 25C, 3500 seems to be the B value for a standard 1kOhm NTC
 sprintf(text,"%d      ",value);

A little messy but it was just a test...
Using a 1kOhm resistor and NTC in a voltage divider on analogport 5. Seems to be working quite nicely.
The inverting of Vout was done because I was too lazy to flip my voltage divider around.

The equations were taken from wiki and the numbers (B value) were just googled, so no warranty on them being correct.

Mike Mc


Temperature data logger

Mike Mc

Surely that's TDL ?   :o


NTC is Negative Temperature Coefficient -  a device where the resistance decreases with rising temperature.


I wasn't allowed to post links in my first post, but here are the links I used for it and the topic  for this should have said Arduino NTC Thermistor test.



@Mike Mc

I googled NTC and thats the answer it gave me... next time I'll use Bing lol


I'm working on something like this and I'm trying to calculate the B value. With a 1k resistor and an NTC probe that has a different B than your sample here, I'm getting a reading on my analog input of 1014 at 0 degrees C and 649 at 100 (i put the probe in ice and boiling water)  - that's the raw value, not inverted.

How do I take that 1014 and 649 reading and convert that the resistence so I can plug it into  b = Ln(R t1/ Rt2) / (1/T1 - 1/T2) ?

Thanks a lot, i'll post back to this thread if i figure it out


Have a look at: http://thermistor.sf.net

It will teach you about the equations, coefficients, and has some code to calculate the coefficients.  I did this with my 2 salvaged thermistors and it works very well so long as I use the full Steinhart-Hart equation.

You can also have a look at the library I added to the playground:

I have a lot of documentation in the source that will probably answer most questions.

Go Up