close-circle
Close
0%
0%

Raspberry Pi Retro Gaming LED Display

20x10 WS2812 LEDs driven by Raspberry Pi/Arduino to play games like Tetris in the living room

Similar projects worth following
close
I am building a retro gaming display for my living room to play games like Tetris or Snake with a wireless controller while I am sitting on my sofa. 10 columns of WS2812 LED stripes are integrated in a lasercutted MDF frame, which is covered by a transparent wood veneer. The heart of the system is a Raspberry Pi A+ which is integrated in the MDF frame. This Pi is connected to an Arduino driving the LED stripes. Four 8x8 Matrix displays are combined to a highscore display which is also connected to the Pi via SPI.

The wireless controller is based on an ESP8266-IoT-board, which connects to the Pi over Wi-Fi. A Joystick and four Arcade buttons are used for game controlling. The controller is powered by a LiPo and could be charged by a microUSB connector.

Based on the python_games package coming with Raspbian, all games are written in Python.

This project was inspired by Türtris: https://hackaday.io/project/3708-t

Check the videos on Youtube

ledmatrix.pdf

Schematic

Adobe Portable Document Format - 13.96 kB - 06/12/2016 at 14:51

eye
Preview
download-circle
Download

matrix_cad.zip

CAD files for MDF matrix

Zip Archive - 306.31 kB - 05/04/2016 at 15:44

download-circle
Download

  • 1 × Raspberry Pi A+
  • 1 × Arduino Pro Mini
  • 200 × WS2812 LED (stripes 30 LED/m)
  • 34 × Lasercutted MDF
  • 1 × Joystick

