I'm trying to fix a problem on my first larger Arduino UNO project. I'm using capacitive sensing for a 7-button control panel. Each button is an object of a class similar to the http://playground.arduino.cc//Main/CapacitiveSensor library, with custom smoothing and debouncing. It only uses digital I/O. I've tuned it so it doesn't consume many CPU cycles for measuring, the baseline(while not touching) is usually around 150.

The problem is, that one of the buttons behaves as if it was always pressed, with occasional random releases. I've tried to use other pins on Arduino, with no change, so it appears as a hardware problem of the control panel. It's made of pieces of aluminium foil on paper connected to the Arduino by a ribbon cable.

The strangest thing, however, is that as long as the Arduino is connected to a PC, and Serial Monitor is running, everything works fine. Even if i comment out Serial.begin. I'm not using any I/O before setup() runs, and I've even moved object initialization to setup(). I've tried simulating the Serial.print-s with delay(), but it doesn't help.

The problematic button is neither the first, nor last to be measured. Everything runs in the loop() function.

I've thought of it being a memory problem, but avr-size reports 662 bytes for statically allocated memory(I'm not using new()), so i should be fine on an ATmega328P.

The strangest thing, however, is that as long as the Arduino is connected to a PC, and Serial Monitor is running, everything works fine.

My guess is that when connected to PC that either the power is better managed or the shield to PC ground is providing some RFI reduction. To find out which, try running off batteries and try just connecting the USB shield to PC case.

I have florescent lightning in lab with day-glow tubes. While nice for many things, the electrical noise often causes problems during prototyping operations. I have a few incandescent bulbs to fill-in during the times I must power-off the florescent units.