Reverse Engineering an LED Matrix Part 1

Front View

I came into possession of the device pictured above a while back with the intent of reverse engineering it without any documentation to begin with. At the time I felt it would be an interesting exercise in using my EE intuition to figure out someone else’s work and repurposing it for my own use. I’ve always been inspired by the ingenuity of hackers on Hack-A-Day and I felt this would be a great starting point for my hacking career. From first glance, the device is obviously some kind of LED display wired by hand. I hope to figure out the chips/interconnections that drive the display by reading datasheets and probing around with the multimeter. By the end of this I will be able to design my own controller hardware and write code that will make use of the display. A side goal of this project is to make use of a new tool I purchased, the bus pirate, which allows for a terminal based method of testing IC communications.

With closer observation it becomes apparent that the display consists of 20 individual 8×8 LED matrices arranged in 4 rows and 5 columns. On the bottom there are two different IC’s: a 20 pin chip of which there are four, and a smaller 16 pin chip of which there are many. These IC’s I assumed were some kind of LED driver, most likely shift registers that are daisy chained in some fashion. I was unsure what the difference was between the big/small chips at the time though. Moving my attention to the jumpers, there’s what appears to be a power connector with the conventional red/black wires that connect to the top jumper. The middle jumper appears to be some kind of programming header. Finally, the bottom jumper appears to be some form of electrical isolation for certain parts of the circuit.

Back View

I then set out to read up on the datasheets for the three components LTP14188A01 (Display), TB62710P (20-pin IC), and TB62725P (16-pin IC). What I found most surprising was that each display’s pixel consisted of two LED’s for green and orange. The rows were common anode and the column cathodes were unique to each LED. The two IC’s were both LED drivers as expected . Without getting too in depth with the datasheets they appeared to offer identical functionality short of the bigger chip offering the ability to send serial out to two different chips. They may also be able to source current which would make sense from a design standpoint, but I’d have to check the datasheet again. However, both operate as latchable shift registers with the possibility of daisy chaining to minimize the number of SPI buses.

Likely Configuration

I now had to figure out exactly how this thing was wired using nothing but my trusty multimeter, continuity testing, and my intuition. First I tried to verify my assumption from early on regarding the power connectors, this led to me finding out that the bottom jumpers were put in place to ground certain parts of the circuit. Next was the supposed programming header. My approach was to touch a single pin on the connector and tap the IC pins until it beeped. Then I looked it up on the datasheet and wrote it down and checked to see if the connection was shared by other chips. By the end I found the pinout for the header and got a good idea as to how the entire thing was organized which I’ve sketched to the left.

There are 12 SPI buses that share common clock and enable lines. Latching is separated by the row and column drivers. You can look at the display as being divided into rows of matrices. A single row driver is connected to the common anode of the row pins of each matrix and is driven by it’s own SPI bus. For each row there are two groups of five LED drivers daisy chained together. Each of these drive the 40 cathodes of the columns for a specific color. A unique SPI bus is assigned to green and orange columns for each row unit.

With the hardware figured out, I have a good idea as to how to make use of the display. Data is loaded onto the shift registers 4 rows at a time using the 12 SPI buses. The latch pins are strobed lighting up the LED’s in a single row. The process is repeated for the 8 rows per matrix faster than the eye can see. Thanks to persistence of vision, an image emerges. I’m a little disappointed by the design of this device though because of the 12 SPI buses required for it to work. This means either a single MCU must have the requisite SPI buses or some synchronization scheme must be implemented between multiple devices. Will need some time to figure out how this device was intended to be used. I hope to actually get to writing some test code soon.

Seven Segment Goodbye

One of the reasons I started this blog was to document my side projects and yet it’s been over a month so I decided to write up this little project I did as a warm up. About two weeks ago a good friend of mine was leaving BU for a while and I wanted to make her something special. Thing is earlier in the year I had promised to make her a blinking LED light or something which just got pushed on the call stack and proceeded to be buried by function calls. What followed was the idea to hack together some kind of electronic goodbye card with the parts I had left in my electronics kit the day before she left. As you can see in the picture there are only four components to this design: an MSP430 microcontroller, 4-digit seven segment clock display, AA battery pack, and a DPST slide switch. The operation is simple, at the flip of the switch the MCU is powered on and my message is shown on the clock display. I managed to hack this all together within a few hours.

First order of business was to get the display and MCU setup working on a breadboard. Looking at the datasheet for the display I found that the segments had a common anode for each digit. The solution of course is to multiplex the digits with a refresh rate greater than 60hz using the MCU. Since the only functionality I needed from the MCU pins was GPIO, I simply used wired the MSP430’s port 1 pins to the seven segments and the port 2 pins to the anode of each digit. One thing to note was the MCU I was using had a broken pin which just made the code a little more complicated by not having things map directly to bit positions on the port MMR’s. After wiring it all up though, the first thing I like to do is to simply load up an empty main loop and do a quick hardware debug by directly manipulating the registers in the debugger. This helped me catch a few small errors in wiring and the encoding of the segments.

