Capacitive Sensing

Inez Binkiewicz

For my capacitive sensing project I used a lemon to conduct sensing. I also tried to use kombucha scoby that I cultivated, but it did not work.

This is my code:

#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
int ledPin = 9;

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()
pinMode(ledPin, OUTPUT);
//cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 – just as an example

void loop()
long start = millis();
long total1 = cs_4_2.capacitiveSensor(30);
Serial.print(total1); // print sensor output 1

if(total1> 100 ){
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);

//delay(500); // arbitrary delay to limit data to serial port

Here is the kombucha scoby:




Here is a video of the capacitive sensing using a lemon:





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s