Reading the environment temperature is one of the most important task for the majority of the applications. We are going to use LM35 Temperature sensor with Arduino in this example. Even in embedded systems, temperature sensors are one of the most basic and most important sensors used in wide variety of products. Some of the most important products which requires the temperature sensors are
- Weather station
- Incubator Temperature Control
- Water Heating System
- Baby Warmer for biomedical applications
Above mentioned applications are some of the more than 100 products where we need some kind of temperature sensors to get the temperature measurements.
LM35 is one of the temperature sensor which is very popular and very simple to use. It gives the voltages on its output pin which be proportional to the temperature it sense from it’s environment.
Here are the steps You need to follow for using LM35 temperature sensor with arduino uno.
Total Time: 15 minutes
Grab all the parts required
LM35, Arduino Uno
Connect LM35 to Arduino
Connect the Analog Output pin of LM35 with A0 pin of Arduino UNO.
Open Arduino IDE and start coding
For reading the temperature values first of all you need to Decide how you want to display the output? In our case we are going to display the temperature on Serial Terminal. So we need to initialize the Serial port with desired baudrate. Which, in our case is 9600. After that in loop() function we need to read the analog input
Upload the Sketch to Arduino UNO
Once you are done coding you are good to upload the sketch to your arduino uno board. Connect the USB cable to the board and plug in into your computer. Now select the serial port from tools menu and after that upload the sketch
Open the serial monitor and Verify the output
Once uploaded, all you have to do is to open the serial terminal and check the output.
Simulation
Now Let’s create a simulation file to test and validate our code first. We will create the simulation in Proteus 7.6. The simulation is very similar to the actual circuit which we will build later. But for now, The simulation circuit is here for us to test our code. The LM35 Arduino and 16×2 Character LCD is used as our main components and most of the power connections, including the 16×2 LCD contrast potentiometer is omitted and not included in the simulation because that is not as necessary to test our simulation. So for the sake of simplicity we will neglect this in the simulation.
Here is how our simulation file looks like,
Here are the pins of the Arduino which we are using for external interfacing of the LCD as well as LM35
// Pin Definitions
define LCD_PIN_RS 7
define LCD_PIN_E 6
define LCD_PIN_DB4 2
define LCD_PIN_DB5 3
define LCD_PIN_DB6 4
define LCD_PIN_DB7 5
define LM35_PIN_VOUT A3
Code language: JavaScript (javascript)
Few words about LM35
LM35 is a temperature sensor which provides analog output voltages proportional to the temperature. LM35 can measure the temperature from the range -55C to 150C centigrade. It looks very similar to the 3 pin transistor visually. It has 3 pins two for the power connections and middle pin is used to read the analog voltages to measure the required temperature.
Code
Here is the complete code for the simulation
Bibliography:
[1]“How to wire LM35, LCD 16×2 to Arduino Uno,” Circuito.io, 2021. https://www.circuito.io/app?components=512,11021,333429,341099 (accessed Jan. 14, 2021).