AnalogIn reading random numbers from empty pin

01 Nov 2010

Hello!

The problem is if i try to read the analogin value with .read() function i get a lot of noise. Its constantly measureing values like 0,1 up to 0,25 sometimes even tho theres nothing connected to those pins. If i dont add any wait time between measurements it seems to work better. It almost looks like that if i wait like a second between the read()'s then it adds up all the noise to a big number. Or is there some grounding issues? MBED is taking its power from USB so im guessing it should get the grounding from there aswell. Tested other AnalogIn ports aswell. Same thing.

Its impossible to use any kind of sensor, if it keeps measureing so big seemingly random numbers.

Thanks for any help,

Joel

01 Nov 2010

Search forums for "noise".

01 Nov 2010

The pin is floating if there is nothing connected, you will always get random numbers because of this. Tie it to 5v or Gnd if you want a static value until you connect it to what ever you want to read.

Can't comment if you are having problems whilst connected to a sensor as I've yet to hook mine up to anything.

02 Nov 2010

not totally random, but within a few LSBs. You may find 50 or 60 Hz among the numbers.