Project 13 Touchy-feely lamp - Only getting zeros

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.

#include <CapacitiveSensor.h>
CapacitiveSensor capSensor = CapacitiveSensor(4, 2);

void setup() {

void loop() {
  long sensorValue = capSensor.capacitiveSensor(30);


  • 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!

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

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.

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?

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.

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

anyone have answer?

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

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.

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.