Adafruit RGB LED Matrix

Home Custom PCB Boards Getting Started Tips Timing Pulse Generation Object Exchange FAQ Programming Examples

 

bullet

Adafruit.com gave me a few samples of this 16x32xRGB array and I'm on a mission to make them work better with a Propeller!

bullet

bullet

They got it working with an Arduino (code is here), but I'm out to make it work better and maybe control several of them with one Prop chip.

bullet

Compared with the PropRGB (see picture below of 4X PropRGB alongside this array), this array is much larger.  The price of this display is lower (per unit area) in comparison, making a large display more affordable.  It won't be as bright as PropRGB and probably won't have the same color depth or update rate.  But, we'll see what we can do.  Maybe using the Prop's video generator we can do a good job.  Also the PropRGB uses all the pins of it's Propeller to control one 8x8 matrix.  Here we may be able to use one Prop to control maybe 8 of these panels at the same time, making a large display system more affordable and simpler to control.

bullet

bullet

Reverse Engineering:

bullet

These displays don't have a datasheet or schematic, so I've taken it upon myself to reverse engineer them enough to figure out what we can accomplish.

bullet

The individual LEDs are controlled by twelve FD9802 LED controller chips.  Can't seem to get the pdf of the datasheet for it, but this text version of the datasheet says it's identical to the MBI5026, a 16-bit constant current LED driver.  These chips have a 16-bit register, one bit per pixel, that turns one of 16 LEDs either off or on.  The on level current is set by the value of an external resistor.

bullet

 Some quick math:  

bullet

Display has 16x32x3 = 1536 LEDs to control

bullet

Board has twelve 16-bit LED controlers =  12x16 = 192  <--  This is 8X less than we need!

bullet

How does it control 1536 LEDs with 192 outputs?  Well, there's a 74HC138 3-to-8 demultiplexer that uses three inputs (A, B, C) and selects one of 8 groups of pixels at a time.  This means only 1536/8 = 192 LEDs can be lit at a time.  Therefore, we have to quickly show each of the 8 groups, one at a time, quickly to avoid flicker.  Apparently, this is called "1/8 scanning" in the LED panel business...

bullet

The 74HC138 can't output enough current to control 192 LEDs, so each of the 8 outputs of the  74HC138 goes to a SSF4953 dual p-channel mosfet which works as a power switch.

bullet

There are six data input pins to the matrix (R1, G1, B1, R2, G2, B2).  So how do six inputs go to twelve LED controller chips?  Well, the FD9802/MBI5026 chips have a shift out as well as a shift in.  So, we shift the first 16-bits through the first chip and into the second chip.  So, in a nice way for a 32-bit MCU, we need to shift out 32 bits to each control pin during each update of 1/8th of the display. (Math check:  32-bits x 6-data x 8 sections = 1536 LEDs).  The data being shifted in isn't actually applied until we toggle the "latch" signal input.

bullet

Note that the shift out of the second chips, as well as the ABC control lines  are connected to an output connector that allows us to connect these displays in series.  So, with two panels in series, we'd need to shift out 64 bits for each 1/8th update.

bullet

There are two 74HC245 octal bus transceiver chips that buffer all the inputs.  This will allow us to connect directly to the Prop's 3.3V outputs even though this board is powered by +5V DC.

bullet

There is also an OE, "Output Enable" input pin.  This signal fans out to all the LED controllers.  This could be very useful for sharing the same data pins with two different displays.  We just need a OE Prop output for each display.  Using this along with daisy-chaining the displays could allow a large number of displays to be run by one Prop.

bullet

Organization/Layout:

bullet

You can see the 12 LED drivers in scan of the circuit board (below).  They are the large chips in kinda a zig-zag pattern along the top and bottom of the board.  I'll use the arrows printed on the board to define "top, bottom, left, and right" for the circuit board.  For the display side, left and right are reversed when looking from the front.

bullet

 

bullet

The R1 input goes to the SDI input of LED driver in the top left corner, UR1.    B1 goes the the chip, UB1, a little lower and to the right.  G1 goes to the chip, UG1, back up top and to the right of that one.  The serial outputs of these three chips go the serial inputs of UR1, UB1, and UG1 in the top right side of the board.

