It is common in theater, kinetic sculpture, diaramas, etc. to need controllable lighting. Although a person operating a bank of dimmers is often sufficient, programmable lighting allows for a fuller form of "show control", where lighting changes along with physical movements and sound according to a script. The ability to quickly control brightness of many lamps opens up many possibilities. The technology described here is a general home-built solution to this need.
It should be noted that many commercial products for automatic lighting control exist, but they are prohibitively expensive for small stand-alone items such as the mirror lamps described here.
My approach involves components which can be assembled and programmed in different ways to meet a wide variety of needs. An example is shown at left, a 30 bulb Mirror Lamp. The main block is a 16 channel SSR board (solid state relay) which can control the brightness of up to 16 bulbs. Up to 8 of these can be chained together to allow up to 128 bulbs to be controlled. A single microcontroller board sends brightness data to the SSR boards, and can recieve various forms of user or environmental input. With the shown ADAPT912 microcontroller board, 64 levels of brightness, updated 120 times per second can be achieved.
CONTROLLING BRIGHTNESS WITH SSRs
The core elements of this system are shown above. The recent advent of cheap, small, solid state relays has made multi channel dimming much more accessible. These devices allow a wimpy logic-level signal to turn on and off hundreds of watts of AC electricity. And, if some fancy timing is applied, they can do dimming also.
The AC Voltage coming out of your wall is represented by the black sine wave. If something is just "on", it uses 100% of the sine wave, but if we wait some time after the zero crossing before turning on, we can get LESS than 100%. The red line is the turn-on point, and the further right it is, the dimmer the lamp will be. For this to work we also need to turn off at the next zero crossing, and this type of SSR does this automatically. A simple circuit called a zero crossing detector watches the AC line and notifies the microcontroller when the zero crossing occurs, and the microcontroller will then delay a certain time before telling an SSR to turn on. The longer the delay, the dimmer the bulb will be.
The "Octal D Latch" is the key to having lots of channels - a latch holds onto data when clocked. The data bus (D1-D8) originates in the microcontroller, and presents data to MANY latches, but they "Grab" data only when told (e.g. "Hey, latch #6, it's your turn to grab"). Once an octal latch grabs, the data is held (until another grab happens) and presented to the SSRs. Over the course of the 1/120 second half-sine-wave, there are 60 updates, with more and more channels being in the "turn on" state. The earliest channels to turn on will be the brightest bulbs.
Those unaccustomed to microcontrollers may be skeptical that so much can happen in so little time, but the AC powerline wave moves at 60 cycles per second, and this is SLOW for a quick thinking microcontroller. For the HC12 microcontroller used here (not a particularly fast one at 2 million instructions per second), the 1/120 second half-sine-wave takes enough time for 16,600 instructions to execute.
The SSR Board (below) was designed on ExpressPCB's free layout software, and manufactured using their MiniBoard service (excellent price and quality).
The firmware for the HC12 microcontroller was written in assembler and uploaded to the chip's Flash using a BDM pod with MINI IDE. The core routines of the firmware stay the same in different applications.