I'm getting noise in analogRead. Even when I don't have any sensor or any other pins connected. I am getting a value like 39,47 etc in Serial.println(analogread(0)); i.e.,. Does everybody get such noise or is it only me. More importantly how do I avoid it or reduce it? Thanks in advance. :P
Does everybody get such noise
They do if they don't connect anything to the analogue input.
More importantly how do I avoid it or reduce it?
1) Measure a low impedance source of 50K or less. 2) Put a capacitor across the input. 3) Average several readings.
1)What do you mean by "low impendance source"?
2)Which value capacitors should I use?
Any voltage source has an impedance, otherwise you would be able to get an unlimited amount of current from a source. So for example there is a limit to the ammount of current you can get from a battery. It is like there is a built in resistance limiting the current. The value of this built in resistance is known as the impedance. In the case of a battery it is in the order of a few ohms. For signal sources this impedance is much higher, for example suppose you were to get a voltage from the wiper of a pot, the impedance of that voltage would depend on the overall resistance or value of the pot. For an arduino you get less noise when this is around 10K or smaller, if you were to use a 1M pot that would be a high impedance.
The actual value of capacitor to use depends on how much smoothing you want and on your source impedance. However start with a 0.1uF.