I've tried it using the standard resistor circuit from the capacitive sensor page and it definitely requires the either the use of a grounded connection via usb or I have to be touching the ground with my other hand.
include "Arduino.h"
#include <CapacitiveSensor.h>
unsigned long millisCount = millis();
int led = 13;
CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2);
void setup()
{
pinMode(led, OUTPUT);
cs_4_2.set_CS_AutocaL_Millis(10000);
}
void loop()
{
long signals = cs_4_2.capacitiveSensor(70);
if(signals >= 5){ digitalWrite(led, HIGH); } else{ digitalWrite(led, LOW); }
}
Regarding the touch lamps aren't they normally powered by the mains and therefore usually grounded as well?
I've ordered an mpr121 breakout board to try but that will take a few days to arrive so hopefully that will help.
There has to be a difference of capacitance between two conductors. If the torch is held in one hand, the other hand should be able to activate the capacitance sensor. Easier if the torch is metal but probably workable if there is metal inside a plastic torch.. like the batteries..
The torch is going to be a hanging one so I want it to be operable with just one hand, i noticed ralphs setup seems to have an extra capacitor between one of the pins and ground, would this be providing the difference of capacitance required in a battery powered version?