Home‎ > ‎Electronics Projects‎ > ‎

Modular LED Blocks

October, 2009
 A while back I was interested in experimenting with various LEDs and microcontrollers. Let's face it, it seems anytime you put a blinky LED on anything it seems like it grabs people's attention. So I wanted to make some fun gadgets revolved around really bright colorful LEDs. Just something simple where I could experiment with different routines to sequence the LEDs.
 
 
The above photos are of an array of 8-LED Modules and a single Controller.
 
So I designed a simple 8-LED block which I can plug into a simple microcontroller to drive them. I wanted something which allowed me to plug and un-plug different LED modules with different colors, configuration and/or numbers of LEDs. Taking this modular approach, these blocks can be added to allowing you to make long arrays of LEDs which can be controlled by the same controller. The above (admittedly not so great) photo is of a set of 8 LED-8 modules (64 LEDs total) connected to the controller module and 9V battery. The array is contained in a box a made specifically for these modules.
 
My design consists of two major parts. The Controller and the Module. Shown on the left is a basic configuration of a battery, controller and 2 LED-8 modules (16 LEDs total). Both parts are described in the sections below.
 
 
 
Simple Controller with 2-LED Modules
 

The Controller
The Controller is a simple circuit based on a Freescale HC08QT microcontroller. This microcontroller was chosen because I already had a development board for it and it has a very low pin count, is inexpensive and very simple to use. I have had pretty decent success using the Freescale Code Warrior Development Suite (Special Version) with this controller. It provides a full featured editor, compiler and a neat thing called Embedded Beans which make developing with this controller very easy. Plus the best part is it is free! The code size is limited but perfectly matched to this microcontroller (4k-ROM).
 
This particular controller has only 8-pins. Two of which are +5v and GND while the other 6-pins are available for I/O. In this design 4 of the six pins are configured as outputs to the LED driver chip (!OE, LE, CLK and SDO) while the other two pins are configured as inputs. These inputs allow the user to control such things as brightness, flash rate, pattern, sequence, etc.
 
The data signals to the LED driver are provided by LE, CLK and SDO. The !OE pin is driven by PTA0/TCH0/KBI0 configured as a PWM output. This is used to modulate the output enable pin to control brightness. Although this is unnecessary as the LED driver chip supports a method to control brightness (more on that later).
 
Note that with only two inputs remaining, this controller is still able to accept 3 switch inputs as well as an analog setting for user control. How is this possible? Look at my link on the Varswistor for more information on the technique.
 
The analog input(R3) and switches (S1, S2) are tied to the PTA5/OSC1/KBI5 input on the HC08QT configured as an analog input (ADC) function. The value of the ADC on this pin is read by the firmware to determine which switch has been pressed (S1 or s2) as well as an analog setting for 0-100% variable input. This input is fed by the Varswistor (a parallel resistor and switch arrangement).The third input is single push-button switch (S3) tied to a 10k pull-up resistor (R7). This is tied to the PTA2/IRQ/KBI2 input on the HC08QT.
 
 
 
 
 

Sample Varswistor Code for the 8-LED Module Controller

/*
 * Process both Analog and Digital I/O
 */
void ProcessInputs(byte *pRate, byte *pSwitches)
{
    byte raw = 0;

    // Sample SW3 and toggle if pressed and previous state
    // was unpressed (poor man's debounce). SW3 is configured
    // as a 'latched' toggle switch.
    if(SW3_GetVal() == 0) // Low->Pressed
    {
        // Toggle allowed?
        if((*pSwitches & SW3_TGL) == SW3_TGL)
        {
            // Switch is pressed and toggle allowed
            *pSwitches &= ~SW3_TGL; // Clear toggle flag
            *pSwitches ^= SW3; // Toggle SW3
        }
    }
    else // Not-pressed
    {
        // Set toggle flag, allow toggle on next press
        *pSwitches |= SW3_TGL;
    }

    // Set SW1 and SW2 as off since they are momentary
    *pSwitches &= ~(SW1|SW2);

    // Sample ADC
    Ctrl_Measure(TRUE); // Trigger a measurement & wait
    Ctrl_GetValue8(&raw); // Get measurement value

    // The following is good for;
    //   RbiasLow = 3.3k ohms
    //   RbiasHigh = 3.3k ohms
    //   Rswh = 1k ohms
    //   Rswl = 1k ohms

    // Extract SW1, SW2 and Rate
    if(raw > 190) // Actual = 201 -> 233
        *pSwitches |= SW1;
    else if(raw > 178) // Actual = 182
        *pRate = 100; // 100%
    else if(raw > 78) // Actual = 73
        *pRate = raw - 78; // n%
    else if(raw > 60) // Actual =  54 -> 22
        *pRate = 0; // 0%
    else
        *pSwitches |= SW2;

    return;
}

 
Power to the controller is provided by a 6-20VDC source (typically a 9V battery) and is regulated by an LP4931CZ50 LDO Voltage Regulator which provides a steady 5VDC to the controller. The raw supply voltage (Vcc) is carried on to the output connector to be later used as source voltage for the LEDs, so it is important to remember that the raw voltage supplied to the LEDs via the driver is unregulated and the same as the supplied Vcc. Both the LDO and the LED driver can handle up to 20V input. The regulated 5VDC voltage is provided to the LED driver IC as input power (it does not drive the LEDs). There is also an LED power indicator on board which indicates the presence of 5VDC to the board.
 
