CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Capacitive sensor

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
thb
Guest







Capacitive sensor
PostPosted: Tue Nov 15, 2005 5:45 am     Reply with quote

Hi,

I want to have four metal pieces on the front panel of my application to use them as digital buttons. I thought about measureing the capacity which would then change if someone touches a button. Is that possible? In which order of magnitude is the capacity or the change in capacity?
Well, in detail I would continuously charge and discharge a capacitor, connect the metal plate to one end of it and then measure the time it takes to reach a certain voltage over the capacitor. Will that work? Is there another (better/easier) way? Of course the time will be very short and voltage must be measured quite accurately, is that possible with a PIC by using the CCS compiler?

I want to avoid external components as much as possible because I don't have much space on the board. I will use either a 16F877 (without A, no comparator right?) or a 18F452 running at 20 MHz.

Thanks for the help!

Thomas
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Nov 15, 2005 7:06 am     Reply with quote

Freescale makes an "E-Field" chip that does this.
Some other company that starts with a Q does as well.
Cypress can do this with their microcontrollers

Search on "Capacitive Touch"
neil



Joined: 08 Sep 2003
Posts: 128

View user's profile Send private message

PostPosted: Tue Nov 15, 2005 7:25 am     Reply with quote

The company you are thinking of Mark, is Q-prox, or Quantum http://www.qprox.com/products/touch.php
Regards,
Neil.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue Nov 15, 2005 10:47 am     Reply with quote

You should be able to do this with just your PIC and a few resistors and capacitors. I would start with Microchip ap notes AN512 and AN513 which describe measuring voltage and resistance by charging RC networks. Measuring capacitance shouldn't be much different.
I think an important feature will be that you are looking for a sudden change in capacitance. Capacitance may wander with weather changes but a sudden change means something suddenly happened like someone touched the sense electrode. Also consider the results of a false touch signal. Would it be a minor annoyance, or might someone get injured? What if a cat sits on your panel? Your command system might want one REAL button press before doing something dangerous.
The other important thing to think about is static electricity. If you just capacitively couple the sense electrode to a PIC pin you are asking for ESD damage to the PIC. You will need a RC snubber, clamp diodes, an ESD supression chip, or a combination of these.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Guest








PostPosted: Tue Nov 15, 2005 11:18 am     Reply with quote

Hi, thanks for all the replys until now. My possibilties to get exotic chips are not so good, so I would prefer doing it just with the pic and some standard parts.
SherpaDoug, that sounds good, I'll have a look at the application notes. The application is a display behind a plexiglas plate with the 4 touch buttons. The display should show temperature, rough water level for the plants in the room, "good morning" message, date and time, maybe control MP3 player, things like that. So it's not critical if the buttons give false signals. Also the environmental condition should always be similar. But maybe I'll try to record some samples and the apply a differentiation filter. OK, I had never problems with ESD, maybe now it's time to think about that.

Thomas
yerpa



Joined: 19 Feb 2004
Posts: 58
Location: Wisconsin

View user's profile Send private message Visit poster's website

PostPosted: Tue Nov 15, 2005 11:30 am     Reply with quote

Yes, the PIC is very good for that. I used the 16C54 about ten years ago for that application with many hundreds of touch inputs at eight inputs per PIC chip. A series resistor and the PICs own protection diodes make it ESD tolerant. You drive all touch sensors (we used a stainless steel bolt head) thru resistor and diode from a square wave generator (we used a 555 chip due to the large i/o count) and also directly drive a single reference input pin on the PIC. When the reference input changes from 1 to 0, the sensors that are touched by a finger will hold at "1" value for a little while (few milliseconds) before going to "0". This happens on each cycle of the square wave. See it about four or five times in a row, and the PIC knows a finger is touching the sensor.

Unfortunately for this forum topic, I programmed it in assembly! By the way, the PIC didn't have time to do much more than deliver a serial data stream.
imbue



Joined: 28 May 2005
Posts: 13

View user's profile Send private message

PostPosted: Tue Nov 15, 2005 11:57 am     Reply with quote

Just playing around, I have had good luck with nothing more than a single pull-up resistor. First, tie the pin to power though a high value resistor (around 1M). Then just drive then pin low and time how long it takes to go high again. If a person is making connection with the pin then there is a big difference. You don't need a capacitor because the PIC’s pins have some inherit capacitance anyway.

I would never put something like this into the wild without taking ESD into consideration first though.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group