strange results with graph example

I was using the graph example with an arduino duemilenove (328 version) and the chart showing the input on analog pin 0 showed tall spiky peaks when my finger was near the pin, but when held really close to an lcd flat screen monitor, the graph flat lined, and with a book, similar results as the finger. Is this caused by radio interference, or something else?

What is else is connected to your analogue pin 0. If the answer is nothing then yes you are acting as an antenna and injecting interference into the system. This is what you would expect to see.

You can do a whole series of experiments just using a short wire connected only on one end to an analog input, as a sensor. The 'duino is sensing mostly your body capacitive and you can watch the analog pin charge and then discharge as you get close to it, and move away. It detects human body motion many inches a way. It is really sensitive to power supply noise though so may work better on a laptop with the charger unplugged.

The spikes in the graph, may or may not be a bug in the new code (I think the new code is probably in v 016 examples. It seemed to me that errant data was making through the serial function and getting plotted, but I ran out of time before I tracked down the behavior. Hook up a resistor to ground on your pin, and the graph should flatline to zero. If you still see the spikes then the problem is in the serial receiver part of the code. Repeat that experiment with a resistor hooked up to +5V and see if you get a steady state 5 volt reading.

paulb