# LM35 temperature sensor strange behaviour

I have a set of LM35 temperature sensors hooked up to an Arduino. I find it hard to believe all 3 sensors are broken.

The Arduino code is very simple.

void setup()
{
analogReference(INTERNAL);
Serial.begin(57600);
}

void loop()
{
delay(xxxxx);
}


The LM35 is connected correctly, but the values received by the Arduino are highly inaccurate. As is is ~20°C, the output should read 180-190, as the Arduino has a 10 bit ADC from 0 to 1.1V, and the LM35 outputs 0.1mV/C

I have plotted the output of some scenarios with different circuits and delays for your viewing pleasure. The y-axis is simply the ADC output from 0-1023.

Fig 1.

The 10ms between reads had an average value of 185, which is correct. Looking at the plot though, I believe this to be coincidence.

The fixes suggested on the datasheet and in other stackexchange questions such as this, it is suggested to put a 1μF capacitor between the ground and data lines, which leads to this plot:

The spikes at the start are due to me touching the circuit I believe. However notice the steady increase above 200 (room temperature).

Finally I constructed circuits 12 and 13 from the datasheet.

12 gave this result:

Circuit 13 with an RC filter constructed of 5 parallel 330ohm resistors and a 1μF electrolytic capacitor gave a steady reading of 10 or 1°C, which is incorrect.

It looks to me like I am sampling a higher frequency oscillation, but I cannot seem to dampen it with a filter without killing the signal. Any help is appreciated. Thanks.

• We're much more interested in the circuit you used than what you're reading under different conditions. Can you include a circuit diagram showing every connection? – Scott Seidman Feb 12 '19 at 16:21
• What voltage are you powering the LM35 with? Many Arduinos run on 3.3V, but the LM35 needs at least 4V to operate correctly. – Hearth Feb 12 '19 at 16:22
• @ScottSeidman Sorry for all the pictures. I got carried away, I guess. Anyway the circuit is just an LM35 powered by 5v (@Hearth), with the output pin connected to an ADC input on the arduino. I also constructed the circuits in figures 12 and 13 from the datasheet. This gave the results as described towards the end of the post. – Finnnicus Feb 12 '19 at 16:44
• I was asking so we could make sure that you handled your Arduino grounds correctly. We have no way of knowing your level of experience, so for all we know, you haven't connected the Arduino Ground to your circuit ground. There are probably 5 or 6 other details that might be nice to know, which is why we ask for good diagrams of your complete system, as opposed to datasheet usage circuits. – Scott Seidman Feb 12 '19 at 16:52