lm35 with arduino
Hello friends, I hope you all are fine and enjoying yourself. Today I am going to share a new project titled Interfacing of temperature sensor LM35 with Arduino UNO in Proteus ISIS. So far, I have only worked on temperature sensor DS18B20 for temperature measurements and I have also uploaded a tutorial on Interfacing of Temperature Sensor 18B20 with Arduino.

Recently I got a chance to work on a project regarding temperature sensing but the condition of this project was that to use only LM35 for temperature detection. Then, I get to know much about LM35, its operating conditions and features. So I thought I should also upload its tutorial as it will also be advantageous for engineering students. Because learning new things is always a charm.

An excellent thing about LM35 is that it's quite cheap as compared to other temperature sensors. And as it's cheap, that's why it's not very reliable, if you personally ask me then I will prefer DS18B20 over LM35 because of its accurate readings. Now, let's move towards its interfacing and its practical applications. First of all, let's have a quick look at the introduction of LM35 and then we will design it in Proteus ISIS.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LM35AmazonBuy Now
2Arduino UnoAmazonBuy Now

Introduction of LM35 Temperature Sensor

  • LM35 is an embedded sensor, used to measure the temperature of its surroundings and is famous because of its low cost.
  • Its output is generated in the form of an Electrical signal and this electrical signal is proportional to the temperature, which it detects.
  • Lm35 is much more sensitive than other temp measuring devices (not accurate).
  • The internal circuitry of this embedded sensor is sealed inside a capsule.
  • LM35 is a 3 pin IC and it is used for temperature detection. The physical appearance of LM35 is shown in the image given below:

lm 35

  • As you can see in the above image that LM35 is a 3 pin IC:
    1. The first pin is Vcc, so it should be connected to 5V.
    2. The center pin is its Data Pin and LM35 gives its output when it measures temperature.
    3. The third pin is GND and should be connected to the ground of the battery/source.

LM35 Arduino Interfacing

  • As my today's tutorial is about interfacing LM35 with Arduino so let's start it.
  • I have connected LM35 with Arduino microcontroller and it is shown in the image given below:

lm35 with arduino

  • As you can see in the above image, I have connected an LM35 sensor with Arduino UNO.
  • The VCC pin of LM35 is connected to +5V of the Arduino board.
  • Since LM35 generates an analog value at its output pin that's why I have connected this pin to the 'A0' pin of the Arduino board.
  • This pin of Arduino board is used to receive analog data from an external source.
  • And the last pin is connected to the GND pin of the Arduino board.

Arduino Code for LM35

  • After connecting the circuit, now upload the below code to your Arduino board.
#define TempPin A0

int TempValue;

void setup()
{
  Serial.begin(9600); // Initializing Serial Port
}
void loop()
{
  TempValue = analogRead(TempPin); // Getting LM35 value and saving it in variable
  float TempCel = ( TempValue/1024.0)*500; // Getting the celsius value from 10 bit analog value
  float TempFarh = (TempCel*9)/5 + 32; // Converting Celsius into Fahrenhiet

  Serial.print("TEMPRATURE in Celsius = "); //Displaying temperature in Celsius
  Serial.print(TempCel);
  Serial.print("*C");
  Serial.print("    |    ");

  Serial.print("TEMPRATURE = "); // Displaying Temperature in Fahrenheit
  Serial.print(TempFarh);
  Serial.print("*F");
  Serial.println();
  
  delay(1000);

}

LM35 Arduino Simulation in Proteus ISIS

  • Now let's do this project in Proteus. Proteus also has an LM35 sensor in its database which we are going to use here.
  • Moreover, we also know about Arduino Library for Proteus V2.0, so using that library we are going to interface LM35 with Arduino in Proteus ISIS.
  • First of all, design the same circuit as shown in the above figure in Proteus software as shown below:
lm35 with arduino,lm35 proteus,lm35 coding,lm35 in proteus, arduino lm35
  • It's the same circuit as we designed before, the only addition is the virtual terminal. We are using it to check the values.
  • It's simply like the Serial Monitor we use in Arduino software.
  • So, now using the above code, create the hex file and upload it in Proteus.
  • Now hit run and if everything goes fine then you will get results as shown in the below figure:
interface lm35 with arduino,lm35 arduino coding,how to connect lm35 and arduino,proteus lm35 example
  • You can see the Virtual Terminal is showing the same value as shown on the sensor which is 33 in Celsius and later I converted it to Fahrenheit.
It's quite simple and I have also commented on the code but still if you find trouble then ask in comments and I will resolve them. Will meet in the next tutorial, till then take care!!! :)