Trouble with Temperature Sensor

Hi Folks, I am running the sample code provided to expose a temperature variable via rest within a browser. The good news is that exposing the variable via rest is pretty straight forward. The bad news is that the readings from the sensor indicate that my house is very warm…about 1000 degrees :slight_smile: It would seem that the readings coming from the Analog port are very sporadic and I am wondering if anyone else is seeing that? In the documentation, it suggests the use of ceramic capacitor but I do not have one of those. However, I just double checked using an arduino uno board and the readings are perfect without the use of a capacitor. I have checked the code about 17 times, unplugged and replugged. In addition, I have 2 other folks who are playing with the temperature sensor and they are seeing the same behavior.
Any thoughts?
p.s. gives a reading of 6.x this morning and yesterday it was 134.

Hi @scottdillon1

It sounds like you are using the TMP36 temperature sensor. The problem is that the analog inputs on the STMicro ARM are slightly different from the analog inputs on the Atmel chip used in and UNO. So you need a slightly different circuit.

A 1k ohm resistor from the output of the temp sensor to ground or a small capacitor from output to ground are both solutions that have worked for lots of other folks.

It would help if you mentioned what type of sensor your were using. Assuming it’s one of the TMP, have you checked any of these:

This topic contains a link which explains why you might need a certain fix:

Contrary to popular belief, the search function on this forum software work really well. I found the above information by typing in “TMP”. I’m sure you would’ve found it as well, had you tried the search. Give it a try next time :wink:

1 Like

Re: TMP36, a 1k ohm resistor to ground on this particular sensor violates its output load spec of 50uA. It also has a short circuit spec of 250uA, so a 1k ohm resistor effectively shorts the output of the TMP36 which is probably not great for it (it may self heat and skew temperature readings). The best advice I have for the TMP36 is to add a 0.01uF cap to its output. More info here: :slight_smile:

Sure, so pick 66k ohm instead–it is just a bit high for the ADC impedance. At the nominal operating point of 750mV for 25C, current is going to be coming out of the ADC pin as the switched-capacitor ADC discharges down from 3.3V/2 every measurement cycle. I will admit I have not tried 1k, but I bet it works OK and others here have said it worked for them. It’s a pretty forgiving part.

I don’t think there is a lot of science behind choosing the value 0.01uF either. Without an ESR and ESL spec, it is hard to know what kind of accuracy you will get. But I am sure it works fine too.

My point was really that you have to something different to make it work.