LM35 is a precision IC temperature sensor which gives an output proportional to the temperature in °C. The operating temperature range is from -55°C to 150°C. Compared to thermistor, LM35 can measure temperature more accurately hence better for Arduino projects. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy & useful in may applications like power supplies, battery management, temperature control appliances etc. LM35 sensor can easily interface with Arduino.
- No Calibration Required: Calibrated Directly in Celsius (Centigrade)
- Linear scale: Linear + 10-mV/°C Scale Factor (Non-linearity Only ±¼°C Typical)
- Good accuracy: 0.5°C Ensured Accuracy (at 25°C)
- Operating range: Rated for Full −55°C to 150°C Range
- Cheaper: Low-Cost Due to Wafer-Level Trimming
- Operating voltage: Operates From 4 V to 30 V
- Current consumption: Less Than 60-μA Current Drain
- Low Self-Heating: 0.08°C in Still Air (0.1°C Max.)
- Low-Impedance Output: 0.1 Ω for 1-mA Load
(For more detail, click here for datasheet)
Connection with Arduino
LM35 has 3 pins, +Vs (1) & GND (3) for power supply and OUT (2) which gives analog output. It consumes approximately +5VDC. The output pin provides an analog voltage output that is linearly proportional to the Celsius (centigrade) temperature. Pin 2 gives an output of 1 millivolt per 0.1°C (10 mV per degree), So to get the degree value in Celsius voltage output to be divide it by 10.
int tempPin = 0;
temp = analogRead(tempPin);
temp = temp * 0.48828125;
Serial.print("TEMPERATURE = ");
How this code works: Arduino will read temperature from LM35 on analog pin in line temp = analogRead(tempPin);. The reading received on analog pin is actually millivolts scaled from 0-5000mV for 0-5VDC which need to be converted in Celsius in line temp = temp * 0.48828125;. In this, 0.48828125=(+Vcc*1000/1024)/10 Where +Vcc is the supply voltage +5V, 1024 is 2^10, value where the analog value can be represented by Arduino the actual voltage obtained by Voltage_Get/1024. 1000 is used to change the unit from V to mV & 10 is a constant as each 10 mV is directly proportional to 1 Celsius in LM35. So (5.0 * 1000 / 1024) / 10 = 0.48828125. Rest of the lines are to print temperature reading on serial monitor. Upload the code in Arduino, open serial monitor & get temperature reading from LM35 at every one second.
In further expansion to this you can add LCD to display values & relay & make temperature control equipment. I hope this tutorial will be helpful for temperature measurement in your Arduino projects. In future I will upload more tutorials with LCD and such sensor interfaces with Arduino. Give your feedback about this tutorial in Contact, Your feedback will be appreciated.