Capacitive sensor: sensitivity problem

Hi everyone!
I am developing a capacitive sensor with my Arduino UNO,
but I am having a problem with low sensitivity.

I am already using an 80Mohm resistor (8*10Mohm resistors in series) but the sensor reacts to my hand only at 3,5 inches away, when my goal is at least 20. As far as I can read from the Capsense tutorial and the Bareconductive example stemming from it, a resistor of 40Mohm should sense my hand at least 12 inches away.

What am I doing wrong?
This is my hardware setup:
Pin 2 si connected to Pin 4: between them there is my capacitive sensor and the 80Mohm resistor.
Whenever my hand is in the sensing range, a led fades up. When my hand is away from the sensor, the led fades down and is off. (I avoided mapping the actual readings of the sensor to the led output due to slow performance).

The arduino is powered through an usb port of a laptop plugged into the wall socket (no battery). The sensor is made from an A4 sheet of paper covered with graphite paint (I tried with tin foil and the results are similar). I have tried earthing the Arduino connecting the GND pin to a non-painted water pipe as suggested in the guide, but the sensor doesn't improve its sensitivity. Doing the same to with the sensor doesn't help.

I also tried powering the Arduino with a 9volt battery: the sensor seems to lose its sensitivity, while the metallic part of the Arduino get sensitive. I tried connecting the GND pin to the negative pole of the battery, but to no results.

This is my code:

#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        //80M resistor between pins 4 & 2, pin 2 is sensor pin

  int outputvalue = 0; //this variable controls the power level of the led from 0 to 255

void setup()                    
{
   Serial.begin(9600); //starting communications
}

void loop()                    
{

  long total1 =  cs_4_2.capacitiveSensor(30); //total1 is the value of the capacitive sensor

    
  if (total1 > 4000){ 
      outputvalue +=5;
}

//if the sensor senses my hand, raise the power level of the led, making it fade up. 
//4000 is an arbitrary value I chose it because it is indicates a value where my hand is surely there. Without, the any contact, the sensor would fluctuates from 0 to 1000


   else { //if the sensor doesn't sense my hand, lower the power level of the led, making it fade down 
      outputvalue -=5; 
}



   if (outputvalue > 255) { //max value of the output is 255
     outputvalue = 255; 
}

   if (outputvalue < 0) {//min value of the output is 0
     outputvalue = 0;
}



  analogWrite (9, outputvalue); //light up the led connected to pin 9 accordingly to the previous script

Serial.print("sensor = " );   //print the values from the sensor and the output
Serial.print(total1);      
Serial.print("\t output = ");      
Serial.println(outputvalue);   
Serial.print("\t output = ");   
    delay(2);                            
}

I experimented with 100pF capacitors as suggested in the guide to stabilize my readings but they lower the sensitivity, so I abandoned them.

I appreciate every suggestion: I would really like to make this work from 20-30 inches away and make this battery powered since I would like to hang the results to a wall photo in a lightbox way:)

did u try this:
Capacitance multiplier - Wikipedia ?

could it b that u pick up a lot of 50Hz noise?

did u try to make a shielding below and around the sensor plate?
some grounded metal foil should suffice...

RIDDICK:
did u try this:
Capacitance multiplier - Wikipedia ?

could it b that u pick up a lot of 50Hz noise?

did u try to make a shielding below and around the sensor plate?
some grounded metal foil should suffice...

Hi there Riddick, thank you for your reply :slight_smile: and sorry if I write dumb stuff!
No, actually I haven't tried a capacitance multiplier, but noise is not my main problem, I think: I'm fine with the stability of my sensor, I just want to increase the sensitivity, and capacitors tend to lower it.

What do you mean by "grounded"? Do I have to connect it to the GND pin or earth it, as in the water pipe example?
Anyway I tried both: when connecting to the GND pin the tin foil underneath the sensor, the sensor reads -2 because the reading of the sensor times out when the sensor is grounded (it's in the capsense guide).

When connecting instead the foil to the water pipe, the sensor stops reacting to my hand even when touched and gives numbers ranging from 2000 to 6000.

I am developing a capacitive sensor with my Arduino UNO,
but I am having a problem with low sensitivity.

So you know that the technique you are trying to use is not reliable and repeatable and is not used in any commercial system. It is in the tutorial as a novelty, many people have made the mistake of trying to develop it but unfortunately it is not a good technique to use.
You are free to try however, but this is the sort of problem you run into.

Grumpy_Mike:

I am developing a capacitive sensor with my Arduino UNO,
but I am having a problem with low sensitivity.

So you know that the technique you are trying to use is not reliable and repeatable and is not used in any commercial system. It is in the tutorial as a novelty, many people have made the mistake of trying to develop it but unfortunately it is not a good technique to use.
You are free to try however, but this is the sort of problem you run into.

Hi Mike,
yes, I have read multiple posts that made me question the reliability of this technique.

However, I wanted to try this one because it was more suitable for a project I am doing. I am well aware of other easier techniques (for example ir proximity sensors, especially the Sharp GP2Y0A02YK0F model), but I wanted a technique that involved the human body.

Do you have any suggestions to improve my project? What other techniques would you advise? :slight_smile:

P.S.
I have stumbled upon your nickname many times during my research, so it's kind of an honour :stuck_out_tongue:

There are a number of techniques you can use.
Start off by looking at this:-

or perhaps better:-

Then there is this from Microchip
ww1.microchip.com/downloads/en/AppNotes/01101a.pdf

Cypress include cap sensors on some of their processors
www.cypress.com/?docID=3346

and there is
www.fujitsu.com/.../fujitsu-whitepaper-capacitive-touch-sensors.pdf

So you see many people are working on this and the best technique depends on what exactly you want to achieve.

Thank you, Grumpy_Mike this helps a lot :slight_smile:

For measuring low capacitances, I use the capacitor in a 555 oscillator circuit, then measure the output frequency using the Arduino. Use the CMOS version of the 555, it allows you to use higher value resistors.