# Calibration TMP36GZ

Hello, I'm trying to use TMP36GZ (sensor temperature) on third project and I think that output values are not calibrated. Please, can anyone explain to me how to calibrate the temperature sensor? Have I to follow same indications used for other sensors as explained in Arduino - Home?

What is "the third project".

Somewhere in your code could be something like this:
float voltage = (sensorVal/1024.0) * 5.0;

5.0volt of your Arduino might not be exactly 5.0volt.
Try changing 5.0 to 5.1 or 5.2 if your temp reading is too high.
Or to 4.9 or 4.8 if your temp reading is too low.
Leo..

Thank you for your reply. I mean third project on starterkit project manual: in this schematic is used a TMP36GZ; my results are too high (temperature more than 100 °C... yes it's a warmy summer, but still not so steaming). I'll try your advice

If temp is that far off, there must be something wrong.
Post a picture of your setup, and the code you're using (I don't have a starter kit or book).
Leo..

This sketch uses the potentially more stable internal 1.1volt Aref.
If it gives you the same large temp difference, then there must be something wrong with the sensor or setup.
Leo…

``````// TMP36 temp sensor output connected to analogue input A0, 3.3volt and ground

unsigned int total; // A/D readings
float tempC; // Celcius
float tempF; // Fahrenheit

void setup() {
analogReference(INTERNAL); // use the internal ~1.1volt Aref | change to (INTERNAL1V1) for a Mega
Serial.begin(9600);
}

void loop() {
total = 0; // reset total
for (int x = 0; x < 64; x++) { // 64(max) analogue readings for averaging
}
tempC = total * 0.001632 - 50.0; // Calibrate temp by changing the last digit(s) of 0.001632
tempF = tempC * 1.8 + 32; // Celcius to Fahrenheit

Serial.print("The temperature is  ");
Serial.print(tempC, 1); // one decimal place
Serial.print(" Celcius  ");
Serial.print(tempF, 1); // one decimal place
Serial.println(" Fahrenheit");

delay(1000); // use a non-blocking delay when combined with other code
}
``````