Microprocessors Garland

1. Presentation

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.

For a short time, Microchip sells very small processors, a few tens of cents the unit, CMS and low number of legs.Microprocessors Garland


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

a. Electronics

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.

The total duration of a bit is 100μS.  With few hundred microseconds between each command, this mean 300 commands per second.Microprocessors Garland schematic

c. Software

3. Master module
a. Hardware

Extremely simple:

–          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.

b. Software

4. Documentation
a. Datasheets

Master processor PIC18F252

LED processor PIC12F609

5V smd regulator MCP1702



For more detail: Microprocessors Garland

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us: