Arduino Temperature Measurement

Definition

A temperature is an objective comparative measure of hot or cold. It is measured by a thermometer, Several scales and units exist for measuring temperature, the most common being Celsius (denoted °C; formerly called centigrade), Fahrenheit (denoted °F), and, especially in science, Kelvin (denoted K).

LM35 Temperature Sensor

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature.

Components Used
1. LM35
2. Arduino Uno
3. Connecting Wires
Sensor Output:
Sensor gives linear + 10.0 mV/°C scale factor, as per that we have set the calibration in program
Vref=5V
ADC Count for 1°C = 10m/(5/1024) = 2.048
Temperature=ADC Count/2.048

Arduino Circuit for Temperature measurement

LM35 Temperature Sensor Arduino
LM35 Temperature Circuit

Arduino Code for Temperature measurement

/*
  Temperature Measurement - www.circuits4you.com
  Reads an analog input on pin 0, converts it to Temperature, and prints the 
  result to the serial monitor.
  Graphical representation is available using serial plotter 
  (Tools > Serial Plotter menu)
  Attach the LM35 Temperature Sensor as shown in Circuit.
*/

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0, we have connected LM35 Output
  int sensorValue = analogRead(A0);
  
  // Convert the analog reading (which goes from 0 - 1023) to a Temperature:
  float Temperature = sensorValue / 2.048;
  
  // print out the value you read:
  Serial.print("Temperature:");
  Serial.println(Temperature);
  delay(1000);
}

Results

Open the Serial Monitor from (Tools>>Serial Monitor), you will see the temperature in serial monitor. There is another sensor called DHT11 which can be used for measurement of both temperature and humidity in single package.

LM35 Sensor Output Result
LM35 Sensor Output Result

 

Leave a Reply