TMP36 temperature sensor return zero ouput

I recently bought an Arduino Uno starter kit and proceeded to do the projects in the book that came with it. In project 03 (Love-O-Meter) I ran into some problems. The temperature sensor returned what seemed like arbitrary, but somewhat constant values. In addition, it seemed to ‘cool’ instantly when I touched it or even when I came close to the sensor.

I tried to troubleshoot the problem, by making a simple circuit just for reading the sensor (see attached photo), and wrote the following code:

const int sensorPin = A1;

void setup() {
  Serial.begin(9600); // open serial port?
  
}

void loop() {
  int sensorVal = analogRead(sensorPin); 
  
  Serial.print("Sensor Value: ");
  Serial.print(sensorVal);
  
  // Convert ADC reading to voltage 
  float voltage = (sensorVal / 1024.0) * 5.0; 
  
  Serial.print(", Volts: ");
  Serial.print(voltage); 
  
  // Convert voltage to temperature 
  float temperature = (voltage - .5) * 100.0;
  
  Serial.print(", degrees C: ");
  Serial.println(temperature);
  
  delay(10);

}

Now the sensor returns 0s, and an occasional 1, i.e.:

Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 1, Volts: 0.00, degrees C: -49.51
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00
Sensor Value: 0, Volts: 0.00, degrees C: -50.00

Thinking the sensor might be broken, or short-circuiting, I bought a new one. Unfortunately, the problem persisted.

I replaced the temperature sensor with the potentiometer, and that worked like I expected (i.e. analogRead returns values between 0 & 1023, depending on the position of potentiometer).

Is this a typical read-out for a broken TMP36? If so, what could I have done that caused it to go defective? Or am I overlooking something?

It is typical for a bad breadboard or a broken wire. Use another breadboard, or other location on the breadboard. Use other wires. If that doesn't help, try another Arduino board, or other analog input pin.

Do you have a multimeter ? To measure the analog output voltage of the TMP36.

Yeah... I tried those things, except for trying a different breadboard or arduine, since I don't have those. I also didn't check with a multimeter, because I don't have one either (I really should get one though). With the potmeter everything works perfectly normal (giving me a range from 0 to 1023, depending on the position of the potmeter).

Now, however, the output seems to be doing what it initially did, i.e.:

The temperature sensor returned what seemed like arbitrary, but somewhat constant values. In addition, it seemed to 'cool' instantly when I touched it or even when I came close to the sensor.

Below is some output. Note that the code only has a 10ms delay, so these values follow each other quite rapidly.

The temperature sensor returned what seemed like arbitrary, but somewhat constant values. In addition, it seemed to 'cool' instantly when I touched it or even when I came close to the sensor.

Note also where the output seems to drop rapidly. That's where I approach, but not touch, the sensor. It does this every time. I hate to admit it, but I am starting to feel really 'defeated' by this problem :o

Sensor Value: 89, Volts: 0.43, degrees C: -6.54 Sensor Value: 91, Volts: 0.44, degrees C: -5.57 Sensor Value: 90, Volts: 0.44, degrees C: -6.05 Sensor Value: 89, Volts: 0.43, degrees C: -6.54 Sensor Value: 90, Volts: 0.44, degrees C: -6.05 Sensor Value: 90, Volts: 0.44, degrees C: -6.05 Sensor Value: 93, Volts: 0.45, degrees C: -4.59 Sensor Value: 89, Volts: 0.43, degrees C: -6.54 Sensor Value: 90, Volts: 0.44, degrees C: -6.05 Sensor Value: 87, Volts: 0.42, degrees C: -7.52 Sensor Value: 85, Volts: 0.42, degrees C: -8.50 Sensor Value: 74, Volts: 0.36, degrees C: -13.87 Sensor Value: 71, Volts: 0.35, degrees C: -15.33 Sensor Value: 66, Volts: 0.32, degrees C: -17.77 Sensor Value: 70, Volts: 0.34, degrees C: -15.82 Sensor Value: 70, Volts: 0.34, degrees C: -15.82 Sensor Value: 71, Volts: 0.35, degrees C: -15.33 Sensor Value: 64, Volts: 0.31, degrees C: -18.75 Sensor Value: 62, Volts: 0.30, degrees C: -19.73 Sensor Value: 58, Volts: 0.28, degrees C: -21.68 Sensor Value: 62, Volts: 0.30, degrees C: -19.73 Sensor Value: 54, Volts: 0.26, degrees C: -23.63 Sensor Value: 57, Volts: 0.28, degrees C: -22.17 Sensor Value: 47, Volts: 0.23, degrees C: -27.05 Sensor Value: 38, Volts: 0.19, degrees C: -31.45 Sensor Value: 31, Volts: 0.15, degrees C: -34.86 Sensor Value: 26, Volts: 0.13, degrees C: -37.30 Sensor Value: 22, Volts: 0.11, degrees C: -39.26 Sensor Value: 21, Volts: 0.10, degrees C: -39.75 Sensor Value: 11, Volts: 0.05, degrees C: -44.63 Sensor Value: 10, Volts: 0.05, degrees C: -45.12

Arduino's input pin has a very high resistance. I have read in another post that (some) TMP36s like to be slightly loaded with a resistor. A 47k (minimum value) resistor from TMP36 output to ground could fix things.

The code you're using now should work, but is very crude. Code with 1.1volt Aref and oversampling should give more stable readings. Leo..

Something is wrong. But it can be so many things. Sensitive to touch or when you come close means that it is an open input or missing ground. Or for example when the sensor is connected to A2 and you read A1. The impedance is so high, that a nearby open analog pin follows the voltage next to it. If you are sure that everything is connected okay, and the wires are not broken, then it might be a faulty board. Is it an official Arduino board ?

In such situation it is best to fall back to something simple that is guaranteed to work. However, simpler than a TMP36 is not posible.

My suggestion: use another computer, another usb cable, and another Arduino Uno. Get a DS18B20 temperature sensor and a 10k resistor. You have to install the OneWire and DallasTemperature library for it. They can be installed with the Library Manager in the Arduino IDE. Try an example of the DallasTemperature library. If the DS18B20 is protected against water, drop it in ice-water and boiling water and you will notice that it is very accurate.

For 0 and 100 degrees, distilled water at sea level is needed, but using tap water is still close to 0 and 100 degrees.

Or buy a multimeter and measure everything in your circuit. Even a 5 dollar multimeter can be used for that, but spent a little more since a multimeter should be accurate and reliable.