bullet

In the same way, the R2, B2, and G2 inputs go first to UR3, UB3, and UG3 in the bottom-left corner and then to UR4, UB4, and UG4 in the bottom-right corner.

bullet

The benefit of having a LED driver chip just drive one color is that each chip can have a slightly different bias current setting resistor, in case the colors aren't exactly balanced with equal currents.  These are the RR1, BR1, and GR1 resistors in the top-left quadrant.  BR1 and GR1 are both 1000 Ohms, but RR1 is 680 Ohms.  

bullet

There are 16 resistor networks around the board, RN1 to RN16.  These are 8-pin units, each with four 390-Ohm resistors inside.  The purpose of these is to drop some of the voltage going to the red LEDs.  Red LEDs have a voltage drop much less than blue or green.  That means the LED driver would have to dissipate a lot more power to drive them.  Adding a resistor to each output of the red LED driver chips, lessens the load on the driver chip.

bullet

Found these spec's online for what appears to be a similar unit:

bullet

Features

Parameter

Value

Parameter

Value

Pixel pitch

6mm

Driving Mode

Constant current

LED spec

&Encapsulation form

3528/ SMD 3-in-1

 

LED Wavelength

R:λ(625±5nm)

G:λ(520±5nm)

B:λ(470±5nm)

Pixel configuration

1R1G1B/Real pixel

Working temperature

-10-- 40

Module size

192mm*96mm

MTBF

10000Hours

Module resolution

32*16

Lifespan

100000Hours

Weight

0.18Kg

Smoothness

1mm/0.5mm

Scanning Mode

1/8scanning

Hub type

LINSN-HUB75

Brightness

1800cd/m2

 

Refresh frequency

400Hz

Power consumption

19.2W

Working Voltage

DC 5V

Viewing angle

H:160° / V:120°

Best view distance

6-33m

 

LINSN-HUB75 Interface

 

Signal name

Pin number

Description

A

9

The lowest bit of row address

B

10

The second lowest bit of row address

C

11

The highest bit of row address

LE

14

Latch of row

CLK

13

Clock

EN

15

Enable

R1

1

Red data 1

R2

5

Red data 2

G1

2

Green data 1

G2

6

Green data 2

B1

3

Blue data 1

B2

7

Blue data 2

GND

4,812,16

Grounding

 

 

 

bullet

Protection Circuit: 

bullet

All the way on the right side of the board, in the middle, is a protection circuit that disables the de-multiplexer output unless it senses active input.  There are two diodes and some capacitors there that rectify the "A" control signal input and apply it to the third enable input of the 74HC138.  This is probably meant to prevent damage to LEDs if the input is not changing.

bullet

bullet

Prototyping Connections

bullet

Use two rows of breakaway header pins to connect black wires to matrix's ribbon cable and then one row of breakaway header pins to plug in to Propeller Platform USB pins P4 through P15.  Also hooking up all the grounds with green wire to the Prop Platform.

bullet

    

bullet

Powering with a regulated 5V, 3A switch mode supply.

bullet

Testing it out with SPIN

bullet

Testing with this simple spin code lights up the last column blue and red.

bullet

This next SPIN example lights up any one pixel white.

bullet

This last SPIN example shows a Windows Bitmap

bullet

Source bitmap needs to be 32x16 and 24 bits per pixel

bullet

Driver only shows 3 bits per pixel though (the upper bit in each color).  So, you need to pick bright colors.  

bullet

Screenshot:    

bullet

Example Bitmaps:  

bullet

Assembly driver for 24 bpp (bits per pixel) color

bullet

The usual way to do a 24 bpp driver is to have the driver in a 256 level loop and within each loop compare the byte value of the color to the loop# and set the output if at or above this level.  But, the Prop just isn't fast enough to get 24 bpp this way.

bullet

