Go Down

Topic: Project 13 Touchy-feely lamp - Only getting zeros (Read 9306 times) previous topic - next topic

martinloland

Hello, for some reason I am only getting zeros in the serial monitor when I print the sensorValue. I've done some troubleshooting, but without any luck.

Code: [Select]
#include <CapacitiveSensor.h>
CapacitiveSensor capSensor = CapacitiveSensor(4, 2);

void setup() {
  Serial.begin(9600);
}

void loop() {
  long sensorValue = capSensor.capacitiveSensor(30);
  Serial.println(sensorValue);
  delay(10);
}


Wiring:




- Still zero when I touch the contact directly
- Done continuity check with multimeter
- My feets are touching the ground
- Connected with USB to computer

Thank you!

dannable

I am attempting to replicate your circuit - what value resistor have you used?

dannable

I used a 1 meg resistor and your code works just fine. Low values (10-40) normal, jumps to 2000+ when my hand is in very close proximity.

martinloland

Thank you for your help! Yep, I also used a 1 meg resistor. Could there be a problem with the library? I dont get any errors when I validate the code. Anything else I could troubleshoot?

dannable

The only physical difference is that I used a crocodile clip to grasp the foil.

Where did you get the capacitance library? I used the one in this link.

koiLunstrum

I got exactly the same problem ... and I download library as the link connection as shown ...I still got only 0

anyone have answer?

dannable

Post your code and a photo of how you have it connected.

packetkiller

I also have the same issue.  I have attempted several ways of getting something to indicate on the stray wire but no go...always 0.

packetkiller

Ok, sometimes you just have to admit when you do something wrong...

I somehow swapped my 220 Ohm and 1M Ohm resistors...

I put them in the correct place and now it works like a champ!

So check your wiring...including components.  I used my meter to check my resistors, as they are both blue and easy to mix up.

Go Up