using CapSense arduino library

Hello All,

I am using CapSense arduino library in my project. I am facing an issue with that
1.whenever I am using USB to power arduino every thing is working great.
2.But I use 12 v dc adapter connected to my 220 volts socket to power arduino ,sensor stops working.

Circuitry and code is same as explained at http://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense
Resitance value 40 mega ohm

Please help me if some one face similar issue.

Regards,
Vijayendra

The tutorial is wrong. A capacitive sensor consists of 2 electrodes. A circuit may happen to work with only one contact, if the circuit is grounded, e.g. through USB. Otherwise a single contact only works as an antenna, catching ambient noise.

Connect the 12V GND to mains PE (aka protective earth/mains earth) and you are ready to go. That's what the connection to the PC does for you :wink:

Or, because it's not a connection for protection, connect it to a metal pipe or something in you house. Note, NEVER EVER do that for a protection earth connection!

The notebook will NOT connect you to mains ground / earth.

The cable coming out from all my notebook power suppies have only 2 connections.

Most electronic devices do not even have a third connector for earth anymore.
Have a look at your stereo or your TV set.

And for a capacitive sensor you do NOT need a second cable. The capaity of your body will sort of switch everything to ground.

That is the basic idea of a capacitive sensor.

All my dimmers work that way. I do not toch two sensors, just a round plate of plasic with a metal sheet behind it.

Yes this is the problem most face when using the capsense libiary for a project. Basically it is not good enough to use reliably on a project, especially if you have wires all over the place and stuck into solderless breadboard.

You need solid reliable unchanging ground and signal electrodes that are best achieved by using a PCB. You might get more luck with a prebuilt cap sense board that uses a dedicated chip and a more solid algorithm.

arduinoaleman:
The notebook will NOT connect you to mains ground / earth.

Nobody said notebook...

arduinoaleman:
The cable coming out from all my notebook power suppies have only 2 connections.

Most electronic devices do not even have a third connector for earth anymore.
Have a look at your stereo or your TV set.

True, but in most/all power supplies the secondairy is, being it high frequency, referenced to mains.

arduinoaleman:
And for a capacitive sensor you do NOT need a second cable. The capaity of your body will sort of switch everything to ground.

Of course you do! Your body indeed references it to earth but if the Arduino is fully isolated it has not notion whatsoever of that earth. And somehow you need to give it that notion by referencing it to earth (connecting GND to PE) or, because mains itself is referenced from earth, reference it to mains. Doing that directly however is dangerous but most power supplies have a capacitor between mains and secondary which will reference high frequencies to earth.

arduinoaleman:
All my dimmers work that way. I do not toch two sensors, just a round plate of plastic with a metal sheet behind it.

That's right, but that dimmer (because it's connected to mains) has a reference to ground. For a lamp with a plug and a touch dimmer it's pretty common for the dimmer to work only when the plug is inserted the right way. (Of course only applies to countries with non-polarized plugs like Schuko or Europlug.) Has everything to do with the lamp using the neutral as a reference to earth.

Hello All,

I connected arduino ground to PE and my sensor started working. All i did was to take a separate wire to connect PE and arduino ground.

But, Is there an alternative???
Will this connection damage my circuit??

Regards,
Vijayendra

vijayendra:
But, Is there an alternative???

Try to make a pad with interleaved GND and sens pin so a touch will cover both so it gives a reference to GND. That's how most commercial IC's work I know.

vijayendra:
Will this connection damage my circuit??

Why would it? That connection is also present if everything is connected to the PC but then just via the PC. And the library is just designed to need a reference to earth.