Very Inaccurate and Fluctuating Temperature Reading on TMP36GZ

This is my very first Arduino project, as well as my first post on this forum, so please be nice :slight_smile:

I need some help here...

My body temperature is showing up as ~ 70 degrees Celsius (my room temperature reads at ~67) and the reading fluctuates a lot!

I am using an Arduino UNO, a 16x2 LCD, and a TMP36GZ temperature sensor (along with a 220 ohm resistor and a potentiometer). These all came in the Arduino starter kit. I followed the instructions EXACTLY from the Arduino starter kit book to set up both the LCD and the TMP36GZ sensor.

This is part of assignment for school which also requires me to test the sensor with boiling water and ice water, but the sensor is not waterproof! I am so confused! Has anybody done this before? I looked everywhere online and couldn't find this being done on this specific sensor!

If you would like to see my current project, here are some photos and a short video:

Here is my code, which I also checked on various sites and on this forum:

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
float temp;
int sens = 0;
void setup() {
lcd.begin(16,2);
}
void loop() {
temp = analogRead(sens);
temp = (5.0 * temp * 100.0)/1024;
lcd.print("Temperature:");
lcd.print(temp);
lcd.setCursor(0,1);
lcd.print("degrees Celcius");
delay(500);
lcd.clear();
}

This may help you understand what is going wrong.

The code in post#0 is for an LM35, not for a TMP36.

The TMP36 has a 500mV or 50 degrees C offset, so temps will be exactly 50C higher than with the LM35.
You can simply subtract 50.0 from the temp value, before printing it.

temp = temp - 50.0;

Or..
Use code that uses the stable 1.1volt internal Aref, and have a stable readout with five times the resolution.
Many examples for that on this site.
Leo..

Wow! Thank you so much! Now I am getting around 16 degrees in my room, but why is it fluctuating so much? When I put my finger on the sensor, it bounces around constantly from between 21 and 26 degrees. that's a big range!

Sounds like electrical noise is getting in somewhere. Do you have a circuit diagram?