You are on page 1of 9

Controlling LED Matrices with the MBI5026 Driver

Matrices are one of many interesting applications for LEDs. When multiple matrices are linked together into a ‘display’, scrolling text and even images could be projected.

Your eyes. With a high-speed camera. depending on where you are in the world. the speed at which it repeats ranges from microseconds to milliseconds. forming a image to the human eye. and flickering will occur. I will use the technique of multiplexing. however. every single LED could be controlled with 16 pins. persistence of vision Early movies used persistence-of-vision to animate objects.In a regular single-color 8x8 matrix. An interesting thing about the human eye is that it cannot detect changes faster than around 40 milliseconds. When a row is on. This oversimplified example explains it pretty well: the AC power going into the lights in your house runs at 50 or 60 hertz.5ms between row) becomes noticeable to the eye. From my experimenting. so it interprets it as a continuous light source. To get around this. . The cycle repeats for every row in the system one after the other. anything above a refresh rate of 30ms for a regular 8x8 display (~3. If you think about it. the LEDs are in rows and columns. 64 LEDs are arranged in a square with eight on each side. right? It makes sense if you think about 64 of them in a line. Multiplexed displays only have a single row on at any time. This is also the underlying principle behind pulse-width modulation. multiplexing Multiplexing is a common technique used to control large LED matrices and displays. cannot see that fast. the driver IC tells the columns which LEDs in that row to light up. Multicolor red-green-blue matrices are also available. By connecting all the anodes in each row and all the cathodes in each column. but the complexity increases dramatically because there are three times the number of LEDs. however. every LED in the 8x8 matrix would need a cathode and anode to control (a total of 128 pins). you can actually see the filament flashing on and off at that frequency. Depending on the microcontroller. In a matrix. This introduces another problem: it is not possible to control individual LEDs separately at the same time. Multiplexing takes advantage of this phenomenon.

The 74HC154 is not meant for supplying large amounts of current. Every one of these will be connected to separate output pins on the multiplexer. I picked this 16-bit multiplexer to control the rows. Nonetheless. which is what we need to power all the rows. one for each row. whereas the 5401 can handle 600mA. My display will have 36 LEDs per row. They will only turn ON and allow current to flow through the row of LEDs when there is NO current at the base. 24 transistors will be needed. whereas multiplexing is the technique used to control all the LEDs. This sounds counterintuitive. so the PNP transistors will only turn ON when assigned through the 4-bit input. they will be OFF when there is current at the base pin. components 74HC154 Since my eventual 4x3 display will have 24 rows of 36 LEDs. Why not the more common 2N3906? The 2N3906 has a maximum current rating of 200mA. however.Now that i’m done with the theory of operation. if 0101 is sent to the four binary inputs (A0-A3). Two of these will allow control of up to 32 rows. MBI5026 16-bit Constant-current sink LED driver . I will be using 2N5401s to supply power to the rows. My final display will have 12 matrices in a 4*3 arrangement. and 200mA is not enough to power all of them at full brightness. For example. The 74HC154 is ‘active-low’. The 16-bit parts can still be used to control a single matrix. meaning the specified output pin goes LOW and the rest HIGH when assigned by the 4-bit input. but it guards against all the rows turning on and killing the power supply if the multiplexer fails. it is not really relevant in our case because we will be using PNP transistors. the fifth output pin would be enabled because 0101 is 5 in decimal form. Don’t confuse multiplexer and multiplexing: the 74HC154 multiplexer turns on a specified output pin out of a bank of 16 based on a 4-bit binary input (A0-A3). Since these are PNP transistors. The 74HC154 is active LOW. 2N5401 PNP transistor Speaking of transistors. we can get to picking parts and drawing circuits. so I picked parts based on that.

completing the circuit and lighting the specified LED. An example with one of these: 0000000000000001. . The MBI5026 acts like a shift-register: data is shifted into three data pins. With two of them I can control all 32 columns of the display. base. The MBI5026 picks which LEDs in the row to turn on. The constant-current feature means that a current-limiting resistor for each LED is not required at all. All outputs will not allow current to flow except the first pin. so two separate bytes of data (one for 8-15. and because it is readily available where I live. there is a constant current feature. With these three primary components. The Arduino shiftOut() function doesn’t support 16-bit shift registers. collector. so the first LED will be lit. one for 0-7) will be sent before the data is latched. a 16-bit binary number. A practically unlimited amount of pins can be controlled with only three inputs. A row-transistor is turned on with the 74HC154 (not necessarily lit). For now I will only use one 8x8 matrix because I don’t have more breadboards available :).The LED driver is the most important part of controlling the display. assembly Eight 2N5401s: one for each row in the matrix. allowing current to flow. I picked the MBI5026 to drive the columns for three reasons: it has 16 output pins. and multiple chips can be chained together for more output lines. The MBI5026 is a current-sink. all rows can be multiplexed. The three pins are as follows from left to right: emitter. is shifted into the chip. The current for all the output pins is set by an external resistor. meaning it allows current to pass to ground.

MBI5026. 74HC154 with supporting circuitry. The collectors of each transistor are tied to the supply voltage. The resistor is used to set the constant current level in the driver.510 ohm base current resistors for each transistor. .

The outputs on the multiplexer tied to each transistor. .

. and the multiplexer to the rows (green and blue).The LED driver is connected (yellow and one blue) to the column pins of the matrix.

The LED driver is connected to pins 2-4. . pin 3 is the clock. In my case. pin 2 is the data pin. and pin 4 is the latch. and the multiplexer to pins 9-13.

However. The photo was taken with an exposure of 1/1000s.This photo illustrates the multiplexing effect very well. then turning it off and lighting the next one. to the eye it looked like the entire display was on at the same time. http://xy-kao. The human eye cannot detect motion this fast.php?id=led-matrix . the multiplexer was actually lighting each row for 1ms. but the camera did. Full Picasa web album with more detailed photos here.com/index. Code is available on my github page. equivalent to the refresh rate I set the display to. When I took the photo.