With a bit of reverse engineering, whole sub-assemblies can be also reused. In this post I’ll demonstrate how an indicator board from a junked UPS (uninterruptible power supply) can easily be modified to create an interface for an array of LEDs.
Here’s the bit I found in the recycling. It’s the front panel to a UPS and has 16 LEDs of various colors and two soft buttons:
Holding it all together is a single screw and some plastic tabs. Here’s the panel broken down into its parts:
For this project, we’re only interested in the PCB Assembly, so the rest can be returned to the recycle pile. Here’s the front and back of the PCB:
It’s a fairly simple board. On the front you can see the 16 SMD LEDs and two ICs. The back only has a handful of SMD capacitors and resistors. The board also has an 8 pin ribbon cable attached to it. This is the only way this board interfaces to the rest of the UPS. Right away this gives an important clue. Of the 8 pins, 2 are almost surely power and ground, leaving only 6 for signals. 16 LEDs and 2 buttons is 18 I/O devices, so it stands to reason that one or both of the ICs on the board are being used to handle the I/O, and that these other lines control the IC. This is very useful when you want to control a large number of I/O lines since I/O pins on an Arduino (or other micro-controller) are a limited resource. Let’s take a look at those two ICs and see if we can figure out what they do.
First let’s investigate the large IC since it seems to be connected to the LEDs. The markings on the top of the IC read “MBI5026GD” and “A3P05511EA”. Figuring out what chip this is used to involve flipping through phone book sized catalogs, but now it’s as easy as Googling those two markings, starting with the top one. “A3P05511EA” is likely a manufacturing code that specifies manufacture date, lot, location, etc. It probably won’t give any good info. “MBI5026GD” gets a bunch of results though, including a link to a pdf titled “16-bit Constant Current LED Sink Driver“. Hmm, LED driver? That sounds like what we’re looking at! I happen to have a few of these boards, and one of the other ones uses a chip of the same size and shape, but marked “A6276ELWT”. Searching for this yields a pin and function compatible chip made by a different manufacturer. This is pretty common, as most designers try to find multiple sources for their components to minimize risk of part shortages. Here are the data sheets for both parts:
MBI5026 | A6276
Let’s take a closer look at the datasheets. Here’s a block diagram from the Allegro datasheet:
The Product Description reads as follows:
MBI5026 is designed for LED displays. MBI5026 exploits PrecisionDrive™ technology to enhance its output characteristics. It contains a serial buffer and data latches which convert serial input data into parallel output format. At MBI5026 output stage, sixteen regulated current ports are designed to provide uniform and constant current sinks for driving LEDs within a large range of VF variations. Users may adjust the output current from 5 mA to 90 mA through an external resistor, Rext, which gives users flexibility in controlling the light intensity of LEDs. MBI5026 guarantees to endure maximum 17V at the output port. The high clock frequency, 25 MHz, also satisfies the system requirements of high volume data transmission.
Datasheets product descriptions are a great example of what happens when you mix engineers with marketing folk.
Here’s what that block distills down to:
This is an LED driver IC that uses a serially interfaced latch to drive 16 LEDs at a current of 5-90mA. Drive current is fixed by a resistor connected to the chip.
This chip has 3 main parts: The serial interface, the latch, and the output driver. Here’s what each component does.
The serial interface is a simple 16 bit shift register. It uses three pins – Serial Data In (SDI), Serial Data Out (SDO), and Clock (CLK). Each time the signal on the Clock pin transitions from low to high (GND to+5V), the value on the SDI pin is shifted into the first bit of the 16 bit shift register, pushing each of the 16 bits in the register over one spot. The last bit in the register is pushed out and onto the SDO pin. Think of it like a shelf only wide enough to hold 16 blocks. If you slide a block onto the shelf from the left, the blocks on the shelf are each forced over and the 16th one will be forced off the shelf. The SDO pin exists so that multiple shift registers can be connected in daisy chain fashion with the SDO pin of the first tied to the SDI pin of the second. This is like putting two of the previously mentioned shelves next to each other to make one 32 block wide shelf. Instead of falling off, the 16th block on the first shelf becomes the first block on the second shelf.
The latch is used to store the value of the shift register. It uses a single pin – Latch Enable (LE). When LE is high (+5V), the output of the latch matches the input. When LE is low (GND), the output is locked, or “latched” and the input can be changed without affecting the output. This enables you to output the current state of the latch while you are setting up the shift register with the next value. Once this new value is ready, the LE line is switched high and the latch output changes to the new value. The LE line is then switched low again to latch the value and the process starts over.
The output driver takes the value stored in the latch and uses it to set the state (high or low) of output pins. This translates into turning the LEDs off and on. It uses a total of 18 pins – Rext, Output Enable (~OE), and the 16 output pins. The output driver also regulates the current to each LED based on the value of a resistor connected between GND and Rext. Typically, each LED would need its own current limiting resistor, but this way the LEDs can all be directly driven by the IC. The state of ~OE determines if the output is enabled or not. This is an active low pin, which means that it must be low to enable the output and high to disable it.
OK, enough of the electronics lecture, let’s get back to the hacking!
Now that we know what’s driving those 16 LEDs, we can make a few more guesses about the ribbon cable attached to the board. The LED driver definitely needs CLK and SDI signals or it’s useless. LE is also probably used, but ~OE may be directly connected to GND since there’s no reason to disable the outputs. SDO probably isn’t connected since there’s no reason to chain these boards. So out of the 8 signals on the ribbon we’ve now likely figured out at least half of them. Now it’s time to check our work. We could probe everything out with a multimeter, but there’s another trick to help trace out connections on simpler boards like this one. Take a photo of each side of the board, then flip one photo and layer it on top of the other in a photo editing program like GIMP or Photoshop. By adjusting the transparency of the top layer you can easily trace out lines that transition from one side of the board to the other. Using a multimeter to verify the endpoints is still a good idea though.
From a combination of probing and tracing I was able to determine where each of the pins on the ribbon went. Pin 1 is designated by a square pad and is the farthest to the left when looking at the back:
- Not connected
- GND through R527 (a 0 ohm resistor acting as a jumper)
- VDD (+5V) through R526 (a 0 ohm resistor acting as a jumper)
- IC47 Pin 13 through R524 (2k resistor)
- IC47 Pin 11 through R522 (2k resistor)
- IC47 Pin 9 through R520 (2k resistor)
Pin 1 wasn’t connected to anything, meaning we only have 7 lines in use on the ribbon cable instead of 8. Pins 2 and 3 were ground and power, and pins 6 and 7 went to the buttons. That leaves pins 4, 5, and 8 to control the LEDs. They all go to IC47, so it’s time to see what that IC does. Googling the part marking “CD40106″ reveals that this is a Hex Schmitt Trigger IC. This chip is a collection of 6 inverting buffers – a signal coming into it high leaves low and signals coming in low leave high. According to the datasheet, the outputs of the Schmitt Trigger gates connected to pins 13, 11, and 9 are 12, 10, and 8, respectively. Going back to the probing and tracing we can update the list:
- Not connected
- Serial Data In
- Latch Enable
Now we know enough to test things out! I had an Arduino handy, so I wrote a quick sketch to walk an alternating bit pattern (01010101…) through the shift register with one second delays between each bit.
Success! We’ve figured out how the board works and we know how to control it. What’s left? Turn it into something cool!
The board is of limited use in its present state, but the LEDs can be unsoldered and replaced with wires to drive other LEDs. Since the board switches the GND side of each LED, we’ll need one wire per LED plus a wire to feed +5V to all of them. With the help of Adam B., I used the Sherline CNC to mill out a disc of aluminum and drill 16 holes in a circle around the edge. I won’t go into detail now on that process (maybe in a future post!), but here’s a few action shots:
I mounted 16 LEDs in the disc, and housed it in an old cordless phone charging station that was also picked out of the trash. I wired the the board to these LEDs and crammed everything into the charger base with 5 wires coming out the back for SDI, CLK, LE, +5V, and GND.
I then wrote another Arduino sketch that allows me to send different patterns (including random ones) to it at different rates. Here’s a video of the results:
These boards can also be combined to drive even more LEDs. One method would be to chain them by connecting the SDO line from the first to the SDI line of the second, and so on. This is slightly difficult because the SDO line isn’t used by these boards and would need to be brought out. The ribbon does have an unused pin (pin 8), which would be a good option. Multiple boards could also be driven in parallel. The LE and CLK lines could be shared, but a separate SDI line would be needed for each board. The advantage here is that data can be written faster. Rather than having to clock 32 bits of data through 2 chained boards, 16 bits could be clocked into each at the same time if they were in a parallel configuration.
That’s what I ended up doing in my maze box project.
I used 4 of these boards, with each SDI going to a separate I/O pin on my microcontroller. Each board controls 2 rows of LEDs in the 8×8 display. I wrote the code to keep track of the screen as a whole and adjust each board as needed. This way I could modify the entire screen without having to keep track of each individual piece. The end result is a maze made up of 64 8×8 screens arranged as a square. With each “pixel” represented by a single bit, the maze data takes up only 4,096 bits (512 bytes) of memory. Additional IO lines on the micro are used for the directional buttons and center bi-color LED.
In both of these projects, the only thing I had to buy was the microcontroller. Everything else was salvaged from the scrap heap and parts bins at MakeIt. There’s tons of treasure just waiting for someone to find it. Go take something apart!
P.S. There are a bunch more of these LED Boards available at MakeIt, free to any members!