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

932 Comments

  1. You made some decent points there. I checked on the net for additional information about the
    issue and found most people will go along
    with your views on this web site.

    Stop by my blog; Homepage

  2. RichardMon RichardMon

    Вывод запоя нужен не только при тяжелых осложнениях. Даже если пациент говорит, что «сам справится», запой может быстро привести к отравлении этанола, обезвоживанию, нарушению давления, делирия, галлюцинаций, судорожных реакций, инфаркта или инсульта. Чем дольше человек продолжает пить, тем выше риск серьезные последствий для организма.
    Детальнее – вывод из запоя капельница

  3. MelvinPriff MelvinPriff

    Врач контролирует состояние пациента на протяжении всей процедуры — от первого введения препаратов до стабилизации самочувствия. Обычно уже через час после постановки капельницы уходит тошнота, нормализуется сон, снижается тревожность и тяга к спиртному. По завершении инфузионной терапии нарколог оставляет необходимые медикаменты на несколько дней, дает чёткие инструкции по их приёму и рекомендует дальнейшие шаги: амбулаторное наблюдение, кодирование или реабилитацию. После вывода из запоя обязательно даются рекомендации по продолжению лечения алкоголизма, включая кодирование и реабилитацию. Во многих случаях — да: в частной клинике платная помощь включает выездную стабилизацию, чтобы анонимно и быстро провести необходимые процедуры на месте.
    Разобраться лучше – http://narkolog-na-dom-balashiha13.ru/

Leave a Reply

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