Thursday, January 26, 2017

Reverse Engineering a LED Display PCB

While salvaging the case for my retro gaming computer, I neglected to take the display board apart. That's because I wanted to trace the pinout of the whole thing so I could perhaps drive it and make it into a clock or something. As always, I'm sure this is easier said than done, but you never know unless you try, right? This isn't a super duper complicated circuit, but with several shift registers, 8 light bars, and 14 14-segment displays, programming something to run it may be the real challenge here.





Here is the front and back of the board in question. It has 16 pins that connected it to the main board. With these 16 pins it had to power and control this whole board. It did this, of course, with shift registers. There are two kinds of chips on this board: there are 4 UCN5895As and 2 UCN5821As. The pinouts of these would be my ticket to reverse engineering the whole thing.

First off, I had to find what pins were voltage and ground. I did this by matching the Vcc and ground pins on a chip with corresponding pins on the header with a continuity tester. That gave me this:

Next, I had to find what the other pins did. That was fairly easy.


I've also found that the shift registers are chained from serial data in to serial data out, and the top registers (the UCN5895As) are probably connected to the bottom registers (the UCN5821As) by the sample circuit in the former's datasheet.

So that's all well and good, but how do we go about lighting this bad boy up? Obviously, we'll feed the logic 5V from an Arduino, but what does the load voltage need? According to the datasheet of a similar segmented led display, it normally takes about 2.1 volts. So the load voltage is also probably 5 volts. I'll slowly crank it up using a variable power supply just to be safe. According to the datasheets, the chips run faster at 12V rather than 5V, but we'll keep it at 5 for now just so we can get stuff to light up. Here's how it's attached to the Arduino from the perspective of the header (pin 5 can be tied to ground to keep the display always on):
The first GND is on the second row because I ran out of space on the top row with my wires. 
The first thing you may be wondering is the reversed polarity of the load supply and ground. That's just the case for this board.

Next is the Arduino code. Basically, we have 48 bits of data we can send. I believe we want to cycle the clock every time we write a bit and cycle the strobe every time we write all six bytes to write the data to the output pins of each register. This should shift the values all the way down the line and then produce a result. We'll use these values to build two 16x8 matrices of multiplexed LEDs. It now makes sense how 48-bits can access over 200 LEDs. I've painstakingly plotted out each LED's address in the matrix. These are the columns that access the bottom row in each matrix. To access the second matrix, add 8 to the column number. The first matrix is the left half of the board, the second is the right half of the board.


Here are the row numbers for addressing each light in a digit or a bar light.

 And the bar LEDs

The boiler plate code I've written will write a 14 character string to the board and send pulses down the row of light bar LEDs. Of course, you can make this do anything following the example I've written here. I think I'm going to make a bluetooth alarm clock out of this, but that's for another blogpost. For now, you can grab the code from this GitHub repo. This actually wasn't too hard to do. I wonder what else I can reverse engineer.

As you can see, I've already put the board to good use!

No comments:

Post a Comment