0
votes

i am using arduino uno , atmega328. on analogRead on the analog pin A0 returns 0 when it is grounded, and with HIGH signal from another pin it returns some value around 1000. But when i connect it to a sensor which gives out around 26 mV it returns random values ... YYY My code is very basic, uses analogRead and display it in serial monitor.

1
How "random"? Can you give examples? How do you know your sensor outputs 26mV? How noisy is it? Have you tried connecting a known voltage source (e.g. the output of a potential divider)?Oliver Charlesworth
the sensor is lm35 temperature sensor, sorry tat was 260mV with some fluctuations of +-10 mv .acid_srvnn
80 28 12 46 30 29 0 0 44 0 7 0 0 0 83 36 88 22 0acid_srvnn

1 Answers

1
votes

A signal with fluctuations of 10mV is not random. The flucatuations are called noise. The standard approach is to add a low pass filter in hardware or software. Since you have a controller anyway I would go for software based low pass filtering. A simple and computational cheap but effective low pass filter is an exponential filter, also known as exponential moving average.