Skip to content

Temperature Sensor with Arduino and LM35 (Arduino + LM35)

Hello,

I’m starting to publish some experiments that I do with Arduino UNO/Nano, sensors and other stuffs. Today I created a thermometer with LM35 sensor.

The LM35 sensor is a temperature sensor, it will variate 10mV/Celsius. It pins can be seen on image (pay attention, it is a bottom look)

LM35 Pins

So to connect it to Arduino, you must connect VCC to Arduino 5V, GND to Arduino GND, and the middle pin you must connect to an Analog Pin, in my case I used A0.

This projects doesn’t need any resistor or capacitor between the Arduino and the Sensor, so just connect it. The Arduino ADC has a precision of 10 bits, so in this case 5V / 2^10 = 5V / 1024, so 0.0049 is our factor. To get the temperature in Celsius, we get the value and calculate like this:

Temperature = (pin * 0.0049)*100

But why multiply by 100? PIN * 0.0049 will give the volts on port, if we multiply it by 1000 we will have millivolts on port, the sensor varies 10mV/C so we need to divide it by 10 to get the temperature. On mathematics multiply by 1000 and divide by 10 is the same as multiplying by 100. Understand? [Add on 12/12]

And to have it on Fahrenheit, we need to make a conversion

TemperatureF = (Temperature * 1.8) + 32.

The arduino code that I used is:

[code lang=”c”]
int analogPin = 0;
int readValue = 0;
float temperature = 0;
float temperatureF = 0;

void setup() {
Serial.begin(9600);
}

void loop() {
readValue = analogRead(analogPin);
//Serial.println(readValue);
temperature = (readValue * 0.0049);
temperature = temperature * 100;
temperatureF = (temperature * 1.8) + 32;
Serial.print(“Temperature: “);
Serial.print(temperature);
Serial.print(“C “);
Serial.print(temperatureF);
Serial.println(“F”);
delay(1000);
}
[/code]

Hope you like it,
Matheus

References:
LM35 Datasheet
Arduino analog Read

Published inArduino

1,640 Comments

  1. new united states online casino b win; Isabel, casino free spins, 20 free spins on registration usa and new usa free spins no deposit,
    or online slots nz real money

  2. 25 free spins on sign up australia, canada gambling bill and play online usa roulette, or best casino sites in united states

    Feel free to visit my page: blackjack when to split 8s (Donald)

  3. netent casino list usa, gambling act south australia and new gambling sites
    australia, or best slot sites for winning usa

    My blog post :: bingo random number generator 1-15 (Aracely)

  4. united kingdom poker 90 s, casino online united states bc and usa are there casinos in colombia
    (Omar) free spins, or is online gambling in canada
    legal

  5. casino london uk, free 10 no deposit casino usa and
    safest online casino how to earn money in google play balance – Delmar –
    australia, or starburst slots uk

  6. insta casino 25 free spins [Polly] slots australia online, best online pokies united kingdom forum and new zealand bingo how to play,
    or new zealandn online gambling pokies

  7. new zealandn online casino minimum deposit $10, how to play free european roulette game; Sang, online poker
    for money in canada and bonausaa slot volatility, or
    casinos that accept neteller australia

  8. 888 poker new zealand app, casino ratings canada and latest casino news
    in usa, or $10 deposit online casino australia

    Visit my site … bingo wings origin (Grady)

  9. the blackjacks homepage canada, apple pay casino canada and
    jackpot casino australia, or new casinos
    no deposit bonus usa

    my page :: does hard rock have craps (Kyle)

  10. best free online casino new zealand, first casino in united states and run it once poker
    canada, or best casino sign up offers uk

    Feel free to surf to my blog buy blackjack table; Romeo,

  11. Ila Ila

    roulette odds united statesn, gousaos quest free spins no deposit and online casino real money canada, or real money
    slots new united states

    Also visit my blog post – blackjack pizza coupon – Ila,

Leave a Reply

Your email address will not be published. Required fields are marked *