Instead of this, we'll do a 8 bit loop with each loop lasting a power of 2 longer.  In this way, we can precalculate the output we want in the outa register.  So, there is no comparison in the loop and it can be faster.  The inner loop just does a readlong directly to the outa register 32 times and the sets the latch.  This allows us to reach 24 bpp.  Also, instead of putting in a delay for the power of 2 time each bit loop lasts, we'll just do the inner loop a power of 2 increasing number of times for each bit.

bullet

Ghosting:  In the first attempt at this, we switched between each of the 8 sections for each bit level.  But, with this display rapidly changing between sections is a bad idea.  For a reason that's still a little unclear, if you rapidly switch between sections there will be ghosting.  The worst case was when a single LED was lit.  To resolve this, switching between sections is done in the most outer loop so it is done as slow as possible.  No ghosting is now observed.

bullet

Gamma:  Well, this gets a little complicated (I'm not even sure I understand it fully).  Let me just say that without gamma correction, bitmap images will look washed out.  This is because this driver generates 256 linear levels.  But, the human eye is non-linear.  So, computer images are usually stored with levels that linear to the eye but are non-linear in terms of how long we should leave the LEDs on in our loop.  Anyway, we need to adjust the levels with a gamma lookup table.  Level 0 still comes out as 0 and level 255 is still 255, but levels in the middle are stretched around.  The gamma table was generated by a power function with power 2.5.

bullet

Here is the first assembly driver example.    It can show several embedded 32x16x24bpp Windows bitmaps with 24-bit color.

bullet

Getting serious with multiple panels and faster driver

bullet

Going forward, there are a few things we'd like to do...

bullet
Measure the current draw from each panel.  We need to know how much current these panels are drawing with this setup in order to match the setup to the power supplies we have.
bullet
Decide on how we want to hook up the multiple panels...
bullet
Fix up the driver to do more speedy bitmap updates and possibly have inherent text scrolling ability   
bullet
Come up with a Windows App to test out different configurations
bullet

Power draw measurements:

bullet
Measurements with a regulated switching power supply rated for 2 A and a Fluke multimeter:
All pixels on white with brightness=256, enable time=31:  3.0 A
Half pixels on white with brightness=256, enable time=31:  1.5 A
All pixels on white with brightness=256, enable time=15:  1.4 A
All pixels on white with brightness=256, enable time=23:  2.2 A
All pixels on white with brightness=256, enable time=7:  0.7 A
All pixels on white with brightness=128, enable time=31:  1.5 A
All pixels on white with brightness=64, enable time=31:  0.8 A
All pixels on white with brightness=192, enable time=31:  2.3 A  

  bullet

These measurements indicate that brightness is linear with the number of pixels turned on and brightness control and with enable time control.  This is good news because it means this supply is good, even up to 3 A.  Also, we can use enable time control (or brightness control) to power multiple panels.  Enable time is probably better than brightness control in most cases because it preserves our dynamic range.  
bullet

Demo1:  Scrolling text and bitmap at same time on 3 panels with 1 Prop Platform USB

bullet

 Screenshot: 

bullet

This demo scrolls a Windows Bitmap up and down on the right side of the screen and text on the very left side.

bullet

You can see the video here:   http://www.youtube.com/watch?v=sZywiOOGPkM

bullet

Download the code for this demo here.

bullet

The assembly driver is now blazing fast and can easily support 30 FPS video over all three panels.

bullet

Mounting Multiple Panels

bullet

The mounting holes for the panels are M3 (metric screw) threads, same as the power posts.

bullet

The simplest way I found to mount them was with  brackets for upright shelving

bullet
bullet
Not all the holes lined up, but enough did so that it is very secure
bullet

You can get similar things at almost any hardware store

bullet

Also, the ribbon cables that came with the panels weren't all long enough for this.

bullet

But, you can find longer IDC ribbon cables on Ebay for cheap

bullet

look for item# 180681676520 for example

bullet

For wiring, I went to the hardware store and found some lamp wire that they sell by the foot to be a good fit.

bullet

Also, some ring terminals (4-6 stud, 22-18 gauge) work well for the ends of the wire. 

bullet

6-Panel code example

bullet

This example is for 3 panels connected as shown above and then three more, each one daisy chained to one of the original 3 to form a second row of 16x96 pixels. 

bullet

Shields for Sale !