0
\$\begingroup\$

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()
{
  Serial.println(analogRead(5));
  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. Zero delay shows chaotic strange behaviour Slightly less strange behaviour with a 1ms delay between reads 100ms delay between reads showing something weird too


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:

enter image description here

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:

enter image description here

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.

\$\endgroup\$
4
  • 3
    \$\begingroup\$ 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? \$\endgroup\$ Feb 12, 2019 at 16:21
  • \$\begingroup\$ What voltage are you powering the LM35 with? Many Arduinos run on 3.3V, but the LM35 needs at least 4V to operate correctly. \$\endgroup\$
    – Hearth
    Feb 12, 2019 at 16:22
  • \$\begingroup\$ @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. \$\endgroup\$
    – Finn O
    Feb 12, 2019 at 16:44
  • 3
    \$\begingroup\$ 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. \$\endgroup\$ Feb 12, 2019 at 16:52

1 Answer 1

1
\$\begingroup\$

The LM35, like many similar circuits, is unstable with certain capacitive loads.

If you use the 2K resistor, it must be located near the LM35 and not at the other end of the cable. Similarly the damper circuit must be near the LM35. Below is from this datasheet.

enter image description here

The bypass of the LM35 (again, near the part) is highly recommended.

These are mature parts, and they work within specifications if you follow the datasheet recommendations. Note the comment from @Hearth that the minimum supply voltage is specified to be 4V (and maximum is 30V). If you are outside that range, proper operation is not guaranteed.

\$\endgroup\$
3
  • \$\begingroup\$ I've constructed both of these circuits, breadboarded with the LM35. Circuit 12 gave more noise. Circuit 13 gave a steady value of approximately 10mv. Both were bypassed with a 100nf film capacitor. Do these values seem appropriate? \$\endgroup\$
    – Finn O
    Feb 12, 2019 at 16:33
  • 1
    \$\begingroup\$ Yes, but how did you construct them? The placement of components matters. \$\endgroup\$ Feb 12, 2019 at 16:34
  • 1
    \$\begingroup\$ This family of sensors, although mature, do suffer from localised ground noise issues particularly underneath the device. Not an issue provided it is taken into account. \$\endgroup\$ Feb 12, 2019 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.