With the software and hardware described in this repository you can play classic NES Tetris on an LED display based on the popular WS2812b led strips.
Disclaimer Script for emulator only works under UNIX-like operating systems, because of the way serial ports are accessed. Feel free to modify this to work on windows.
This repository contains everything you need to play Tetris for NES on a WS2812b LED display. This includes:
- Arduino/AVR sourcecode for driving the LED display(s) and optional score display
- Startup script for FCEUX (NES emulator)
- Lua script for streaming gameplay data from FCEUX to LED matrix display.
- Instructions on how to build the LED display(s)
- DXF files for laser cutter
You will need the following items
Playfield display measuring 20x10 pixels. Build instructions can be found in cad/
LED display driver using an Arduino board or an AVR microcontroller.
- Arduino - See
arduino/README.md
- Tested on Arduino UNO rev3 - AVR - See
avr/README.md
- Tested on ATMega8A
5 V power supply that can deliver at least 12 A. This is the minimum rated current required to drive all LEDs at full intensity.
DO NOT attempt to use USB power for this. This will damage the USB port or phone charger.
Next Block display measuring 4x2 pixel. (optional)
Score display used to show the player's score. Contains six 7-segment display digits.(optional)
Both the Arduino and AVR firmware support the Score display, however I only made schematics for the AVR version. See
avr/schematic.png
You may need to connect to different pins for your Arduino board.
You need the FCEUX NES emulator, the ledtris.lua
script and a Tetris (USA version) ROM.
Install FCEUX using your favorite package manager or download it here: https://sourceforge.net/p/fceultra/code/HEAD/tree/
Debian :
apt-get install fceux
Archlinux :
pacman -S fceux
The emulator's functionality can be extended using lua scripts. The script ledtris.lua
reads the framebuffer and the memory of the emulator and sends pixel and score data to the LED display driver via a serial port.
Script for emulator only works under UNIX-like operating systems, because of the way serial ports are accessed.
You will also need to acquire a copy of the USA version of Tetris for the NES.
Do a quick google search for "Tetris NES NTSC rom."
Optionally rename the file to tetris.nes and place it in the same directory as start_ledtris.sh
.
I only tested this with the USA version. The PAL release might have some subtle differences.
Connect the display(s) to the LED driver.
Connect the LED driver (either Arduino or AVR) to the PC.
Apply 5V power to the LED driver. (NOT USB POWER)
Start FCEUX using the start_ledtris.sh
script.
Usage:
./start_ledtris.sh [/path/to/tetris.nes]
You should now see some pixels light up on the display.
It looks a bit weird in the menus, because the lua script samples pixel colors from the framebuffer rather than looking at the game's memory for Tetris bricks. Just press the
start
button a few times to get to the actual game.
If you get a message complaining about /dev/ttyACM0
not being accessible
Find your serial port using ls -l /dev/tty*
and enter the name of
the serial port in ledtris.lua
local portName = '/dev/ttyACM0'
Also make sure you have permission to use the serial port.