On this tutorial, we are going to discover ways to join LM35 with Arduino and implement a easy Arduino LM35 Temperature Sensor. To reveal the output, I’ll join the LM35 Temperature Sensor to Arduino UNO and show the temperature readings on a 16×2 LCD Show Module.
A Temporary Observe on LM35 Temperature Sensor
The LM35 is a traditional Temperature Sensor IC. It’s a Precision Centigrade Temperature Sensor. It is usually an analog sensor with its output voltage linearly proportional to the temperature in Celsius.
There are different gadgets within the LM collection of temperature sensors like LM34 (calibrated for Diploma Fahrenheit) and LM335 (calibrated for Kelvin) however LM35 appears to be fashionable alternative for DIY Initiatives.
A few of the essential options of LM35 Temperature Sensor are:
- Vary of Temperatures it will probably measure: -550C to +1500C (full vary)
- Accuracy: 0.50C at 250C (±1/40C at room temperature)
- Provide Voltage: 4 V to 30 V
- Switch Operate: Linear with +10mV/0C scale issue
- Calibration: No want as sensor is calibrated for Diploma Centigrade (Celsius)
There are 5 totally different gadgets within the LM35 Collection with totally different temperature ranges and packages. The next desk might be useful in evaluating totally different LM35 sensors.
|Machine in LM35 Collection||Temperature Vary||Bundle(s)|
|LM35||–550C to +1500C||TO–CAN|
|LM35A||–550C to +1500C||TO–CAN|
|LM35C||–400C to +1100C||TO–92 (Plastic)|
|LM35CA||–400C to +1100C||TO–92 (Plastic)|
|LM35D||00C to +1000C||TO–92, TO–220 (Plastic), SOIC (8-pin)|
I’ve LM35D kind LM35 Sensor. So, I can construct a temperature sensor with a variety of 00C to +1000C. If you wish to measure the total vary i.e., –550C to +1500C, then it’s a must to take a look at LM35 or LM35 in steel TO-CAN packaging.
One of many frequent packaging of LM35 is the Plastic TO–92 bundle. The next picture reveals the pinout of the LM35 Sensor in TO–92 bundle. For pinouts of different packages, discuss with the info sheet.
|+VS||Constructive of Energy Provide|
|GND||Floor (Adverse of Energy Provide)|
Measure Temperature with out Arduino
Because the LM35 is an analog temperature sensor, we will measure the temperature simply by measuring the output voltage. To do that, you’ve gotten to check out the datasheet of LM35 for the Switch Operate.
As per the datasheet, the output voltage is linearly proportional to the temperature with a scale issue of +10mV/0C. The switch perform is given by:
Right here, VOUT is the output voltage of LM35 and T is the temperature in 0C. So, if we measure the output voltage of LM35 Temperature Sensor, then we will measure the temperature with a easy calculation.
First, join the facility provide to the sensor i.e., +5V to +VS pin and GND to GND pin respectively. Now, take a digital multimeter and set it to measure DC Voltage. When you have a handbook vary meter, then set the DMM to 2000mV vary.
Join the Crimson probe to the VOUT pin of LM35 and COM probe to the GND. As you possibly can see from the above picture, the DMM shows the output voltage of LM35 in mV (milli volts). Right here, the output voltage was 276mV.
To get the temperature, divide this worth with 10mV and the result’s 27.60C.
Arduino LM35 Temperature Sensor
Although you possibly can simply measure the temperature utilizing simply the LM35 Sensor and a multimeter, a microcontroller like Arduino might be very helpful in displaying the outcome on an LCD or OLED.
You possibly can even construct an internet server utilizing ESP8266 or ESP32 to show the temperature readings from the LM35 Temperature Sensor on an internet web page.
For this undertaking, I’ll stick to Arduino and construct a easy Arduino LM35 Temperature Sensor and show the outcome on a 16×2 LCD Show. To maintain issues easy, I’ll use the PCF8574 I2C Module to transform a daily LCD into an I2C LCD so that you just require simply two wires from Arduino to 16×2 LCD.
I already made a devoted tutorial on Interfacing I2C LCD with Arduino. Learn that tutorial earlier than continuing.
- Arduino UNO
- LM35 Temperature Sensor
- 16×2 LCD
- PCF8574 I2C Module for LCD
- Connecting Wires
- Breadboard Energy Provide
The next picture reveals the circuit diagram of the Arduino LM35 Temperature Sensor. The output pin of LM35 is related to Analog Enter 0 i.e., A0. For I2C LCD, the SDA and SCL pins are related to A4 and A5 pins of Arduino UNO respectively.
Earlier than writing the precise code for the undertaking, we now have to find out the I2C Slave Handle of PCF8574 Module. To do that, make the connections as per the circuit diagram, plug-in the Arduino to the pc and add the next check code.
Open the Serial Monitor and if the system is related correctly and is working, then you’re going to get the Slave Handle printed on the Serial Monitor. In my case, it’s 0x3F. Use this slave handle within the precise code.
The next is the code for measuring Temperature from LM35 Temperature Sensor utilizing Arduino and displaying the outcome on an I2C LCD.
Calculating Temperature from ADC
Since LM35 is an Analog Sensor, its output is an Analog Voltage, which is linearly proportional to the Temperature with a scale issue of 10mV/0C. So, we now have to measure the analog voltage utilizing Arduino and divide the outcome with 10mV to get temperature in 0C.
One technique to get correct outcome from this undertaking is to make use of the precise AREF worth as seen by the ATmega328P Microcontroller fairly than blindly coming into the theoretical 5V (5000mV) whereas calculating analog voltage from output of ADC.
If ADC_VAL is the output of ADC, which is a quantity between 0 and 1023, AREF is the precise reference voltage to the ADC block and ADC_RES is the decision of ADC, then we will calculate the enter analog voltage ADC_IN as:
Because the ADC in Arduino UNO or fairly the ATmega328P Microcontroller has a 10-bit decision, the worth of ADC_RES is 210 = 1024.
The result’s enter analog voltage in mV (assuming you used mV for AREF). Now, divide this analog voltage with 10mV to get temperature in 0C.
A easy undertaking known as Arduino LM35 Temperature Sensor is constructed right here. You realized in regards to the traditional LM35 Temperature Sensor, the way to measure temperature from LM35 with none Microcontroller and in addition the way to interface LM35 Temperature Sensor with Arduino and show the Temperature on an I2C LCD.