Main Content

Illuminated Button Matrix

This article describes a 4 x 4 matrix of illuminated pushbuttons with a two-wire I2C interface, controlled by an ATtiny88, that you can use for games, music, or control applications:

You can independently set the state of the lights, or read the buttons, via I2C. I’ve included a demo program for the Arduino Uno that uses the Button Matrix to play a puzzle game called Tacoyaki.

Introduction
I’ve been wanting to build an illuminated button matrix for some time, as an interface for games and music, but ruled it out as being too expensive. However, I revived the idea when I saw illuminated pushbuttons available cheaply on AliExpress [1]. The buttons are available in a variety of colours; I chose white. My final 4 x 4 Illuminated Button Matrix costs under £10/$10, excluding the PCB.

I wanted the button matrix to be free from ghosting; in other words, you should be able to press any combination of keys and read their state unambiguously. Also, pressing the buttons shouldn’t affect the display of the LEDs. This is especially important for music applications; for example, so you can play chords.

Originally I tried designing it using the HT16K33, which is the approach used by Adafruit in their Trellis product [2]. However, it’s not really a good fit to a 4 x 4 matrix; it requires diodes to get it to work without ghosting, and reading and writing the state via I2C is messy. I finally realised that the control could be achieved very simply using a low-cost AVR processor.

I chose the ATtiny88 which is ideal for this application because it has exactly the right number of I/O lines, and includes hardware I2C support. It lets you read the 16 buttons with no ghosting, and without needing any diodes.”

Link to article