TEMPERATURE SENSOR – LM35 -MSP430G2553 – ENERGIA

Photo of author

By Jackson Taylor

I think ENERGIA make programming in very simple manner.Here i am interfacing LM35 which  is a low cost temperature sensor with wide operating range using ADC .Here measured temperature will send via UART. Use serial terminal to see data.

LM35 works up to 35V. Its output type is is anolog. Its output voltage increases 10mV when temperature increases by 1C .. For examples if temperature is 30 C then its output voltage equal to 300mV.

/*
Author --- Jimmy Jose
Microcontroller --- MSP430G2553
Temperature sensor---LM35
ADC Voltage reference---3.4V(step size =3.32mV , Resolution = 10 bits)
*/
unsigned int a; // for storing adc converted values
void setup()
{
    Serial.begin(9600); //starts serial (protocol--uart communication)
}
void loop()
{
    a=analogRead(A3)/3; //Here 3 used to convert real temperature value
    Serial.print(a);          //send value over uart
    Serial.write(0xd);        //to go to next line (think about what happen when you enter key in  the keyboard)
    delay(1000);              //measures temperature in every one second.
}
LM35 circuit diagram
See also
PWM BASED LIGHT WAVES USING MSP430G2553 FOR CHRISTMAS CRIB

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works