Been meaning to find out the design of commercial Christmas lights control units. Obviously a microcontroller takes care of the various flashing patterns, frequency, fading in and out, etc. I was at a loss, however, at how they power the MCU--a low voltage DC device--and what they use to power the lamps--AC or DC.
Got the chance to do that when I fortuitously came across some old strings of lights that my brother had left here about a year or so ago. I didn't even know he had left them. I was clearing some stuff and stumbled upon them.
This particular set has three wires coming out of the control box. It was evident that one was a common and the two other were strings of bulbs. A momentary contact switch allows the user to cycle through the six or eight lighting/flashing patterns.
I was smiling when I saw two screws on the small control case. That meant I could actually open the thing up without cracking the case to bits. I would've been rather reluctant to ruin the plastic enclosure had it been glued shut.
I promptly opened the case and to my surprise the board contained very few parts. Take a look (click to see a larger version):
Seeing the four diodes immediately told me that the circuit uses a bridge rectifier. The electrolytic capacitor must be for filtering, I mused. And the two TO-92 parts just had to be transistors to switch the two lines of bulbs. The MCU is on the vertical daughterboard, the die sealed in a blob of black epoxy.
What intrigued me was how the MCU was being powered. At first I thought that the two resistors might be forming a voltage divider and feeding the MCU with a low voltage DC which is then filtered by the cap. But when I took the multimeter, traced the connections, and actually drew out the circuit, it turns out this simply was not so.
I now believe that the MCU has an integral shunt regulator or a voltage regulator of some sort which automatically delivers the required MCU voltage, probably 5V. The 180K resistor is necessary in order to drop practically all 200VDC across it (VACrms × √2 × 0.636 = VDC average). The 10uF capacitor filters the pulsating DC. Its 63V rating implies that voltage at the MCU's VDD pin is well below the raw rectified voltage of 200VDC (with a peak of >300V). That the resistor value is 180K means that average current going through is tiny--200V/180K = 1.1mA. The MCU has to be using a relatively low clock frequency and the load--the two transistors--have to be drawing a miniscule current.
Since I see no crystal, resonator, or resistor-capacitor to serve as clock, the MCU is probably using an internal oscillator. Stands to reason since this is a low-priced product. The board has provisions for 4 transistors and thus 4 branches of lights but only two are installed. Counting all the connections to the MCU including the provision for two more transistors, I surmise that this is an 8-pin type. Since the lighting pattern chosen by the user via the tactile switch is remembered even after the unit had been turned off, the MCU must be storing the value in nonvolatile memory, probably EEPROM.
Interestingly the 2-Mohm resistor is connected to the 220VAC line. The other end meanwhile goes directly to one of the MCU's pins. This must imply that the zero crossing of the AC wave is being sensed. Why would the circuit be doing that? It probably uses zero crossing for pulse width modulation timing purposes. Among the patterns available in this set of lights is a gradual fade in/out. Given the components, without a doubt PWM is being used to achieve this. I imagine that the PWM frequency is 120Hz--synchronized to the power line--while the duty cycle is varied from 100 to % (and back to 100%) when the lights are being dimmed and brought back to full brightness. Whenever a zero crossing is detected, the transistor is switched on. For how long depends on the duty cycle as determined by the firmware. How fast the duty cycle is incremented/decremented is variable--again as determined by firmware.
Since the load is being powered by full-wave rectified and unfiltered AC, the PWM system is analogous to AC phase control. Had this been an AC system, the MCU would, upon detection of zero crossing, begin timing. After a computed delay time, it would pulse the triac briefly to turn it on. The triac would then conduct until the next zero crossing upon which it automatically turns off and switches to high impedance state.
In this all-DC system, transistors are used for switching. Although I drew NPN BJTs in the above schematic, there is a good chance that MOSFETs are being used since they draw very little current. And as you may have noticed there are no current limiting resistors to the base of the transistors. I googled the printed part number "1225 A868" but couldn't find any useful information on it. What we do know is that these transistors are high voltage types since >300V peak will be across their output terminals.