By playing with the LM35 temperature sensor I noticed that the analog readings are inconsistent.
It seems that the voltage on the inputs are stable, but the readings are inconsistent. It deviates with +- 70 mV sometimes, sometimes even more. It gets even worse when the USB is not plugged in and the circuit is powered only by a 5V battery.
I cannot use this as a reliable measurement.
I saw there are some threads regarding this but didn't helped me solving the problem.
I am using an Arduino nano board.
Are there any solutions to solve this?
I order to determine the cause, I decided to measure A0->A4 pins together on different inputs, cause I read that some pins are not reliable or might be broken.
Code used:
#include <Arduino.h>
const unsigned int sensors[5] = { A0, A1, A2, A3, A4 };
float voltages[5];
void setup()
{
Serial.begin(115200);
for (int i = 0; i < 5; i++) {
pinMode(sensors[i], INPUT);
}
}
void loop()
{
for (int i = 0; i < 5; i++) {
voltages[i] = analogRead(sensors[i]);
Serial.print(String(voltages[i], 0) + " - ");
}
Serial.println();
delay(500);
}
Here are the results when the A0 is pinned to(VIN|GND|LM35):
- VIN - this looks very stable
1023.00 - 1023.00 - 1023.00 - 1023.00 - 1023.00 -
1023.00 - 1023.00 - 1023.00 - 1023.00 - 1023.00 -
1023.00 - 1023.00 - 1023.00 - 1023.00 - 1023.00 -
1023.00 - 1023.00 - 1023.00 - 1023.00 - 1023.00 -
- GND - this shows already variations
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
0.00 - 11.00 - 0.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
15.00 - 0.00 - 15.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
0.00 - 0.00 - 0.00 - 0.00 - 0.00 -
- TM35 sensor input
50.00 - 50.00 - 51.00 - 49.00 - 50.00 -
49.00 - 52.00 - 51.00 - 56.00 - 49.00 -
49.00 - 50.00 - 60.00 - 50.00 - 44.00 -
49.00 - 50.00 - 50.00 - 49.00 - 47.00 -
49.00 - 50.00 - 50.00 - 50.00 - 49.00 -
49.00 - 62.00 - 49.00 - 49.00 - 49.00 -
63.00 - 51.00 - 36.00 - 48.00 - 49.00 -
50.00 - 49.00 - 51.00 - 36.00 - 48.00 -
49.00 - 50.00 - 50.00 - 49.00 - 50.00 -
48.00 - 50.00 - 49.00 - 49.00 - 50.00 -
48.00 - 46.00 - 50.00 - 49.00 - 51.00 -
50.00 - 52.00 - 40.00 - 46.00 - 49.00 -
47.00 - 48.00 - 49.00 - 51.00 - 50.00 -
51.00 - 37.00 - 48.00 - 48.00 - 50.00 -
49.00 - 50.00 - 50.00 - 48.00 - 47.00 -
49.00 - 50.00 - 49.00 - 50.00 - 50.00 -
48.00 - 48.00 - 52.00 - 48.00 - 48.00 -
Here is the breadboard I am using. It's not visible on it, the VIN, GND its connected to a 5V battery.