Im currently dooing a Project where i planned to do a LCD Thermometer with my Arudino UNO. After wiiring and connecting everything i started programming. Now as soon as i finished the LCD Display showed me completly different stats. 24C°(Actual temperature) 130C° (Temperature shown on my LCD) Does anyone know what the problem could be?
Sadly i have no clue what sensor it could be. All i know is that ist a temperature Sensor wich Comes with the hole Arduino UNO starter kit. It says TMP 36GZ on it though. I have tagged you the setup up below.
The sketch seems to be written for an LM35 temp sensor.
Try this (untested) sketch.
You might need to overwrite the temp fields with five spaces to clear any previous temp digits below 10C.
Leo…
#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const byte tempPin = A0; // connect TPM36 to 3.3volt A0 and (not-shared) ground
float calibration = 0.1039; // calibrate temp by changing the last digit(s) of "0.1039"
float tempC, tempF; // holds final temp values
void setup() {
analogReference(INTERNAL); // use internal 1.1volt Aref for stable readings and higher temp resolution
Serial.begin(9600);
lcd.begin(16, 2);
lcd.clear(); // just in case...
lcd.setCursor(5, 0);
lcd.print("Celcius"); // print permanent words in setup
lcd.setCursor(5, 1);
lcd.print("Fahrenheit");
}
void loop() {
tempC = (analogRead(tempPin) * calibration) - 50.0; // for TMP36
tempF = tempC * 1.8 + 32.0; // C to F
lcd.setCursor(0, 0);
lcd.print(tempC, 1); // one decimal place
lcd.setCursor(0, 1);
lcd.print(tempF, 1);
delay(1000);
}