Then came the task of actually writing the code. In general I tend to program bottom up because I like to break things up into small pieces that can be debugged and incorporated into a larger program. The plan was to light up a digit, multiplex the four digits, translate ASCII text, and finally marquee an entire string. To accomplish this my program basically needed four main components: A slow timer for the marquee, a fast timer for the multiplexing, an ASCII lookup table, and the goodbye card text. To take care of both periodic tasks I setup a single TimerA module for the fast timer with a delay variable for the slow timer. Within the timer handler I had two offset variables. The first offset dealt with the multiplexing of the digits and ranges from zero to four and increments every overflow. The second offset determines where in the message the display is and is incremented every ~500ms. Together, these determine which character to display on the segment by incrementing the base pointer of the message array which is then translated using an ASCII to seven segment lookup table.

With the code written and debugged, I set out to solder the components to a protoboard and make it look nice. Placement was pretty simple given the BOM of five components. Only real design choice I made was to rotate the MCU such that most of its pins had a direct route to the corresponding display pin. All other components such as the battery and switch I placed just for aesthetics. Soldering was really easy with these big through hole components on protoboard. If I had to change anything it would be to use some higher gauge wire than the solid core 24 AWG I had lying around. Routing got a little messy in the end and there’s a huge bundle of wires on the underside. Otherwise, the final product looked presentable and my friend was very happy with the gift.

Just a few last remarks, there remained one last bug that I didn’t bother fixing. Because of the way I handled the offset variables, when the marquee reaches the end of the array the multiplex variable can access memory locations beyond the message which also don’t necessarily lookup a character in the ASCII LUT. The result is some garbage is displayed at the tail end of my message, but I figured the conditional statements required to stop the bug was more trouble than it was worth. Another thing I noticed was a “ghosting” effect on the display early on in development. This is where I learned the importance of having turning off the segment before changing what’s being displayed. In regards to the ASCII LUT though, it was troublesome to find seven segment equivalents for each letter. If it weren’t for the fact that our brains can fill in the blanks for us when reading, the text would have been borderline legible. Next time I do something like this, I’d like to use a much better display and perhaps other components such as buzzers or LEDs on the side. Until then this project serves as a reminder to me as to why I love EE. That ability to create really complicated and fascinating objects both cheaply and easily.

The Value of an Education

Just recently I completed my undergraduate education at Boston University with a BS in Electrical Engineering. The moment I walked out of that last final exam for Analog Electronics was probably the happiest I’ve been in a long time. It was like a huge weight has been lifted from my shoulders in that I no longer have to worry about studying for another test or completing yet another assignment. Finally having the time to pursue my own curiosities without the nagging feeling that there’s something else more pressing to do. That’s not to say I hated pursuing my education, if anything this experience has been one of the most valuable and rewarding experiences of my entire life. I will very much miss being able to list my occupation as “student,” a person whose one job in life is to be a full time learner of whatever their heart desires. I often say to my friends that if it were a viable career path I would stay in University forever pursuing all kinds of degrees not just in Engineering or STEM subjects for that matter but I would love to pursue my interests in the social sciences. It goes without saying, education is a very important part of my life and I would argue that it’s a very important part of society.

The way I describe education is that it is a resource that is both extremely valuable yet infinitely replicable. I believe that if we as a society just invested a lot more into education we can solve many of the problems that ail us now and in the future. Without going into grave detail education is the great equalizer of society and the one way to break the cycle of poverty. Get an education, get a good job, provide better for your kids, and they get a better job… This idea which has been ingrained in my head since high school economics makes me so thankful for the sacrifices my parents have made to get me where I am today. As a first generation child of immigrants, I realize how many hardships they’ve overcome just so that I could be born in the USA and then have the best education they could provide for me growing up. What really breaks my heart though is when I see students at my university given every opportunity in the world and they just throw it all away by failing classes or doing the bare minimum without learning a thing. It’s what makes me work hard each and every day to make the most of  what is given to me. Every grade short of the best I could do is a waste of the time, money, and effort it took to get me here.

Now a little more about my undergraduate experience. These past four years have been some of the most important years of my life developmentally. I came into college fresh out of the high school wanting to major in “Electrical Engineering” simply because I had a knack for electronics and taking things apart. In reality, I had no idea what I was getting myself into and I don’t think anyone ever does as a high schooler. It’s actually quite ridiculous when you think about it, your college major is probably one of the more important decisions you will ever make yet there’s very little help out there for students who need to make it. Too many people spend too much money making that decision after the fact and I wish there were a way to give people an idea of what they’re really signing up for. For example, nobody told me I would be learning a dozen different programming languages each with its own special use case. Or that esoteric subjects like quantum physics and differential calculus would be things I not only need to know about but should understand really well. There’s just so much to each major that you don’t realize until well into the degree. Thankfully it all worked out in the end for me and I couldn’t be any happier about my field of study but I can’t help but feel sorry for those that aren’t.

I realize I started this post with a certain idea in mind, but after rambling on and on that kind of just got lost. Basically what I’m getting at is that education and the general availability of information is a really important subject to me and that it should be really important to everyone else. By providing a quality education to anyone who desires it, we can reduce inequalities in our societies and solve many problems in society. In this modern day age with the miracle of TCP/IP that enable the distribution of information at little to no cost to the masses there should be no excuse that anyone with the passion to learn about a subject can’t learn. Further, a university education is one of the greatest opportunities in life that an individual can receive. Anyone who wastes that opportunity is a fool.