3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

"TouchTimer" EggLight (valentine's gift)

Step 2The Touch-Sensor

The Touch-Sensor
The Capacitive touch sensor itself is nothing more than... CODE =D (and some resistors)

You see, each Pin (well most of them anyway) in the PIC microcontroller can be programmed during runtime to be INPUT, OUTPUT(HIGH or LOW) or just to be FLOATING on a tri-state condition...

What you need to do is (look at the schematics so you'll understand)

+Put Pin on High (gp_0)
+Let it Float (gp_0)
+Wait some time and read it's value with same pin or another one (gp1)

if a person is holding his finger between the finger contacts the capacitance of the pin is greatly increased , this way the gap of time that the Pin will take to discharge (during float) will be much larger than normal operation (no finger)... now look at the code below using two pins:

int fingert;      int check_finger(){      for(fingert=0;fingert<100;fingert++) //redundance (just to make sure)   {         output_high(PIN_A0);      delay_us(10);      output_float(PIN_A0);      delay_us(500);         if( input(PIN_A1) )      {         return 1;      }         }   return 0;}   

« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
4
Followers
4
Author:Proteus
Engineer graduated @ poli.usp.br , Embedded Software Engineer @ v2com.mobi , and all around nice guy =]