Lm35 temperature sensor is used as input to measure External temperature in analog values. This is the quick tutorial about lm35 arduino. The arduino tutorials and how and why to use lm35 sensor. We will discuss how to interface lm35 temperature sensor with arduino. lm35 temperature sensor code for arduino.This is the quick tutorial series about arduino tutorials and arduino programming tutorial.
How to Interface LM35 Temperature Sensor with arduino
Welcome, Everyone
Here is the first Tutorial in the series of Learn by Doing.Learn Arduino by Doing projects.There is a long list of 100+ amazing Arduino projects.So we are going to start with some basic concepts.There are almost 10 first tutorials on Sensors then we will move towards doing amazing and cool projects.
In all these tutorials we will understand each and every component, circuit diagrams and complete Arduino codes.Stay connected on YouTube and follow for step by step Guide and source codes.
So let’s start with the basic LM35 temperature sensor.
Contents:
Lm35 temperature sensor:
Lm35 is a Temperature Sensor that works with the variations in temperature.The internal structure of Lm35 consists of transistors, amplifier, and few resistors.The integrated circuit and the resistors are calibrated in the factory to produce the accurate temperature.
The Lm35 has 3 pins:
- Input
- Output
- Ground
( THE SUPPLY_VOLTAGE x 1000 / 1024) / 10 where THE SUPPLY_VOLTAGE is 5.0Volts )
The final Equation is: [(5.0 * 1000 / 1024) / 10 ] = 0.4882
Components for lm35 arduino:
- Arduino Board with USB Cable
- LM35 Temperature sensor
- Bread board (for practice)
- Arduino jumper wires
Lm35 sesor with arduino circuit diagram:
- Connect first pin with 5v on Arduino
- Second with analog pin of Arduino A0
- Third with GND on Arduino
Code for Arduino:
float temp; //Defining the temp float variable int sensor = 0; // The output pin of LM35 on arduino analog pin 0 it could be A0 void setup() {Serial.begin(9600); //start the serial monitor } void loop(){ temp = analogRead(sensor); //assigning the analog output to temp float mv = ( temp/1024.0)*5000; // Converting equation for voltage to Celsius float celsius = mv/10; Serial.print("The temperature is :"); //Display the results on serial monitor Serial.print(celsius); Serial.println("deg. Celsius"); Serial.println(); delay(1000); //1 second delay to avoid overloop }