Capacitor (C5) provides bypass capacitance for the microcontroller.
 
The output signals (data, brightness, Vbatt and +5VDC and GND) are connected to a Molex 22-15-2086 8-pin female connector. These connectors are used on the modules as well in male/female pairs to allow attaching multiple modules to the controller.
 
On the PCB layout I have included an 8-pin (dual-row 0.1" spacing) pad for soldering a female(or male) header to connect an external debugger such as any MON08 compatible device. I use the P&E Microsystems USB Multilink myself with pretty good success. The debug header pin-out matches the microcontroller's pin-out when looked at from above. So there is a one to one mapping there.
 
 
Controller Parts List
 A complete parts list is also available via Mouser EZ-Buy Link.
 

C1

47uF

SMT Electrolytic Capacitor

C2

.1uF

Ceramic Capacitor (SMT0805)

C3

.1uF

Ceramic Capacitor (SMT0805)

C4

10uF

SMT Electrolytic Capacitor

C5

.1uF

Ceramic Capacitor (SMT0805)

JP2

DEBUG

2x4-pin Female Header (Optional)

LED

GREEN

LED SMT0603

R1

3.3k

RESISTOR SMT0805

R2

1k

RESISTOR SMT0805

R3

5k

TRIMPOT In-Line .1-inch

R4

1k

RESISTOR SMT0805

R5

330

RESISTOR SMT0805

R6

3.3k

RESISTOR SMT0805

R7

10k

RESISTOR SMT0805

S1

101-0264-EV

SMT Tactile Switch

S2

101-0264-EV

SMT Tactile Switch

S3

101-0264-EV

SMT Tactile Switch

S4

Power

SPDT Vertical PCB Mount Slide Switch

SV1

22-15-2086

Molex 2-pin Male Connector

U1

LP4931CZ50-

5V LDO Voltage Regulator TO-92

U2

MC68HC908QT4

Microcontroller SO08

X1

22-23-2021

Molex 8-pin Female Connector

 
Links / Downloads
Click on the hyperlinks below to download schematics, PDFs and EagleCad project files. You can also use the Mouser and BatchPCB links to order your own parts and boards if you like.
Schematics: .pdf, EagleCad(.sch)
PCB Layout: EagleCad(.brd), Assembly Guide (.pdf)
Gerbers (.zip)
Software (.zip) This is a simple (very hacked) dual LED block demo which drives 2 or more modules simply by writing one bit at a time. It is the same software used to create the videos. It is a packaged Freescale Code Warrior Development Suite (Special Version)  project. Feel free to use abuse or misuse as necessary.
 
Mouser EZ-Buy Project (Parts)
BatchPCB Order Link (PCB

The Module
As simple as the Controller is, the Module is even simpler. The main component of the Module is a Texas Instruments TLC5916 8-bit Constant-Current LED Sink Driver. Through a simple synchronous data interface, 8-LEDs can be individually controlled via a microcontroller. They also make a 16-LED version which I am also intending on trying. The LED Driver supports a cascaded serial shift output pin which allows combining these modules in a series of LED modules. This feature makes it perfect for a modular design like this one.
 
As mentioned in the Controller section, the Module accepts inputs via a Molex 22-05-3086 male connector while passing the outputs to the Molex 22-15-2086 8-pin female connector. Each module has the same male/female connector so they can be cascaded in series easily to make up long chains of LED modules. Although probably not recommended I have been able to "hot-swap" these modules as well allowing me to change arrangements on the fly.
 
I built several Modules, each with different color LEDs such as Blue, Red, Green and Yellow. There is one color per Module and this allows me to randomly create various LED color chains of all kinds of combinations. I suppose I could also make some Modules which have different color LEDs within them as well. The LEDs used here are Optek OVLFx3C7 Series 5mm LEDs with clear lens. These LEDs can handle up to 20mA continuous current. Just about any type of LEDs you have would work as well, just be sure to adjust the current supply as needed.
 
I have configured the TLC5916 to supply nearly 20mA to each LED via the 1k resistor (R-EXT, R2). The formula to use to compute the amount of current to provide is R = (1.25V / Io) x 15. A 1k resistor programs the TLC5916 to provide about 18.8mA. If this Module is not going to have it's !OE line driven by the microcontroller's PWM output, there is an optional pull-down resistor (R1) which can be populated to activate the output enable line. If more than one module is going to be connected in an array, be sure to break the !OE solder jumper (SJ1) on each module or at least make sure only one of the Modules has the pull-down resistor installed. Otherwise all the pull-downs of each Module will be in parallel lowering the overall pull-down resistor value. This could probably be pulled down directly to ground but I never really feel comfortable doing that, although it may be ok.
 
Lastly, there is a big honking capacitor (C1) which hopefully helps maintain a somewhat steady power source to the LEDs as they are pulsed on and off. If this is completely necessary or not I am not sure, but I threw it in for good measure anyway. Capacitor (C2) provides bypass capacitance to the driver IC.
 
Other than that, that is about it. The Module is very simple and really just relies on some simple programming in the Controller to drive them. I have also seen some designs where these types of Modules are driven by a 555 timer or other clock source for some special purposes. A microcontroller is not always required. See the article "555 timer eliminates LED driver’s need for microprocessor control" as one example of such a circuit.
 
Module Parts List (LED-8 version)
 A complete parts list is also available via Mouser EZ-Buy Link.
 

C1

47uF

Electrolytic Capacitor SMT

C2

.1uF

Ceramic Capacitor SMT0805

LED1

LED

5mm

LED2

LED

5mm

LED3

LED

5mm

LED4

LED

5mm

LED5

LED

5mm

LED6

LED

5mm

LED7

LED

5mm

LED8

LED

5mm

R1

10k

RESISTOR SMD0805 (optional)

R2

1k

RESISTOR SMD0805

SV1

22-15-2086

Molex 8-pin Female Connector

SV2

22-05-3081

Molex 8-pin Male Connector

U1

TLC5916

Constant Current LED Driver

 
Links / Downloads
Click on the hyperlinks below to download schematics, PDFs and EagleCad project files. You can also use the Mouser and BatchPCB links to order your own parts and boards if you like.
Schematics: .pdf, EagleCad(.sch)
PCB Layout: EagleCad(.brd), Assembly Guide (.pdf)
Gerbers (.zip)
Mouser EZ-Buy Project (Parts)
BatchPCB Order Link (PCB)

Assembly Photos
The photos below show how modules are easily connected together to form long chains of LEDs.
 
Controller and LED Module separated.
 
Controller and LED Module connected.
 

Video
 

YouTube Video


Other ideas...
  • December 15, 2009 - I saw this site mentioned at HackedGadgets from NerdKits. It's a multi-module (SPI-bus controlled) LED display. Similar to this idea but much better from the standpoint you can actually display text and graphics. In this case they are NerdKits that are distributing sign data so that a huge Multi-Panel LED Array can be built. Interesting!
  • I was thinking that if I could create a very small and convenient power supply which obtained power from a Christmas Tree light socket I could then plug in various "LED Ornaments" based around this small controller and LED driver. Might be fun to come up with a compact supply/controller modules and just plug in new ornaments.
  • A set of "Police Lights" for my son's motorized Jeep so he can terrorize the neighborhood.
  • Daft Punk Helmet - Someone was kind enough to notice my web page and mentioned they might be interested in using something like this for a Daft Punk helmet. I hacked up a very quick "proof-of-concept" to demonstrate how they might be used. A video of the result is shown below. I have also included the Software (.zip) used to make this video for any one's reference if interested. This is a simple (and very hacked) 8-LED block demo which creates some basic sequences. It is a packaged Freescale Code Warrior Development Suite (Special Version)  project. Feel free to use abuse or misuse as necessary.

    Daft-Punk Demo - Proof of Concept

  • POV Device - I was thinking, maybe I could use this idea to create a simple POV device which is able to display text and banners using a simple row of 8-LEDs. Might be interesting to do something like this MiniPOV featured in the Maker Shed.
Comments