This was my very first arduino project.  Its great for beginners. Fade the color or the lights my moving your hands near it.  It fades from a pretty purple blue to a firey red-orange. Its was SUPER easy to build, not to hard to write the code, and its really impresses people!  I gave it to my mother for christmas, and it was a big hit. Watch the video to see it in action! I apologize for the poor quality, I will try to take more pictures.

All you need is:

high resistor (mine is 10 mega ohms)
tin foil or other conductive material

I build a housing for mine using an empty salsa jar and a toilet paper tube that happened to be the perfect size to snap together like legos.

Step 1: Code and Circuit

Set up a breadboard according the  semantic. Download the attached code.
Update: added Fritzing diagram and schematic (Its a great program, check it out frizting.org)

/*this code is a cap. sensor that fades between 2 leds
* set up: pin 8 > high resistor > one wire to foil, one to pin 9
*Led set up pin 2>resistor>led>grnd
*based on http://arduino.cc/forum/index.php/topic,8609.0.html
* ajust if statment to fit resistor, currently using a 10Mohm

Once it is set up, run the code and open the serial monitor.  Move the set up away from your computer to help diminish interference   Note what numbers are being out put when nothing is near the foil sensor, also note what it is when your open palm is extremely close to the sensor.  
Change the int low cap to just above the number output when nothing is near your sensor. 
Change high cap to the number output when you are almost touching the sensor.
You will have to adjust these numbers often to "calibrate" the light.  Many factor interfere with the readings to it needs to be set up whenever it is moved.
<p>The code didn't work? Do you guys have an alternative?</p>
I made this several years ago, so I no longer have it set up. You do have to adjust the capacitance range almost every time you turn it on to get it to work. <br><br>I believe I linked the code I based mine on in thr discription as well.
<p>Where will I attach the battery?</p>
<p>I didn't use a battery, I powered it off USB</p>
<p>Thank you.</p>
<p>Can u explain this code:<br>&quot;</p><p>for (i=0; i &lt; 4 ; i++ ){ // do it four times to build up an average - not really neccessary but takes out some jitter<br> // LOW-to-HIGH transition<br> PORTB = PORTB | 1; // Same as line below - shows programmer chops but doesn't really buy any more speed<br> // digitalWrite(8, HIGH); <br> // output pin is PortB0 (Arduino , sensor pin is PortB1 (Arduinio 9)<br> while ((PINB &amp; B10) != B10 ) { // while the sense pin is not high<br> // while (digitalRead(9) != 1) // same as above port manipulation above - only 20 times slower! <br> x++;<br> }<br> delay(1);<br> // HIGH-to-LOW transition<br> PORTB = PORTB &amp; 0xFE; // Same as line below - these shows programmer chops but doesn't really buy any more speed<br> //digitalWrite(8, LOW); <br> while((PINB &amp; B10) != 0 ){ // while pin is not low -- same as below only 20 times faster<br> // while(digitalRead(9) != 0 ) // same as above port manipulation - only 20 times slower!<br> y++; <br> }<br> delay(1);<br> }&quot;</p>
The code was pretty much directly taken from the code credited in the comments. I think the original coder was giving examples of mutliple ways of doing the same thing. I was originally using digitalRead- but this worked better, sorry I cant be of more help.
<p>Hi!</p><p>How do u make two individual capacitance function in one program?</p>
<p>This only uses one sensor. It checks to see if it is high or low, and then fades to either red or blue to match. You could probably ad a second sensor on a different pin, if that is what you are asking.</p>
<p>I really like this project! Im thinking of doing something similar for my senior project in college. I will definately credit you on it :) I just want to add music to it for a more special needs kids based toy. but I'm not sure how to go about doing that. :P</p>
Id love to see it if you do make it :)<br>Best of luck, wish I could offer advice, but Im just a tinkerer.<br>
Cool project! I don't know how to read the schematic however. Or at least I don't have the confidence reading them yet. Do you have a Fritzing project for it?
I'd never heard of Frizting before now. It look really usefull, I'll definitely make one soon! <br>
Made a quick diagram with it, added it to step 1. They're a bit messy but hopefully Ill play around some more with this program
Hey! Wow. That's what I needed! Thank you so much. Have fun with Fritzing and will watch for more of your instructables!
Love Fritzing. Lol.
pretty neat. voted for all 3 contests, good luck
Awesome idea!
Thanks! It's a fun little sketch to play around with even without making it look fancy.

About This Instructable




More by dablondeemu:IR Rainbow Cloud ver 1.1 Magic Light (Capacitance Sensor, First Arduino Project) IR Remote Controlled Color Changing Cloud (Arduino) 
Add instructable to: