Temperature Sensing using a thermistor and arduino uno

In this project we are using a thermistor(NTC) to measure the immediate temperature of our surroundings.

A thermistor gives only a defined value of temperature and is suitable for small and basic projects. In case we intend to build a more accurate project we must use a i2C sensor that comes with arduino. Those sensors are also able to detect the weather with temperature and humidity sensing.

To know more about the working and construction of a thermistor try this link:-



  1. Arduino Uno
  2. breadboard
  3. jumper wires
  4. thermistor(10k ohm, green)
  5. resistor – 10k ohm


#include <math.h> //loads the more advanced math functions

void setup() { //This function gets called when the Arduino starts
Serial.begin(115200); //This code sets up the Serial port at 115200 baud rate

double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000/RawADC) – 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp – 273.15; // Convert Kelvin to Celsius
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit – comment out this line if you need Celsius
return Temp;

void loop() { //This function loops while the arduino is powered
int val; //Create an integer variable
double temp; //Variable to hold a temperature value
val=analogRead(0); //Read the analog port 0 and store the value in val
temp=Thermister(val); //Runs the fancy math on the raw analog value
Serial.println(temp); //Print the value to the serial port
delay(1000); //Wait one second before we do it again

Explanation of the code:-
Do notice here I have included a header file math.h, this header file includes all the fancy math functions that are required to perform the Steinhart-hart equation. Rest explanation i have provided with each line of the code. A basic understanding of C language is required to understand the code.



You are all set to make your own temperature sensor!



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s