For some time now, I think the commercially available garlands, are too boring, too repetitive with their two or three alternations of colored bulbs.
I wanted to create a truly personalized one without ruin me either. Two ideas immediately came:
– a microprocessor to control all the lights, but at the cost of a relatively large strand wire, even though the use of crossing wire and diodes, can reduce the number of son, this is not very satisfactory,
– place a microprocessor per lamp, but until the price of each processor exploded the price of the most basic garlands.
The master processor sends control commands over a serial single wire bus. These commands are interpreted and transmitted by each slave unit.
2. LED Modules
The processor used is the PIC12F609-I/SN for several reasons:
– Its price € 0.56 including VAT per pack of 100 on tmicrochipDIRECT
– Its case: 8-pin SOIC
– The presence of an external interrupt pin and an hardware timer
The serial bus, as opposed to a parallel connection of all processors, was chosen for two reasons:
– This allows the self-enumeration of the slave units: starting the master sends a byte with a value of zero. This value is stored by the first unit, then the value “1” is sent to the next unit. And so on: each unit is taking to address, the value received, and sends that value incremented to the next unit. This avoids to program each unit specifically with a different address.
– On long cable, the resistance of the copper becomes significant. While each unit consumes about 50mA (LED above), after 50 diodes, the total consumption is close to 2.5A. In this case, the voltage reference to the mass change, and the interpretation of 1 or 0 become difficult. With chaining, the signal is regenerated at each hop unit.
Always the problem of current drawn on a string of any length, it is not guaranteed to have the same voltage at the beginning and the end of the garland. The principle is to feed the entire wreath with 7V and one regulator will stabilize to 5V on each unit.
The diode actually consists of three LEDs (red, green, blue) to create all the visible colours. It is supplied with common anode, because the microprocessor has drain capacity to ground greater than to provide +5 V on each bit output.
The intensity control is software (pulse width modulation). Each colour is controlled internally on 64 levels, all refreshed 100 Hz.
The printed circuit board is looking like :
– On the left the two power connectors and serial bus around the 5V regulator,
– The processor,
– The resistors for the LEDs,
– The connector of the LED.
b. Serial protocole
The transmitted frames are made of 25 bits : 7 address bits + 6 bits red bits + 6 green bits+ 6 blue bits.
Unlike a conventional serial communications, bits are encoded as pulse width, not by voltage level. The objective is to work with interruption, instead of pooling.
The software configures the trigger interrupt on rising edge. When this change occurs, a hardware timer is started and next interrupt is configured on falling edge. When this new event arrives, the timer value is tested to determine the value of the encoded bit. (60μS to “0”, 30μS to “1”). At each interruption, the state is reported as output for the next unit.
3. Master module
– 8F252 I / SP with its 20MHz quartz,
– Resistor on the MCLR pin,
– A programming connector,
– the serial output on PORTBbits.RB1,
– A 7805 regulator and its capacitor
I used a ready-to-use testing wafer, instead of creating at printed circuit board.
Master processor PIC18F252
LED processor PIC12F609
5V smd regulator MCP1702
For more detail: Microprocessors Garland