paulb

Some experiments with the Arduino as a capacitive sensor. All it requires is a 10 M resistor and a piece of wire. I was able to sense a hand about four inches from my 1.5" sq aluminum foil sensor.

Included are some machine code and port manipulation and an easy smoothing filter.

// CapSense.pde// Paul Badger 2007

// Fun with capacitive sensing and some machine code - for the Arduino (or Wiring Boards).// Note that the machine code is based on Arduino Board and will probably require some changes for Wiring Board// This works with a high value (1-10M) resistor between an output pin and an input pin.// When the output pin changes it changes the state of the input pin in a time constant determined by R * C// where R is the resistor and C is the capacitance of the pin plus any capacitance present at the sensor.// It is possible when using this setup to see some variation in capacitance when one's hand is 3 to 4 inches from the sensors// Try experimenting with larger sensors. Lower values of R will probably yield higher reliability.// Use 1 M resistor (or less maybe) for absolute touch to activate.// With a 10 M resistor the sensor will start to respond 1-2 inches away

// Setup// Connect a 10M resistor between pins 8 and 9 on the Arduino Board// Connect a small piece of alluminum or copper foil to a short wire and also connect it to pin 9

// When using this in an installation or device it's going to be important to use shielded cable if the wire between the sensor is // more than a few inches long, or it runs by anything that is not supposed to be sensed. // Calibration is also probably going to be an issue.// Instead of "hard wiring" threshold values - store the "non touched" values in a variable on startup - and then compare.// If your sensed object is many feet from the Arduino Board you're probably going to be better off using the Quantum cap sensors.

// Machine code and Port stuff from a forum post by ARP http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1169088394/0#0

I really enjoying your technique !!! It's brilliant !!! It's going to work perfectly for our project. If you are in the UK and not far from Brighton at the beginning of November, It would be a pleasure to see you at the private view. Here is a link to the website for more info : http://www.sonicbody.co.uk

Hi, I've been thinking about what you said. Is it because the two legs of the resistor are on the same line so the two legs are connected together instead of having the two legs separated?Anyway,Thanks for your previous explanation.

madskoser

I've been trying to do this but I can't get it to work.. Wired everything up as on the photo and then ran the program but nothing happened. Can you give a description on how to do this currectly since I apperently do something wrong.

Hi, did you find what was wrong ?I am not a expert so I can't really help.Are you following the second picture?Maybe your resistor is not the good one, if it's to low it won't do anything.Maybe your sensor is wrong. Try with copper or aluminium foil ( like in the one in your kitchen ).

Also, I used the commented part of it instead of the 'PORTB' thing.Here is my code, it's really a quick one just for testing. The 'activation' thing with untouched and store as to be better. I am wondering between the difference between two person or a same person after a different day. It seems that somedays I have more electricity in my body then other days.I haven't test with the original code again as I am looking into the multiplexer now.

Strange, maybe you have a older version of the arduino. I looked at mine and I still have plenty of space left after uploading the code. Weird.It could the float variable like westfw said but that I would find this strange. That would mean you are very very limited then. Try without the two variable I added, so at least you could see something in the Serial Monitor if that's the problem. It's the button next to the Upload one. Upload your code, when done click this button and wait a few second.