23 December 2014

Nativity scene light effects with Arduino

It's Xmas time again. At home we deployed our usual nativity scene that had been joined by a simple 3V lamp for the barn, a couple of years ago. I wanted something more lively for my daughters, as well as something that originated from my hobby interests.

The idea: build a day/night simulation and switch on/off the barn lamp accordingly. Simple enough with an Arduino-like board and few lines of code.

How to simulate the Sun light, dimmable with PWM? The most intense light emitter I could find at home is a 1W warm white LED mounted on the "star" heatsink.

Step 1. If I let little Sun_LED draw 150 mA it doesn't warm up (to the touch), so I don't need a bulky extra heatsink. But I need an interface out of the Arduino board, because it cannot supply that much current. A good old IRF510 does the job (without heatsink).

Step 2. The 3V incandescent lamp drains 120 mA! I am lazy, in a hurry, and I don't want to add extra components to deal with it: a white LED does the job with 1/20th of electrons.

Last but not least, the whole thing is powered with a variable voltage wall-wart adapter. Since the Sun_LED is tied to the main Vcc supply through a limiting resistor, I can control Sun_LED maximum brightness with a flip of a switch.

Code and video will follow.

Improvements. My daughter asked for a moving figure: we will try to buy one during after Xmas clearout, possibly that works with DC. "I myself" though of simulating not only the fading of sunlight, but the color excursion too. I will buy a power RGB LED and play with it during 2015.