Skip to content

Display

The display on the Arcade Coder is a 12x12 LED matrix. Each pixel works in 3-bit colour (giving 8 total colours). Each pixel also serves as a button.

The matrix is split into groups by row. The multiplexer selects the rows to be drawn to, and the data is sent to the rows via the shift register.

Pins

HC595 Shift Register

ESPShift Register
GPIO5Data In
GPIO17Clock
GPIO16Latch
GPIO4Output Enable

For the output enable pin, a high signal enables output and a low signal disables it. Practically, set high when writing data.

ICN2012 Multiplexer

The rows are selected by setting different combinations on the multiplexer.

ESPMultiplexer
GPIO19A0
GPIO18A1
GPIO21A2
A0A1A2Rows
000Unknown/Off
0014 & 9
0101 & 6
0116 & 12
1005 & 10
1013 & 8
1102 & 7
111Input Reading

Data Format

The data sent to each of the two rows is 9 bytes (or 72 bits). The bits are inversed, with a 0 representing the on state and a 1 representing off.

For testing, sending 9 bytes of 0xffffffff should result in all white LEDs, and 0x00000000 should turn off all the LEDs.

The table below is ordered with most significant bit first.

Byte 8 7 6 5 4 3 2 1
1 Green, pixels 5-12, top row
2 Red, pixels 5-12, top row
3 Blue, pixels 5-12, top row
4 Green, pixels 1-4, bottom row Green, pixels 1-4, top row
5 Red, pixels 1-4, bottom row Red, pixels 1-4, top row
6 Blue, pixels 1-4, bottom row Blue, pixels 1-4, top row
7 Green, pixels 5-12, bottom row
8 Red, pixels 5-12, bottom row
9 Blue, pixels 5-12, bottom row

Implementation Notes

In a nutshell, to send data to the display:

  1. Set multiplexers to the row to be displayed to.
  2. Send data via shift registers to the selected row.
  3. Loop over rows as necessary.

Setting Multiplexers

  1. Using the table above, set the multiplexer pins A0, A1 & A2 to the relevant values to select a row.
  2. Wait a short delay to wait for the output to stabilize (e.g. 5µs).

Sending Data to Shift Registers

  1. Set output enable high and latch low to begin transmission.
  2. Write data out using the SPI bus for accurate timing. I used an SPI speed of 8MHz. Otherwise, send each bit (MSB), setting the clock high, then low after each bit with a short delay.
  3. Set latch high to send the data out from the shift register to the row.
  4. Wait a short delay (e.g. 2µs).
  5. Set latch low and output enable low.

Additional Notes

  • If you see a ghosting effect, you can write a blank row after writing each row. I have done this after reading button presses so that the red artifacts from the button test patterns don’t appear on the display.
  • I have added a delay after writing data to where I start reading the buttons for that row. Writing display data too fast can result in dimmed LEDs (although maybe you want that?). From my AI companion, for a target of 60Hz, you would work out the time to wait by doing (1 ÷ 60Hz) ÷ 6 rows = 0.001388 = 2777ms. I have used a value of 1388ms as I had a flickering effect with it any higher.