Go Down

Topic: Capacitive sensor: sensitivity problem (Read 6505 times) previous topic - next topic

Oct 06, 2012, 01:42 pm Last Edit: Oct 06, 2012, 01:46 pm by fotomorisocial Reason: 1
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:
Code: [Select]

#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:)

RIDDICK

did u try this:
http://en.wikipedia.org/wiki/Capacitance_multiplier ?

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...
-Arne

#2
Oct 06, 2012, 02:55 pm Last Edit: Oct 06, 2012, 03:11 pm by fotomorisocial Reason: 1

did u try this:
http://en.wikipedia.org/wiki/Capacitance_multiplier ?

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 :) 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.

Grumpy_Mike

Quote
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.


Quote
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? :)

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

Grumpy_Mike

There are a number of techniques you can use.
Start off by looking at this:-
http://en.wikipedia.org/wiki/Capacitive_sensing
or perhaps better:-
http://www.eetimes.com/design/industrial-control/4371081/An-introduction-to-Capacitive-Sensing-Part-I

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.

ciavaldp

Thank you, Grumpy_Mike this helps a lot :)

dc42

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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Go Up