Monday, February 18, 2013

Virtual candle (candleuíno) with arduino

Hello! I'm back, after a (more) troubled life period, but still here.
This time I developed something more romantic, something I was looking for a long time now.
What you will need:
  • Arduino
  • A led (clear orange or clear yellow)
  • Resistor for the LED (220 Ohm would be fine)
  • An LDR
  • Resistor for the LDR (10kOhm or 1kOhm would be fine, depends the darkness you want to be triggered)
  • Hot glue stick
  • Paper
  • A wooden box
First you connect the led and resistor as you can see in the picture, you may use any digital pin as long as you change the code to output to it BUT it must be a PWM compatible pin. 
Then you do the same with the LDR, as in the picture, using Analog 0.
Now you have to take care of the LED, it must produce a diffuse light, or it wil be worthless.
So, I used a stick of glue, cut it in about 1 cm, made a hole in it to fit the LED, and inserted it as you can see in the picture below.

I made the circuit and then uploaded to an arduino and hardwired it into a box. The resulting effect is the one in the video. Candle Vídeo
The original project can be found on this page, is slightly different from mine, but it's where I took most of the idea: ledhacker 
Now a picture of the final result:
 









And finally the code.