View all 7 components

  • Controller details

    makeTVee03/04/2017 at 07:47 0 comments

    I have uploaded the Arduino sketch of the ESP8266 based controller to Github.

    Wiring is pretty simple, using a Sparkfun Thing and a single cell LiPo.

  • Schematic

    makeTVee06/12/2016 at 14:58 0 comments

      The schematic is now available. There are only three relevant connections:

      1. UART between Pi and Arduino (connected DTR-pin for programming the Arduino firmware from the Pi), with a simple voltage divider for 5V to 3.3V conversion
      2. SPI for the MAX7219 matrix display
      3. Serial connection from Arduino to the WS2812 stripes

  • Android app control

    makeTVee05/26/2016 at 20:40 1 comment

    Instead of the retro controller there is also a small Android app for game control. It provides the same functionality, so no additional controller hardware is needed if you already have an Android device.

    There is a video on Youtube showing the app in action:

  • Github

    makeTVee05/12/2016 at 19:33 0 comments

    Python code and Arduino sketch now on Github. I will add more documentation how to use the code within the next week.

  • Veneer application

    makeTVee05/11/2016 at 19:24 0 comments

    In reply to a comment, I will describe how to apply the veneer paper to the MDF matrix. The veneer I have used, is called Microwood, which is a 0.1 mm veneer with paper backing.

    Before the final full-surface bonding onto the MDF matrix, I did some pre-testing with the glue and the surface preparation of the MDF. To avoid paper curling after the adhesion, I used a solvent based all purpose adhesive (UHU black), which worked as expected. For testing purpose, the black laser cutting edge on the MDF surface was removed with sand paper:

    The following image shows the veneer glued on the MDF sanded off (right) in comparison to the veneer glued on the more or less black MDF. For me, this difference was not enough to polish all the MDF parts and the final result proved me right.

    Because of the paper backing, it is quite easy to apply the veneer and there is no problem with dissolving, although the veneer was rolled up when it arrived.

    If you have any questions, leave a comment.

  • CAD files

    makeTVee05/04/2016 at 15:49 0 comments

    I have now uploaded the DXF files of the MDF matrix. I have used 3mm MDF. The next version will be a combination of MDF and cardboard to save some cost.

  • Weather forecast

    makeTVee04/27/2016 at 19:42 1 comment

    Running Python code on the Pi makes it so easy to realize new features. This is a quick preview of getting a weather forecast on the LED matrix. Using PyOWM to talk to OpenWeaterMap and some 10x10 pixel weather icons, that's it.

    Planned features:

    • animated icons
    • 7 day forecast (slideshow)
    • Barbecue forecast

  • Hard- and software overview

    makeTVee04/17/2016 at 11:59 0 comments

    Architecture

    There are 3 software components in the system:

    • Arduino firmware for driving the WS2812 LED stripes
    • ESP8266 firmware (Arduino sketch)
    • Python scripts for the Raspberry Pi

    This image gives an overview of the system:

    WS2812

    There exists an option to directly drive the WS2812 LEDs from a Pi with the dpi_ws281x library. But I decided to use an Arduino, so it is possible to use the LEDs even during the Pi's boot process or without booting the Pi. Arduino and Pi communicate via UART at a speed of 500kbit/s, which is quite enough for a smooth gameplay.

    Text display

    The MAX7219-Matrix displays (e.g. available at eBay or direct china import) are driven by a great existing library, which provides text scrolling and direct pixel access via Python. I used four 8x8 matrix displays in a cascaded setup. For the Tetris highscore display, I build my own small font for 6 digits and enough space for displaying the next piece for the game. 6 digits are needed to realize the original Gamboy Tetris scoring.

    Audio

    There is an integrated speaker driven by a mono amplifier (from Adafruit), which is connected to the analog audio output of the Pi.

    Raspberry Pi

    The Raspbian distribution includes a set of Python games in the folder python_games (doc of Python Games) which are based on the pygame lib. I replaced this library by my own display driver to directly drive the 20x10 LED matrix, but reused the gameplay for Tetris and Snake. For development purpose, I wrote a simulation version which still uses the pygame lib to write and test the code on a PC/Mac before transferring it to the Pi. Some screenshot of the simulator:

    There is also a simulator for the controller using the arrow keys of the PC to control the simulator or the LED matrix

    I will publish all the code soon after some code cleanup.

  • Building process

    makeTVee04/15/2016 at 18:08 0 comments

    Matrix construction was done in DesignSpark Mechanical (Free CAD tool from RS, win only :-( )

    I used the Lasercutting service offered by Formulor.

    10 LED-stripes with 20 LEDs of each (WS2812, 30 LED/m) were placed on the backplane before putting all the pieces together.

    First test after assembling:

    In the lower section, all the electronic is placed but still can be removed from the back side even after placing the veneer.

    Finished matrix with veneer surface:

View all 9 project logs

Enjoy this project?

Share

Discussions

ymmas wrote 10/02/2017 at 12:42 point

Hey.

I found your project by reading much about led coffee tables. And now i am building my own table and i would like to use your code. Later i hope i can integrate the table to fhem.

My matrix is  24 X 14 and i use ws2812B, a raspberry3 and an arduino nano. I set the baudrate up to 1.000.000.

My problem seems like the same from grim, posted  03.07.17 in his gallery.
You were ready to betray, how do you make the android app?

Sorry for my bad english :)

  Are you sure? yes | no

makeTVee wrote 10/17/2017 at 18:39 point

please send me a pm and I will send you the android app.

  Are you sure? yes | no

zombinary wrote 09/29/2017 at 20:50 point

Very nice Porject, but i have many problems to run the phyton scripts on my rpi zero.
This is my first contact with python an the 'controller_sim.py' returns an 'segment fault'. Also it is not possible to run the 'games_pi.py' script. The library 'socketserver' isn't found and i could not install the module PIL.

I using an pi zero W with '2017-09-07-raspbian-stretch-lite.img'


Has somebody run this script on pi zero?

  Are you sure? yes | no

makeTVee wrote 09/30/2017 at 16:24 point

controller_sim is a simulator to test the code on a PC, so not needed for running the code on a Pi. 

Please use python3 for socketserver. 

  Are you sure? yes | no

Grim wrote 07/15/2017 at 02:44 point

Hello, it's me again. Good news is that I finished the project in time. Here is a picture if you're interested with how it turned out: http://imgur.com/a/Kg2ey

