LED Matrix Display

Last Sunday I gave a workshop in TOG as part of it’s Engineers Week 2011 activities. We spent the day assembling a 8×8 Red/Green LED Matrix Display circuit which I designed in strip board.

The circuit forms an interface between a micro controller and a 8 by 8 Dual Colour Common Anode LED Module. This type of module has two LEDs per pixel, each row has 8 pixels, with 8 rows. The anodes of each LED in a row are connected, with 16 columns formed by connecting together the cathode of an LED from each row.

A high side switch is needed to turn on/off a row and must be able to source approximately 240 milliamperes (16 multiplied by 15 milliamperes). A low side switch is needed to turn on/off a column, but only one LED is on per column so it only needs to sink 15 milliamperes.

For the high side switching I used a TD62783APG 8 Channel High-Voltage Source Driver from Toshiba Semiconductor. It’s very important that only one output from the TD62783 is on at any one time so I used a 74HC238 3-to-8 Decoder from NXP to control the row selection. For the low side switching we used two 74HC595 8-bit Shift Registers from NXP.

Only one row of LEDs is on at a time, the display uses persistence of vision to give the illusion that all the LEDs are active at one time.

The basic operation for displaying a single frame is. The data for a row is shifted into shift registers one bit at a time, the shift register output is turned off (OE), the row is selected on the decoder, the shift register data is loaded into the output registers (LE) and then the shift register output is turned on. These steps are repeated for each additional row of data. All the steps are repeated indefinitely until the next frame of data is to be displayed.

The circuit was designed around the Arduino micro controller but should work with other micro controllers. The connections are shown in the image. The left hand side of the display is the row select pins the central pins are for power and ground, with the columns connected to serial peripheral interface (SPI) pins on the Arduino on the right.

Dual 8×8 Matrix v0.1 Schematic

I’ll do a follow-up blog post with the source code and a Java program I’ve written to create animations.

Introducing the Mini Mood Light v1

Over the coming months I will use this site to try and document some of my previous electronics projects, as well as covering my future work and activities.  Kicking things off I’ll introduce the Mini Mood Light v1 kit.

Most of my recent projects have involved light emitting diodes (LEDs), you could possibly go as far as saying I’m obsessed. Some of my recent projects required hundreds and thousands of LEDs.

For the beginner working with a standard LED is relatively simple. It just requires a LED, a voltage source (battery) and a resistor with the correct value (ohms law is your friend). Working with a Tricolour or RGB (Red, Green and Blue) LED is a bit more complicated.

To achieve the larger range of possible colours with a RGB LED you can use pulse-width modulation (PWM). PWM is used to control the intensity of the LED by rapidly turning it on and off and by varying the amount of time that the LED is on or off. With a RGB LED the human eyes and brain are able to combine the different intensity of the individual red, green and blue LEDs into a particular colour.

The Mini Mood Light v1 provides a simple way for you to experiment and learn about working with RGB LEDs. The circuit combines two independent RGB LEDs, four buttons and a micro controller (MCU) on a small circuit board.

The Mini Mood Light v1 uses a MSP430G2211 MCU from Texas Instruments (TI). This MCU doesn’t contain any PWM hardware, but it’s relatively straight forward to implement PWM functionality in code using a loop and a comparison. The following fragment of C gives a very simple implementation.

int pwm = 128;
while (1) {
    enable_led();
    for (int i = 0; i < 256; i++) {
        if (i == pwm) {
            disable_led();
        }
    }
}

The combined pins of the MCU have a maximum source or sink current of 48 milliamperes. Reasonable luminous intensity for a typical LED is achieved at about 20 milliamperes. Which for the six LEDs in the Mini Mood Light that make up two RGB LEDs would exceed the maximum current rating of the MCU. To overcome this a Darlington transistor array (ULN2003A) is used as a switch to control the LEDs. With a suitable resistor setting the current for each LED to 20 milliamperes.

Four tactile buttons are connected directly to the MCU and can be sampled and debouched by polling or using a timer interrupt within the MCU. A 3.3 volt low dropout linear regulator (MCP1702), reverse polarity protection diode and a number of decoupling capacitors round out the circuit.

The Mini Mood Light v1 kit is being used as a hands on activity during a set of electronics workshops I’m giving in the TOG Hackerspace in Dublin. The workshops called Building it! are part of their Science Week 2010 and Innovation Dublin Festival 2010 activities.