Arduino LM35 Temperature Sensor Implementation

Arduino LM35 Temperature Sensor Implementation

1) Description

LM35 is a commonly used and easy-to-use temperature sensor component. It only requires one LM35 component and can be connected to a single analog interface. The difficulty lies in the algorithm to convert the read analog value into the actual temperature.

2) Required Components

Through-hole LM35 *1

Breadboard *1

Breadboard jumper wires *1 pack

3) Wiring Diagram

Arduino LM35 Temperature Sensor Implementation

Arduino LM35 Temperature Sensor Implementation

4) Reference Source Code:

int potPin = 1; //Define analog interface 1 connected to LM35 temperature sensor

void setup()

{

Serial.begin(9600);//Set baud rate

}

void loop()

{

int val;//Define variable

int dat;//Define variable

val=analogRead(0);// Read the analog value from the sensor and assign it to val

dat=(125*val)>>8;//Temperature calculation formula

Serial.print(“temperature is”);//Output displayTep string represents temperature

Serial.println(dat);//Output displaydat value

//Serial.println(“C”);//Output displayC string

delay(100);//Delay0.1 seconds

}

After downloading the program, open the monitor window to see the current temperature.

Arduino LM35 Temperature Sensor Implementation

Leave a Comment

×