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.

DIY 3D Controller

Step 4Make the Circuit

Make the Circuit
«
  • rc3circuit.jpg
  • 2690922080_054abcff04.jpg
  • 2690923106_267f149586.jpg
  • 2690924006_59a6b7bdd6.jpg
The "circuit" is just two resistors per piece of aluminum. To understand why they're there, it helps to know what we're doing with the Arduino. What we'll do with each pin, sequentially, is:

  • 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.

The 270k resistors provide the voltage to charge the capacitors. The smaller the value, the faster they'll charge. The 10k resistors affect the timing as well, but I don't completely understand their role.

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 StepDownload PDFView All StepsNext Step »
8 comments
Nov 29, 2008. 8:55 AMUnit042 says:
Now that I've had a quiet few days, I'm finally building this thing. I've done similar R/C timing stuff to read the position of a variable resistor, but thishas me re-inspired (after forgetting about it for a while)...!

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....
Nov 29, 2008. 11:09 AMUnit042 says:
Woah, quick reply! I just tried this with a picaxe (single plate, about 1/4th size of one of yours), as I do not have an arduino. I used a 10M-ohm (ten million ohm) instead of the 270k (slow things down for testing), but kept the 10k (had a dozen lying around). Turns out that my 08M at 4MHz is simply not fast enough to reliably time the R/C circuit, even with the 10M-ohm resistor. I then switched to last-ditch non-timing software (after the cap is empty, set pin to input and immediately read it as an ADC, or analog to digital converter). This let me know that the circuit was working, and I got a value from it that varied a little bit when my hand got closer. A note to anyone who reads this: shielding matters! I used plain alligator clips to my (small) plates. I read the values, then, I twisted the two wires together (think twizzler candy), and the sensitivity improved markedly. If such a small thing as that will do this much, shielded wires are worth the bother, especially in something as "critical" as a mouse controller. (whoops, mymouse clicked and dragged my files to the recycle bin all by itself!) Say.... I have a bunch of unused RCA cables in my attic... now I'm going to switch to my basic stamp 2. It has some in-built software routines that may help. If that fails, I'm making my tin foil capacitor bigger, or add a regular capacitor in parallel to lower the frequency to a readable level. If that fails, I'll resort to a discreet component analog solution utilizing an oscillator and other cool stuff.
Nov 29, 2008. 11:11 AMUnit042 says:
Whoops! "I just tried this with a picaxe (single plate, about 1/4th size of one of yours), as I do not have an arduino. "

The stuff in the parenthases was talking about my capacitor, which is a single one, with two plates, 1/8th the size of yours.
Nov 29, 2008. 11:22 AMUnit042 says:
No, wait, my picaxe might have something also. Gotta search my documentation.... I think I'll set up a single opamp schmitt triggered oscilator (already breadboarded from previous project) with the sensor, which will output a certain frequency depending upon capacitor's capacitance, and the micricontroller counts the number of pulses (via in-built subroutines) sent from the oscillator over a (short) period of time.
Nov 29, 2008. 1:14 PMUnit042 says:
It worked! Frequency (with 10Mega-ohm resistor) borders on 70Hz, going down to 60 Hz when my hand is near touching it.<br/>Schematic (simple indeed) is available upon request, but I'm still experimenting with it.<br/><br/>Now, to increase resolution (accuracy), I can either: <br/>1. Increase frequency counting time (but lower position reading speed)<br/><br/>2. Increase frequency of single opamp schmitt oscillator (more counts allows me to decipher between 1352(close) and 1353(inch closer) for instance, instead of the current 60(hand nearly touching) to 70(hand far away) range.)<br/><br/>Hmmmm... I'm going with #2. Simple enough, I'll replace the 10 mega-ohm resistor with a 1M-ohm to increase frequncy ten-unfold. (It's not ten fold because we're not folding things up, whe're un folding our multiple of frequency---nevermind)<br/><br/>Hey! Did you put those yellow boxes on the schematic just now, or were they there the whole time?<br/><br/>==============<br/><br/>Oh, another reply. Goodie!<br/><br/>I prefer off-chip stuff, leaving the programming to stuff that needs programming (just my opinion).<br/><br/>Yes, theremin things are cool. I saw one once. Only a single tone capability, but the non-touchness of it made it <em>awesome</em>! But yes, in principle, hand proximity causing a change in output frequency. I bet if I put the output frequency to a speaker, I'd be able to hear the 60-70Hz tone. <br/><br/>{shakes head of dreams of making a theremin with tricked-out touchless tone/volume controls}But that's not what I'm doing now, I'm making a mouse. A cool mouse. {yes, I need reminding}<br/><br/>As for PIC stuff, the picaxe people put a bootstrap code in it that lets me program it in basic. granted, there are odd things in the language, and other wierd quirks, but it's the best money/ease of use thing I could find. It only cost me ~$20 to get started (programming cable included, software is free) VS Basic stamp: extremely easy, works every time, but takes a vampire to your wallet.<br/><br/>rctime times how long a given input stays low, right? I was about to do that with my basic stamp, when I looked over the picaxe documentation again.<br/><br/>RCA is a video cable with shielding. It's the ones with the one pin in the middle surrounded by a ring of metal, kinda like BNC's or coax's. see:<br/><br/><a rel="nofollow" href="http://en.wikipedia.org/wiki/RCA_connector">wikipedia: RCA connector</a><br/><br/>I think I might name my device:<br/>Theremin-esque Capacitive Appendage Proximity sensor Mouse Controller Thing (TCAP Mc Thing or TCAP Mc.T)<br/>
Nov 29, 2008. 4:59 PMUnit042 says:
I've ten un-folded and then doubled, then doubled again the frequency of the oscillator. After getting a feel for the typical numerical values acquired, I then set an arbitrary threshold beyond which the picaxe would light an LED. This experiment resulted in a "hold your hand close to the pad and the LED lights" device. Pretty fun! Now, to make something useful... I know---a mouse!
Mar 9, 2009. 8:49 PMFillitup4 says:
hey man.... could you post your code? I reallly really new to this and would like to know how you counted the time for the pin to go high....

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!
111
Followers
6
Author:kylemcdonald