DIY Button Matrix Lights Up And Speaks I2C

[David Johnson-Davies] always wanted an illuminated button matrix for projects, but cost was never very friendly. That all changed when he discovered a cheap source of illuminated pushbuttons on Aliexpress, leading to this DIY 4×4 illuminated button matrix design which communicates over I2C. The button states can be read independently of setting the light pattern, and an optional interrupt signal gets pulled low whenever there is a change detected. Not bad for one PCB plus about $10-worth in components!

The device uses every single pin on an ATtiny88, and because each button gets its own pin the keypresses can be detected with pin-change interrupts. The state reporting of buttons over I2C is unambiguous, even when multiple buttons are pressed simultaneously. A simple protocol provides all the needed functionality, and all connections are brought to the board’s edge to allow for easily tiling multiple panels.

The GitHub repository contains the code and PCB files and [David] helpfully shared the board files to OSH Park and PCBWay for easy ordering. In addition, he provides two demos (Tacoyaki and Tacoyaki+) which are games related to the classic Lights Out to show off the matrix.

2 thoughts on “DIY Button Matrix Lights Up And Speaks I2C

  1. It looks like a well done project, nice job!

    In terms of software complexity, I wonder if the use of pin change interrupts actually provides any benefit. Since there’s a dedicated uC, the buttons could easily be read hundreds of times per second in a main loop. Unless the uC is being put into a low power mode and needs the interrupt to wake up, a poll based implementation would likely be less code and avoid a lot of potential race conditions that can occur with preemptive context switching. It’s also a lot easier to implement software denouncing. Even with a poll based implementation, power saving can be implemented after the fact by using the interrupts to trigger execution of the main loop.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.