I have capacitance being detected above a threshold and setting another pin HIGH as a momentary switch, when it drops below the threshold (you're not touching the touch point anymore) the pin is set LOW. The idea being that the output pin is HIGH as long as your finger is on the touchplate (this is to provide a gate signal to an synth oscillator, which will sound as long as it receives a HIGH (5v) input to its gate)
It all works great whilst my arduino is connected to my laptop via USB but when I've tried powering it from the 5v supply the synth is running off I get regular periodic drops to 0v - as if the pin is resetting? This causes stuttering in the sound. Likewise if I monitor the output pin with an LED it flicks on and off.
Without schematics I can only take a SWAG and say it sounds like you are having feedback through the synth via the power supply. Try using an opto isolator. Also you had the metal of the laptop that helps coupling that is not there.
Two experiments I've tried - completely independently of the synth - running from a barrel jack power supply (5v). Same result, this weird periodic 'reset to ground' pulse. With the USB power from the laptop everything is fine.
Also if I ground myself i.e. grab a lead connected to ground rail of my breadboard with the other hand then touch the capacitive contact it works same as when plugged in to the USB - no glitching.
I guess capacitive sensing is really sensitive to ground and somehow when it's plugged in via an external PSU (my synths rails or another wallwart) something is going wrong. I can't monitor the serial messages (capacitive touch above threshold or not) because that involves having the usb plugged in so the error isn't reproduced.
Really simple (as per capsense tuorials) - the 1M resistor goes between pins 4 and 6. When a bare wire is pressed with a finger at pin 6 then the code detects the threshold has been reached and pin 12 goes high and lights the LED.
Like I said it all works great - provided the arduino is plugged in to a laptop via USB. It must be a grounding thing but I just have no idea how to solve the problem if I want to embed the arduino in my synth as a module.
The opto-isolator would not be needed, you are picking up a ground field from the laptop. Placing some metal maybe a screen connected to the ground of the Arduino should fix it. If you can ground to earth that would probably be the best. I had wrongly assumed you were using a module of some type that gave you a digital output. You can test this by clipping a wire on the USB ground and the Arduino ground without plugging it in.