Magic Light (Capacitance Sensor, First Arduino Project)

Summary of Magic Light (Capacitance Sensor, First Arduino Project)


This beginner Arduino project creates a capacitive sensor that fades LED colors from purple-blue to red-orange by hand proximity. Using a high-value resistor and conductive foil as a sensor, the setup detects capacitance changes to control two LEDs. The project includes simple code calibration via the serial monitor and a creative housing made from a salsa jar and toilet paper tube, diffused with mod-podge and decorated with foil "wires." It’s easy to build, visually impressive, and ideal as a personalized gift.

Parts used in the Magic Light (Capacitance Sensor, First Arduino Project):

  • Arduino
  • Wires
  • High resistor (10 mega ohms)
  • LEDs
  • Tin foil or other conductive material
  • Breadboard
  • Salsa jar (for housing)
  • Toilet paper tube (for housing)
  • Elmers glue or mod-podge
  • White tissue paper/toilet paper (for diffusing light)
  • Hot glue
  • Cardboard (for base)
  • Paper (to cover base)

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:

Arduino
wires
high resistor (mine is 10 mega ohms)
leds
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.Magic Light (Capacitance Sensor, First Arduino Project)

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.Magic Light (Capacitance Sensor, First Arduino Project) Schematic

Step 2: Housing

To defuse the light coming through the jar I “mod-podged” toilet paper to the inside of the jar. To do this I mixed a little bit of elmers glue or mod-podge with just a tiny bit of water, and painted it onto the inside of the jar.  Then I pressed on ripped up scraps of white tissue paper (actually just 1 ply toilet paper).

To create the tree, I ripped foil into thin strips, about an inch wide, and rolled them between my palms into “wires.”  I then hot glued them down onto the jar. To make it wider in places I just glued several of them right next to each-other.  Afterwards to make it apear smooth on top, thinly coat sections with hot glue then press on a small flat peice of foil.  I used my fingernail to score around the ends and tear of excess.

I covered the cardboard base with paper, with hole for the power and usb wires.

 

For more detail: Magic Light (Capacitance Sensor, First Arduino Project)


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top