For some reason I cannot reply to the other comments. However I had a question about the "boot logo" that the teensy displays during the Pi's boot. How did you create that? I am looking to change it however I'm not sure why but when I change the code, I get a crash. Thanks.

  Are you sure? yes | no

makeTVee wrote 07/15/2017 at 06:16 point

That's awesome! Thanks for sharing the image!

For the boot logo i have used GIMP, because it has an option to export c files (.c or .h). Afterwards you can edit the image in a text editor.

  Are you sure? yes | no

Grim wrote 07/15/2017 at 19:25 point

Thanks, eventually I want to have more games and whatnot added. I've been thinking about pacman but haven't figured out how I'd do it. I downloaded gimp and I've exported a picture both to .c and .h however I am not getting the hex values as you did. This is what I get: 

Again thanks for the help.

  Are you sure? yes | no

makeTVee wrote 08/07/2017 at 18:13 point

I am back from summer vacation, sorry for the delay. It's been a long time ago, maybe I'm wrong. I tried gimp for sure, but maybe later I used a different tool to convert RGB bin data to Hex string, ending up with tools like Matlab/Octave or something else. If I find the tool again, I'll let you know. 

  Are you sure? yes | no

Grim wrote 03/09/2017 at 14:39 point

hey man, really liking your project! I'm currently building a 32x32 Matrix very similar to yours and came across your project after I've already started. I've decided to use your program to run the matrix as a main goal of this was able to play pong, Tetris, and snake. Which yours does! However I'm having some issue with the code. When I play Tetris, the shape will show the entire time going down the board but after it lands, the shape disappears. It only does this for the first 12 or so led rows. Also the clock does not show properly. I've added links to 2 gifs that show the issues I'm having. If you'd be willing to help that'd be great. I'm only using a 16x32 panel right now as I'm working on the build part of the matrix. Your help is greatly appreciated

https://imgur.com/gallery/TNEEA

  Are you sure? yes | no

makeTVee wrote 03/10/2017 at 15:35 point

Did you changed in simulation mode first? I will test it over the weekend and come back to you soon.

Could be a timing issue, because you have 2.5x more LEDs. Are you using the same PI/Arduino setup at 500kbaud?

  Are you sure? yes | no

Grim wrote 03/11/2017 at 00:23 point

What do you mean changed in simulation mode first? If you mean tested, I changed the values however they did not reflect in the simulator. Snake works properly and uses the entire board. It is just the other ones that I am having issues with. I have yet to add the 4 8x8 LED's. Here is a screenshot of my options:


Also, I am currently using an Arduino Mega and RPi3. I was originally intending to use the teensy 3.6 however your provided sketch is not compatible with the teensy 3.6.

  Are you sure? yes | no

makeTVee wrote 03/11/2017 at 15:46 point

Did you changed the pixel values in the drawBoard function (line 1042)? 

  Are you sure? yes | no

Grim wrote 03/13/2017 at 18:28 point

good news: somehow got the teensy to work so switched to that and it fixed most my problems. Now I just have to resize the various components. Pong doesn't use the proper borders and I can't find in the code where it specifies the borders. Also I can't change the clock size, I get a crash every time. Not sure if I'm changing them right

  Are you sure? yes | no

makeTVee wrote 03/21/2017 at 19:09 point

Pong does not scale yet, sorry for the code, it was really quick and dirty. For changing the clock size, you have to change the font via the clock_font array. How is your progress? 

  Are you sure? yes | no

JM wrote 02/27/2017 at 11:51 point

Hi makeTVee,

this is really great stuff!!!

I´m very interested in your controller. 

Can you give me some details on wiring and code?

br

  Are you sure? yes | no

makeTVee wrote 02/28/2017 at 19:56 point

Hi JM

thanks and good point, I will add this information shortly to the log/github

  Are you sure? yes | no

bvanasselt wrote 11/16/2016 at 20:34 point

Hi - Thanks for sharing!  Working on something very similar with my son for a Christmas project.  Any chance of posting any of your code?  Would give us a great starting point for our own project - this is, by a mile, the most ambitious project we've undertaken and we're a bit in over our heads. 

Either way, thanks again for sharing!

  Are you sure? yes | no

