LM35D Temperature Sensor

This lesson will introduce you to the LM35D sensor

Component Required:

  • 1 x Arduino Uno R3

  • 4 x M-M wires (Male to Male jumper wires)

  • 1 x 830 tie-points breadboard

Component Overview

LM35 is a very common and easy-to-use temperature sensor element. In the application of components, only one LM35 element is needed, and only one analog interface can be used. The difficulty lies in the algorithm to convert the analog value read into the actual temperature.

The LM35 is applied easily in the same way as other integrated-circuit temperature sensors. Glue or cement the device to a surface and the temperature should be within about 0.01 ° C of the surface temperature.This presumes that the ambient air temperature is almost the same as the surface temperature. If the air temperature were much higher or lower than the surface temperature, the actual temperature of the LM35 die would be at an intermediate temperature between the surface temperature and the air temperature, which is especially true for the TO-92 plastic package where the copper leads are the principal thermal path to carry heat temperature as the surface of interest. The easiest way to do this is to cover up these wires with a bead of epoxy which will insure that the leads and wires are all at the same temperature as the surface, and that the temperature of the LM35 die is not affected by the air temperature.

The TO-46 metal package can also be soldered to a metal surface or pipe without damage. Of course, in that case the V− terminal of the circuit will be grounded to that metal. Alternatively, mount the LM35 inside a sealed end metal tube, and then dip into a bath or screw into a threaded hole in a tank.

Connection Diagram:

Wiring schematic:

Physical wiring diagram:

Code:

int potPin = A0; //Pin A0
void setup()
{
  Serial.begin(9600);//Set baud rate
}
void loop()
{
  int val;//
  int dat;//
  val = analogRead(0);
  // Read the analog value of the sensor and assign a value to Val
  dat = (125 * val) >> 8; //Temperature calculation formula
  Serial.print("Tep:");//The as-is output shows the Tep string for temperature
  Serial.print(dat);//The output shows the value of the DAT
  Serial.println("C");//The output displays the C string
  delay(500);//delay 500ms
}

You can open the serial monitor by going to Tools > Serial Monitor or by pressing the magnifying glass button in ARDUINO software window.

Last updated