top of page

Interfacing The Lm35 And TMP 36 to the Arduino Uno to measure Room Temperature

In this tutorial, I'm going to show you how to Interface the Lm35 and TMP36 temperature sensor to the Arduino uno.


ITEMS REQUIRED

1 x LM35

1 x TMP36

1 x Arduino board (I am using An Arduino Uno).

1 x USB cable

1 x Computer with Arduino software installed

1 x Breadboard



Circuit Theory:

The LM35 series are precision integrated-circuit temperature devices with an output voltage linearlyproportional to the Centigrade temperature. The LM35 device has an advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large constant voltage from the output to obtain convenient Centigrade scaling. The LM35 device does not require any external calibration or trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a full −55°C to 150°C temperature range. Lower cost is assured by trimming and calibration at the wafer level. The low-output impedance, linear output, and precise inherent calibration of the LM35 device makes interfacing to readout or control circuitry especially easy. The device is used with single power supplies, or with plus and minus supplies. As the LM35 device draws only 60 μA from the supply, it has very low self-heating of less than 0.1°C in still air. The LM35 device is rated to operate over a −55°C to 150°C temperature range, while the LM35C device is rated for a −40°C to 110°C range (−10° with improved accuracy). The LM35-series devices are available packaged in hermetic TO transistor packages, while the LM35C, LM35CA, and LM35D devices are available in the plastic TO-92 transistor package. The LM35D device is available in an 8-lead surface-mount small-outline package and a plastic TO-220 package.

Features

• Calibrated Directly in Celsius (Centigrade)

• Linear + 10-mV/°C Scale Factor

• 0.5°C Ensured Accuracy (at 25°C)

• Rated for Full −55°C to 150°C Range

• Suitable for Remote Applications

• Low-Cost Due to Wafer-Level Trimming

• Operates From 4 V to 30 V

• Less Than 60-μA Current Drain

• Low Self-Heating, 0.08°C in Still Air

• Non-Linearity Only ±¼°C Typical

• Low-Impedance Output, 0.1 Ω for 1-mA Load


In Our experiment we have compared the output of LM35 to the TMP35 which is also a temperature sensor with slight difference in specifications, it has similar pin configuration to the LM 35 but can operate at a lower voltage which is an advantage. You can view the datasheet here.


Step 1

Connect the circuit as per Circuit diagram



Lm35 interfaced to Arduino
Circuit Diagram

Step 2:

Open a new window in the arduino terminal and type the following code.


 

Code For LM35


const int sensor=A0; // Assigning analog pin A0 to variable 'sensor'

float tempc; //variable to store temperature in degree Celsius

float tempf; //variable to store temperature in Fahreinheit

float vout; //temporary variable to hold sensor reading

void setup()

{

pinMode(sensor,INPUT); // Configuring pin A1 as input

Serial.begin(9600);

}

void loop()

{

vout=analogRead(sensor);

vout=(vout/1024)*5; // since change in temp is 10mV/ 1°C

tempc=vout*100; // Storing value in Degree Celsius

Serial.print("in DegreeC=");

Serial.print(tempc);

Serial.print("\n");

delay(1000); //Delay of 1 second for ease of viewing

}

 

Code For TMP36

const int sensor=A0; // Assigning analog pin A1 to variable 'sensor'

float tempc; //variable to store temperature in degree Celsius

float tempf; //variable to store temperature in Fahreinheit

float vout; //temporary variable to hold sensor reading

void setup()

{

pinMode(sensor,INPUT); // Configuring pin A1 as input

Serial.begin(9600);

}

void loop()

{

vout=analogRead(sensor);

vout=(vout/1024)*5;

vout =vout-0.5; //Since Tmp35 has a 0.5 offset value to account for negative temperature,Subtract 0.5 voltage

tempc=vout*100; // Storing value in Degree Celsius

Serial.print("in DegreeC=");

Serial.print(tempc);

Serial.print("\n");

delay(1000); //Delay of 1 second for ease of viewing

}


 

LM35 Output
LM35 Output


TMP 36 Output
TMP 36 Output


Connect the Arduino to the pc and upload the code to the Arduino board. Open the serial monitor to see the output. The Temperature sensor can be used in multiple applications such as Power Supplies, Battery Management, HVAC, Appliances. If you are looking for a low power application you can make use of Tmp36 sensor as it works at a lower voltage then the LM35 sensor.



47 views

Comments


bottom of page