makeTVee wrote 11/16/2016 at 22:36 point

Sounds great, you will find all the code on Github: https://github.com/makeTVee/ledmatrix

  Are you sure? yes | no

bvanasselt wrote 11/17/2016 at 22:20 point

Thanks!  I see now that you had already posted that link.  I don't know how I missed it.  Sorry about that.  Thanks anyway for the fast reply!

  Are you sure? yes | no

anders wrote 07/11/2016 at 21:07 point

I have been looking for a project like yours for long time!
I'm pretty new to Raspberry Pi. Is there an easy way to connect controller directly without having to change too much code? Instead of wifi.

  Are you sure? yes | no

makeTVee wrote 07/12/2016 at 18:21 point

Sure, you can connect a keyboard or gamepad to the Pi via USB. Then use the event system from the pygame lib which I have used in the controller_sim.py. 

Only small changes in the code are necessary, if you tell me your controller type, I will provide you some example code.

  Are you sure? yes | no

Wverish wrote 06/03/2016 at 14:34 point

All these projects are very interesting. So much talent, so many great ideas.

  Are you sure? yes | no

stevemoseley wrote 06/03/2016 at 13:23 point

Any updates coming soon?  Would love to get more detail on this.

  Are you sure? yes | no

makeTVee wrote 06/05/2016 at 10:25 point

Quite busy these days, next updates will be a schematic and some details regarding the MDF frame and a more detailed part list.

  Are you sure? yes | no

stevemoseley wrote 06/06/2016 at 00:04 point

Fantastic.  Looking forward to it.

  Are you sure? yes | no

stevemoseley wrote 05/13/2016 at 15:41 point

I've been looking for details for building something like this.  Looking forward to seeing more about it and diving into the details.

  Are you sure? yes | no

makeTVee wrote 05/18/2016 at 14:53 point

Sounds great, do you have an idea regarding the overall size and the number of leds for your project?

  Are you sure? yes | no

stevemoseley wrote 05/18/2016 at 16:43 point

Similar size to your project.  Just wanting something large that can be on the wall.  I was thinking a 5 to 6' tall field.  I was considering trying to program something that was only on an Arduino, but that might be a bit of a challenge for me.

I love the added score and next piece at the bottom.

I would like to have it switch between an LED clock mode and Tetris mode when not being played.  You could have the time rotated 90 degrees or have the hours stacked on top of the minutes.

Will you be adding more detail to the build?  I was hoping you would get it to the point that others would be able to use the information to build their own.

Thanks!

  Are you sure? yes | no

makeTVee wrote 05/19/2016 at 07:05 point

Sure, I will add more details for rebuilding. But during this process, I will also fix some issues from the first version, so it will take some time. 

And there are also some new features in the pipeline ;-)

From the programming side, it would be the easiest way to combine the Raspberry Pi with one of the availiable Arduino addon boards for the Pi and slightly adapt my software.

  Are you sure? yes | no

stevemoseley wrote 05/19/2016 at 18:38 point

MakeTVee - That would be great.  I look forward to the next improved version.

Thanks for your input.

Another thought I had was mounting the LED board on a swivel in the center so it can be rotated 90 degrees.  Might make using it as a digital clock a little more appropriate in landscape mode.

  Are you sure? yes | no

mclien wrote 04/25/2016 at 20:44 point

I would like to see a log with abit more detail about the veneer apply method, any fotos/ docu about that?

And a question (for the next Türtris Version) :  How  good is the length tolerance of the LED strips (how much difference after 1m/ 5m)?

  Are you sure? yes | no

makeTVee wrote 04/27/2016 at 16:24 point

I will address this veneer topic in one of my next logs. 

The length tolerance is an issue, there is an offset of minus 2-3 mm/m, but this offset is quite constant. 
For these longer strips, 50cm-strips are soldered together and there is some overlapping at the connection point. Might be avoided by re-soldering these points.

  Are you sure? yes | no

makeTVee wrote 05/11/2016 at 19:28 point

Now there is a log focused on the veneer topic. Hope that helps.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates