Wooden LED Gaming Display Powered by Raspberry Pi Zero

67,323

908

175

Introduction: Wooden LED Gaming Display Powered by Raspberry Pi Zero

About: Old school maker doing all kinds of electronic projects. I love to play around with adressable LEDs. Raspberry Pi collector ;-)

This project realizes a 20x10 pixel WS2812 based LED display with a size of 78x35 cm which can be easily installed in the living room to play retro games. The first version of this matrix was built in 2016 and rebuilt by many other people. This experience was used to sum up all improvements to build a new version of the matrix and bring this now to instructables.com. Main new features are the update to a Raspberry Pi Zero instead using and Pi A plus an Arduino and replacing the previous large controller with a Bluetooth gamepad. Also the software was improved including the simulator, which allows you to develop the code on a computer even if you have no access to the matrix hardware.

One special feature of this LED matrix is the special wood veneer, which is used to cover the LED and to hide them, when LEDs are disabled. This highly increase the acceptance factor of non-tech people ;-) Of course, if this special veneer is not available in your country, you can also use some other diffuse material like acrylic to hide the LEDs. It is also planned to provide some key parts in the future to make it easier to rebuild the project.

Supplies

  • Raspberry Pi Zero W (with some adaption, all other models will also work)
  • 200 LED/s s (WS2812B LED stripes with 30 LED/m)
  • 4x SPI LED matrix display with MAX7219
  • Cables
  • Bluetooth gamepad (e.g. this from Pimoroni)
  • Power Supply 5V with at least 5A
  • MDF wood for laser cutting
  • Wooden veneer or diffusion acrylic plate
  • Capacitor, Resistor
  • Some screws

Step 1: Laser Cutting

Base structure of the matrix is made of MDF wood with a thickness of 3mm and cut by a laser cutter. If you do not own a laser cutter, you can use an online service like ponoko.com or formulor.de or contact the next fablab/makerspace in your environment. It is also possible to use cardboard or other lighter materials but the attached files are design for 3mm thickness, so thinner or thicker materials need a redesign of the files. Design was done in Fusion 360.
Most of the parts hold together just by sliding them in place, only some of the parts like the outer borders should be glued together using wood glue. Ensure that your matrix is fully working before applying any glue! Also the wood veneer has to be glued on, but this is the last step after ensuring that everything works.

At the right (lower) side of the backplane, there is a cut out segment to secure the electronic components to the matrix and still have access to this components when the veneer is glued on.

Step 2: Install LEDs

The LED stripes are standard 30 LED/m WS2812 stripes, which are available at Amazon, eBay or other online stores all over the world. This is normally also the cheapest addressable LED stripe available. If you want to use other LEDs, you have to ensure the 30 LED/m distance to fit to the matrix pattern. The lasercutted segments have small cut out regions to fit to the LED width of 10 cm. This LED stripes have double-sided tape on their back, so you can just glue them directly to the MDF after precise positioning. Check the correct orientation of every stripe before using the tape (DIN-DOUT direction).

Wiring pattern is a zig-zag so at the end, there is only one input pin to the matrix and cable lengths are as short as possible. To proper distribute the power and reduce the cabeling at the top of the matrix, every LED stripe is connected to 5V and GND at the bottom of the matrix. You can use either single wires or prototyping PCBs to distribute the 5V and GND line.

Step 3: Assembly

The explosion view helps to identify the correct pieces for the assembly. Just follow the step-by-step installation pictures. The backplane has cross structures to hold the long side walls and some of the short walls. If you have problems to install the pieces, use sand paper to fix it.

Step 4: Soldering

There are different ways to solder there power lines for the different stripes together. Either you can use single wires or some kind of common rail out of copper to solder the different wires. In this case, pieces of prototype PCBs were used to guide the power rails to the stripes. WS2812B stripes already have separate power cables which you can use to connect the power rail to the first stripe input (left side on the picture).

Step 5: Install SPI Display

To display game scores and text, a LED matrix display based on the LED driver MAX7219 is used. It is connected via SPI (Serial Peripheral Interface) to the Raspberry Pi. Four 8x8 displays are combined to a 32x8 pixel dot matrix display. You can buy this 8x8 pixel displays for e.g. at eBay, there are also combined 32x8 pixel displays available. Also you have different color options; in this case red displays were used. Because SPI works like a shift register, the displays are connected together in serial by connecting data out of the first matrix to data in of the second one and so on starting from the right side of the display.

This display is only readable from outside, if it is placed directly behind the veneer layer. If not, there is only a red blur visible. So you have to mount it on top of the backplane cut-out segment with a distance of 30mm between the surface of the backplane and the surface of the matrix. I have used some left over wooden pieces and screws to adapt the missing 19 mm between the backplane and the PCBs, but you can also any outer type of spacers.

Wiring of the display is shown in step 7.

Step 6: Install Pi

In this installation, a Raspberry Pi Zero is used. You can also use any other Raspberry Pi model, but newer ones with integrated WiFi and Bluetooth allow you to easily connect to wireless gamepads and simplify the programming.
You can secure the Pi by using at least two screws and small spacers to screw it to the backplane.

For the Raspberry Pi Zero W, the following pins are used:

  • PIN 2: 5V
  • PIN 6: GND
  • GPIO18 -> LED stripes
  • GPIO11: SPI CLK -> MAX7219 matrix CLK
  • GPIO10: SPI MOSI -> MAX7219 matrix DIN
  • GPIO8:SPI CS -> MAX7219 matrix CS

Some people reported issues with using GPIO18 for the LEDs. Please use GPIO21 in this case. If so, you have to change the code in line 21 to pixel_pin = board.D21.

The WS2812B strip is used here outside its spec. Normally it requires a 5V logic level on DIN, but the Pi only provides 3,3V. Even if this works in most of the cases, you should test this with your strip. If it does not work, you can add a level converter like a 74HCT245 or any other 3V3 to 5V converter between the Pi and the strip.

Step 7: Wiring and Power Supply

Wiring is done according to the wiring scheme. The power supply is a 5V DC supply.

For an easy on/off switching of the matrix, a switch is added between the power plug and the matrix circuits. Nevertheless, because the Raspberry Pi does not like hard switch off, there is a shutdown option in the software to safely shutdown the Pi via Gamepad before switching of the matrix.

The LED strip DIN pin is connected via a Resistor to the Pi, also a large capacitor (4700uF) is added to buffer the power supply. Please check out the Adafruit Überguide for Neopixels for more details.

LEDs are consuming a maximum current of 60mA per LED, so a maximum current of 200x60mA = 12A is possible!!! By reducing the brightness and not using all LEDs in full white, this is more a theoretical value, but it depends on the code which maximum current is reached. So selecting a large enough power supply is very important. For most of the applications a power supply with 5V/5A (25W) should be enough.

To fixate the backplane with the Pi and the Matrix display, some small pieces of wood can be used to scrum them in the edges and also use screws to hold the backplane in place.

Step 8: Setup Pi

1. Download latest Raspbian lite image from raspberrypi.org

2. Copy it to and SD card, 8GB is enough. You can use e.g. etcher to do this.

3. Before booting the Pi with the SD card, prepare WIFI and ssh access

4. Insert the SD card to any computer, a boot folder should be accessible

5. Copy the following lines to the file wpa_supplicant.conf (generate it if not exists) and change the parameters depending on your Wifi and region

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
country=US
update_config=1
network={
    ssid="Home Wifi"
    psk="mypassword"
    key_mgmt=WPA-PSK
}

6. Add an empty file called ssh (without any extension) to boot to enable ssh access

7. Now insert the SD card to the Raspberry Pi and boot it. Check your wifi router to get the IP address of the Pi

8. start a SSH connection to the Pi using a terminal (Linux, Mac) or e.g. Putty an Windows. Insert the IP of the Pi instead of 192.168.x.y

ssh pi@192.168.x.y 

9. Update the Pi (takes some time!)

sudo apt-get update

sudo apt-get upgrade

10. Install pip and setup tool

sudo apt-get install python3-pip

sudo pip3 install --upgrade setuptools

11. Install Neopixel driver, ws281x lib, pygame and libsdl

sudo pip3 install rpi_ws281x adafruit-circuitpython-neopixel

sudo pip3 install pygame

sudo apt-get install libsdl1.2-dev

sudo pip3 install --upgrade luma.led_matrix

12. Enable SPI by calling raps-config, navigate to 5 Interfacing Options / P4 SPI / Enable

sudo raspi-config

13. Add Bluetooth Gamepad

sudo bluetoothctl
[bluetooth]# agent on
[bluetooth]# pairable on
[bluetooth]# scan on
[bluetooth]# pair aa:bb:cc:dd:ee:ff
[bluetooth]# trust aa:bb:cc:dd:ee:ff
[bluetooth]# connect aa:bb:cc:dd:ee:ff
[bluetooth]# quit

where aa:bb:cc:dd:ee:ff is the MAC dress of your bluetooth gamepad. This address should be shown after calling the “scan on” command. Ensure that your Bluetooth controller is ready to pair, please check the manual of the controller how to do this.

14. You can now connect to you Pi via, default password is raspberry (Windows users may use Putty):

ssh pi@192.168.x.y

Step 9: Python Code, Test and Simulator

Code is available on Github. games_pi_only.py and all bmp files are needed.

git clone <a href="http://href=">href="https://github.com/makeTVee/ledmatrix/tree/master/python/pi_only</a>

The code has an option to run in simulation mode outside the Pi using pygame to simulate the matrix. This is very helpful to develop new features without having direct access to the matrix hardware. Also debugging is much easier. You have to set the PI constant to activate simulation mode (Line 15):

PI=False

In this simulation mode, alse the Keyboard is used instead of the Bluetooth gamepad. Buttons 1, 2, 3, 4 are mapped to A, B, X, Y of the gamepad, arrow keys for directions, “s” for start and “x” for select. You can use a standard editor plus the console or some integrated IDEs like Micosoft Visual Studio Code or Jetbrain PyCharm to do the development on your PC.

If you use the matrix and the Raspberry Pi, you have to define:

PI=True

To copy the code to the Raspberry Pi, you can use the scp command (Windows WinSCP). Open a console window, switch to the folder contenting the Github files and call

scp games_pi_only pi@192.168.x.y:/home/pi
scp *.bmp pi@192.168.x.y:/home/pi

then connect to the Pi via ssh (Windows users may use Putty):

ssh pi@192.168.x.y

after successful logging on, you can start the python code by calling:

sudo python3 games_pi_only.py

If the code runs correctly, you can enable autostart by calling:

sudo nano /etc/rc.local

and add the following line before exit 0:

/usr/bin/nice -n -20 python3 /home/pi/games_pi_only.py &

Save (Ctrl+O) and Exit (Ctrl+X)

Step 10: Final Test and Veneer

Before the veneer is glue on top of the front, the matrix should be tested to ensure, that all LEDs are working. It is much easier to fix something before the veneer is glued on.

The used wood veneer is a special maple veneer paper called Microwood, which is one-side covered with paper and has a thickness of 0,1 mm. The paper side can be glued directly on the mdf using standard water free paper glue.

Step 11: The Result

Have fun and enjoy the game!

Raspberry Pi Contest 2020

Grand Prize in the
Raspberry Pi Contest 2020

10 People Made This Project!

Recommendations

  • Backyard Contest

    Backyard Contest
  • First Time Author Contest

    First Time Author Contest
  • DIY Summer Camp Contest

    DIY Summer Camp Contest

175 Comments

0
MarcelR7
MarcelR7

Question 5 weeks ago

Hi,
Thank you for the super instructable.
I have a problem with the controller. I am using the 8BitDo SN 30 controller, but when I press the key „Y“ nothing happens. Is there any solution for this problem?

0
Campers death
Campers death

Question 2 months ago

Hi, thanks a lot for this asome instructable. I made it through today, just a few things to fix, pictures will follow...
I
am facing some issues with the controller, it does not connect
automatically from time to time. Then i have to delete it from the known
devices and then add it again...
Did you have had this problem too? I am using the 8BitDo SN 30...

0
cjviper
cjviper

Answer 2 months ago

I have the same problem Camper, and unfortunately I haven't found a solution. I thought it might be something to do with the bluetooth dongle I am using on my RPi 2, but tried some others and the problem persisted. Are you also using a version 2 Pi?

0
Campers death
Campers death

Reply 2 months ago

I am using the pi Zero, with builtin bluetooth.
I found that it makes a difference if you start the python script via rc than starting it as a normal user manually. I did not managed to investigate it until now...

0
maketvee
maketvee

Answer 2 months ago

Yes, I know this issue, it happens maybe every 6 month, so I did not further investigated it yet.

0
Campers death
Campers death

Tip 2 months ago

Don't know if anybody mentioned it before:
The used library for the SPI led matrix to display the hiscores etc supports led matrixes with custom "resolution".
Means that you can use the modules with 4 of led matrix displays wich are delivered already stacked and connected trough. If you use them, you do not have to solter the 4 displays together.
All you have to do is to tell the library that you have a matrix display with 8x32 pixels and the orientation.
The call for the device funtion of the SPI matrix library then should look like this: device = max7219(serial, width=32, height=8, block_orientation=-90)
Maybe you have to play around with the orientation...
Hope this will help anyone who tries to save themselves some soldering work :-)

SPI-Matrix.PNG
0
MrBulp
MrBulp

3 months ago

thank you very much for the tutorial!!

can anybody make 2 player snake ? it would be great playing snake & beat your friend! :)

im not programmer but can try to tweak other codes.. sometimes success most of times... not!... haha

anyway would be great to double the led / pixel by using 60LED per meter... & use it when needed such as for 2 Player Snake Game or space invader? ... but for Tetris, instead using 1 Led / Pixels maybe use 4 Led / Pixels so it would be not scale down too much & still the same appearance to fit the width of frame nicely...

just my 2 cents. let us know if someone tweak it...

note : i cant import the short_side.dxf (broken file?) into inkscape but the rest of files is ok.

another note : i cant seem change the resolution in simulation, got error something.. not yet get the led so simulation should be good for start right?

cheers

0
prusteen
prusteen

4 months ago

I really wanted to make this, and I was really looking forward to it, but there are just many things that are unclear. The materials do not have all of the materials, as I saw a switch and wood glue were needed in future steps, and the diagram showing how many of each part to buy did not show how many of border_long and border_short to buy. "Some screws" in the materials is also vague, so in general I wish some links could be provided so that I can have an easier time buying all of the materials. Can you please help me? Thanks in advance.

0
maketvee
maketvee

Reply 4 months ago

- 2 border_long, 1 border_short
- a power drill, a file and any switch which is able to switch 6 amps
- some small wood screws (e.g 10 mm length) which you probably have in your workshop

0
tx85
tx85

4 months ago

Great project! I really enjoyed reading through the steps and i'm already rolling up my sleeves and getting down to work.
Just to put my little grain of salt, I've drawn a short animation that can be shown up in the boot-up instead of the static RB logo.
Images should be placed where the current 1.bmp splash screen is located, and the code could be something like:
_
for count in range(1,19):
thisone = (str(count) + ".bmp")
drawImage(thisone)
time.sleep(0.08)
time.sleep(1)
_
Thanks again for sharing this amazing project! Keep up the good work!

1.bmp2.bmp3.bmp4.bmp5.bmp6.bmp7.bmp8.bmp9.bmp10.bmp11.bmp12.bmp13.bmp14.bmp15.bmp16.bmp17.bmp18.bmp
0
maketvee
maketvee

Reply 4 months ago

Thanks, that's a good idea! Also it's possible to start the code as a service, so it is executed directly after system start and there is some additional time to play some nice starting animations while waiting for the system to be booted. I'll put this on the list for the next iteration.

0
tx85
tx85

Reply 4 months ago

Cool! In case you have any specific ultra-low-res animation in mind just let me know and i'll be glad to draw the frames!

0
tx85
tx85

Reply 4 months ago

@YueR2 - Congrats, it really looks so cool! 太棒了!
Did you replace the Raspberry for some other device or did you just add extra code and a microphone to monitor the room sounds?
I would really appreciate some guidance regarding this, since I am planning to build this project and it would be great to add this feature while keeping the games and also the clock.

0
maketvee
maketvee

Reply 1 year ago

Awesome, thanks for sharing the video!

0
Blechi100
Blechi100

Question 6 months ago

Hi everyone,

i started to asamble this project 2 days ago.
I tried to test it with the simulation mode but nothing happens exept a few error mesages. Please have a look at the Screenshot attatched.
Can someone maybee help me??

Kind Regards

2021-01-15 00_54_13-pi@raspberrypi_ ~.png
0
cjviper
cjviper

Answer 6 months ago

Have you tried not running with sudo?

0
andy51055
andy51055

7 months ago on Step 11

You can use ordinary veneer (which is usually 0.8mm thick, apparently) for this. At Leeds Hackspace we have an LED temperature readout that is perfectly visible behind a sheet of ordinary pine veneer we had lying around. It may be a little fuzzier around the edges, but not much. And loads easier to get hold of.

0
MarcelS9
MarcelS9

Reply 7 months ago

You can get veneer in all sorts of thicknesses; anywhere between 3mm and 0.6mm.

The issue usually is that it's limited in width. It can't be winder than the board it was cut or shaved off from; usually around 10-40cm. Manually joining individual pieces can be a bit tricky for the inexperienced.

You /can/ get veneer in larger dimensions if it was shaved off an entire log in a rotary fashion (like on a giant wood turning machine). However, such type of veneer usually goes into plywood-style products as it has absolutely no decorative grain.