LED the Games Begin

The secret is out! bitluni has revealed how the Megaplex game console drives a display made of 240 LEDs with a 10-cent microcontroller.

Nick Bild
10 days agoDisplays
The Megaplex gaming console has a very unique display (📷: bitluni)

You may have already heard about bitluni’s tiny handheld gaming console called the Megaplex by now, but how it works is a whole different discussion. As a refresher, the Megaplex mini console uses 240 miniature surface-mounted LEDs in a 16 x 15 matrix as its display. Similar handheld gaming consoles, like the Arduboy, typically use a small OLED display that can be controlled via SPI or I2C using just a few control pins. Controlling 240 individual LEDs, on the other hand, requires a whole lot of control pins.

Or does it? In a new video just released by bitluni, an important technique called Charlieplexing was discussed at length. Whether this is a new concept for you, or something that you could use a refresher on, it is worth checking out. It was through the use of Charlieplexing that bitluni was able to control hundreds of individual LEDs with just 16 pins on an inexpensive WCH CH32X035 RISC-V microcontroller. No additional active components were required.

As is discussed in the video, Charlieplexing is a clever technique that exploits the bi-directional nature of GPIO pins to significantly increase the number of LEDs that can be controlled with a given number of pins. It optimizes pin usage by arranging the LEDs in a matrix-like configuration and utilizing the fact that GPIO pins can be both sources and sinks of current.

By selectively setting the state (input/output, high/low) of these pins, it is possible to selectively control which LEDs illuminate and which remain off. This is achieved by applying a voltage across specific pairs of pins, or setting pins to a high-impedance state, effectively turning on the desired LED while leaving other LEDs in the same row or column switched off. By cycling through different combinations of pin states rapidly, a microcontroller can turn a large number of LEDs into a display using only a few pins, as was done with the Megaplex.

Even on a cheap microcontroller like the CH32X035, Charlieplexing was able to achieve a frame rate of about 23,000 per second in 1-bit color mode. When using 8-bit grayscale color, a frame rate of 90 per second was demonstrated to be possible. And since frame rates this high are very rarely necessary, there are cycles left over for other things, like game logic. A snake game and an early version of a jump-and-run game have been developed for the Megaplex, and bitluni also showed off a video of Bad Apple!!, complete with sound from a buzzer.

For most use cases, there may not be a lot of practical value in using a large grid of LEDs as a display, with much better, simpler, and less expensive display options available. But hardware hackers do love their blinkenlights, so Charlieplexing is definitely a technique to be aware of. It could shave a whole lot of complexity off of a future project!

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles