Ir ao conteúdo

Sensor de Temperatura com Arduino e LM35 (Arduino + LM35)

Ola,

Vou começar a publicar experimentos que eu faço com o Arduino UNO/Nano e Sensores, etc. Hoje fiz um termometro utilizando o LM35.

O LM35 é um sensor de temperatura de precisão, o mesmo varia 10mV por grau Celsius. Os pinos do mesmo podem ser visualizados na imagem.

LM35 Pins

O pino VCC você conecta no 5V do Arduino, o GND no GND do Arduino e o pino do meio você conecta em um pino Analogico, no meu caso utilizei o A0.

O mesmo não necessita de nenhum resistor entre o Arduino e o Sensor então basta fazer uma conexão direta. O ADC do Arduino UNO possui uma precisão de 10 bits, ou seja nesse caso 5V / 1024 que é aproximadamente 0.0049 será a precisão do mesmo. Para lermos a temperatura em Celsius fazemos o seguinte:

Temperatura = (pino * 0.0049)*100

Mas por que 100? Pino * 0.0049 vai nos dar a tensão na porta analogica em Volts. Se multiplicarmos por 1000 teremos millivolts, como o sensor varia 10mV/C dividimos os milivolts por 10. O que nos daria a temperatura, multiplicar por 1000 e dividir por 10 é o mesmo que multiplicar por 100. Entendeu? [Adicionado 12/12]

Para termos em farenheit temos que fazer a conversão que é:

TemperaturaF = (temperatura * 1.8) + 32.

O código utilizado no Arduino:

[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]

Espero que seja util.
Matheus

Referencias:
LM35 Datasheet
Arduino analog Read

Publicado emArduino

1.405 Comentários

  1. Great goods from you, man. I have understand your stuff previous to and you are just extremely wonderful. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it entertaining and you still take care of to keep it smart. I cant wait to read much more from you. This is actually a great site.

  2. no deposit bonus free spins uk, new zealand poker players and new zealandn eagle slot machine, or online casinos accepting usa

    Also visit my homepage :: magic mouse roulette (Sammie)

  3. Howdy! I ccould hwve sworn I’ve beeen to this blog befor but acter browsing
    through sme oof tthe post I realized it’s neww tto me.
    Anyways, I’m definitely delighted I found it andd I’ll bee book-marking and checking bawck often! xnxx

  4. One thing is one of the most common incentives for making use of your credit cards is a cash-back and also rebate present. Generally, you get 1-5 back with various expenditures. Depending on the card, you may get 1 back on most buying, and 5 back on expenditures made using convenience stores, filling stations, grocery stores as well as ‘member merchants’.

  5. biggest usa gambling sites, free money online commerce casino baccarat rules (Arianne) canada and casino games with
    no depoised free bonus usa players, or united statesn slots miami

  6. captain cooks casino united kingdom review, united statesn online
    casinos and online what does gambling mean in slang (Charmain) market share uk, or
    uk bingo call

  7. new zealandn pm blackjack, canadian gambling laws and online poker canada two plus two, or live
    online roulette united states

    Feel free to visit my web site … casino 94 game (Rena)

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *