Go Down

Topic: bare conductive paint and capacitive sensor tutorial (Read 17484 times) previous topic - next topic

jhamble3

Hello!

I have made the simple circuit following the directions on the Bare Conductive site, and have uploaded the sample code to my arduino uno. I am finding that the circuit is not responding as it should i.e. in the serial monitor I just get a high value for the sensor pin 2 that does not seem related to touching the paint, so I am wondering where I went wrong in constructing the circuit? I have checked all the connections, all seems fine, the resistor I am using is a 10kOhm which is also ok I think...
here is a sample reading on my serial monitor...
3899    0    -2     -2


thanks!

Grumpy_Mike

Lack of help on this thread is due to you not:-
1) Posting a link to the tutorial you are doing.
2) Posting the code you are using
3) Posting a photo of your set up so we can see what you have done and try and see where it is wrong.
My crystal ball says you have not connected the green wire, but that is a load of crystals.

zaphodbipbipbup

#2
Oct 31, 2014, 03:42 pm Last Edit: Oct 31, 2014, 03:43 pm by zaphodbipbipbup
Hey, maybe I can help you, I've had the same problem for quite sometime but solved it like this.

•first make sure you have the right resistor (very important) if you don't it will give you a zero, in your post you said you are using a 10k resistor, you'll need at least a 220k to get a response, they are asking for a 10Mega ohm I believe.

•follow the tutorial and if you have only one sensor, set your codes like this, I've realized that having multiple sensors active when you only need one messes up everything.


Code: [Select]
#include <CapacitiveSensor.h>

/*
 * CapitiveSense Library Demo Sketch
 * Paul Badger 2008
 * Uses a high value resistor e.g. 10M between send pin and receive pin
 * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
 * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
 */


CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired

void setup()                   
{
   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
   Serial.begin(9600);
}

void loop()                   
{
    long start = millis();
    long total1 =  cs_4_2.capacitiveSensor(30);
 
                   // tab character for debug windown spacing

    Serial.println(total1);                  // print sensor output 1
    Serial.println("\t");
   

    delay(30);                             // arbitrary delay to limit data to serial port
}


 
this should work,

have a nice day,

Z_

Go Up