Step 4Make the Circuit
- Set the pin to output mode.
- Write a digital "low" to the pin. This means both sides of the capacitor are grounded and it will discharge.
- Set the pin to input mode.
- Count how much time it takes for the capacitor to charge by waiting for the pin to go "high". This depends on the values for the capacitor and the two resistors. Since the resistors are fixed, a change in capacitance will be measurable. The distance from ground (your hand) will be the primary variable contributing to the capacitance.
We'll make this circuit at the base of each wire.
- Solder the 10k resistor to the end of the wire opposite the alligator clip
- Solder the 270k resistor between the shield and the wire (plate). We'll shield the wire with the same 5 V we use to charge the capacitors
| « Previous Step | Download PDFView All Steps | Next Step » |

















































I'm gonna start with a single plate, to keep things simple... until I get my three plates working together.
Then, I'm going to hack a usb mouse with a trackball, and make a touchless mouse! Granted, clicking, scroll wheel operations will take some thought, but still....
"The 10k resistors affect the timing as well, but I don't completely understand their role."
The 10k's limit current going through the I/O pins on the arduino to prevent burning it out.
Usually, you want to limit it to 20mA or 0.02A for lighting LED's. Otherwise, 10mA is safer.
The maximum amount of currrent going through any one of your arduino's pins is:
5v / 10,000 = 0.0005A
(Maximum voltage in the capacitor) divided by (resistor's value in ohms)equals (current passing through in amps.)
or 0.5mA worst case scenario (caps completely full).
You could lower the 10k's to 1k's for 5mA to lower the amount of time that the caps discharge, allowing faster reading and lower power consumption.
What? How can 5mA consume less than 0.5mA?
Well, those numbers define rate of power flow. Remember that 270k? All the while the cap is discharging, the 270k is feeding power down the drain, so the longer the capacitor takes to discharge through the arduino pin, the more power is wasted.
It would be helpful if somebody gave an estimate as to how long to discharge the cap before reading capacitance....
I tried making a "mouse" recently http://vimeo.com/2216027 but I'm still limited by accuracy issues due to the 60 Hz interference. I suggest you try overcoming the interference first. Someone posted a capacitive sensing library (on/off) on the Arduino site recently: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1227388576/0 that has a very simple principle I was planning on using: check the RC time on both the actual plate, and a small (or something shielded from your hand) plate simultaneously. Spit out the difference between the two.
Thanks for all the insight on the resistors :)
I wait very little time between discharging and reading capacitance, if you check the code. Something like 5-10 cycles at 16 MHz
The stuff in the parenthases was talking about my capacitor, which is a single one, with two plates, 1/8th the size of yours.
I know in BASIC there's "rctime", but I haven't used PICs before.
Also, I don't think RCA cables are shielded, though nicer ones for video might be.