An Arcade Machine of Sorts
About a month ago, I posted about testing out a P5 Panel I'd acquired during an end of financial year sale from one of my go-to suppliers. This weekend, I've had a chance now to do something a little more permanent with those panels by building an arcade machine. As my son becomes a little more interactive with things, it'll be a fun way to program a few little games for him to muck about with.
The first step for this build was to pull out my trusty old version of Sketchup 2017 and draw out a basic frame. Inside of this, some 60mm illuminated buttons from Amazon, 2 x P5 Panels and 2 x 165mm marine speakers will need to fit into the chassis. I made sure to also include the width of the MDF when measuring out the box to ensure we're not the 40mm short for the speakers to comfortably sit.
I've opted to go straight lines with this, we can use a routing bit or T-moulding to clean this up later - but otherwise straight lines are going to be infinitely easier to work with here, and will support some vertical mounting later. With each of these panels determined, it was time to go to Bunnings to find some suitable MDF. In this case, it won't be exposed to weather so the ease of working with MDF over Plywood was the deciding factor here, but you could quite easily go the Plywood route if you wanted something a little more solid. I got some 1200mm x 600mm x 16mm MDF (as T-moulding usually comes in 16mm), some red spray paint and got to work cutting the panels out.
Yeah, that lawn really needs mowing - but given how wet it's been around here, it's been near impossible to find a good enough day that won't involve mud flinging from one side to the other. That aside, once it was all cut out and sanded back to the right size, some drilling + wood screws got the box assembled pretty easily. I used a hole saw bit with the drill to get the holes in for the arcade button - taking care to drill the pilot hole first, and cutting about 50% of the way in first before finishing from the other side. The advantage of doing this is you won't end up with any chipped wood as a result of the final bit being cut off (lesson learned from a previous arcade project!). All assembled to ensure things fit, it was time to get the wood filler to patch any holes before painting.
With the components all fitting nicely, it was time to print some joiners for the screens so that they line up as good as possible, while giving me something to screw into the chassis. Thankfully, someone had already designed some joiners so I didn't have to go out of my way to design them myself. With those on the printer, I had to make a door for the back and add some hinges. With that out of the way, it was time to paint. Now, I suck at painting - I can never get the right amount of spray paint on this. I was doing well until the final coat - but overall it's a nice colour - given my son's favourite colour right now is "James".
After a few coats of paint and an overnight dry, it was time to cut the holes for the speakers out by drawing a circle around 135mm diameter. Now, I don't have a protractor but I did have a ruler with a hole and a screw - so I was able to fashion something out of a ruler, marker and screw to draw a circle. With a large drill bit and a jig saw, the hole was in place and ready for installation.
Ok! This is starting to look pretty cool, still need to wire up the buttons and speakers. To do the speakers, I'd ordered a super cheap 50W amplifier board from Amazon while waiting for some slightly better ones to come along. This would allow for the marine speakers to have enough 5V juice to make some noise. Despite some crackling, the speakers are pretty good for some cheapies from DJ City. They'll do for some outdoor speakers mounted inside some resin rocks I'm planning for later in the year! I won't link the amplifier here, but any TPA3116D2 based amplifier will work here. With that wired in, I had a few USB sound cards in use here for a Raspberry Pi Zero. As the P5 Panels need the hardware pulse that is normally reserved for audio (otherwise you get lots of flickering), it's not a problem to use whatever USB sound card you might have lying around. I guess you could use HDMI audio if you can get the right converter.
For the button wiring, I had been using the rPi-P10 controller from Hanson electronics. You can of course wire this in manually if only using one chain, but this board does include some level shifters (3.3V to 5V) that will come in handy shortly. Unfortunately, the use of the level shifters means we can't detect any button presses. After jumping on the soldering iron, I'd pulled out a small PCB, several terminal connectors, used a tall-header GPIO Pin Header (to allow hat stacking), and wired on some Dupont connectors for lighting up the LEDs for the buttons individually. In hindsight, I might have replaced the buttons with some WS2811 LEDs to control the colour as well, maybe a future project than the LEDs with resistor values for 5V.
The rPi-P10 board is wired using this diagram - so reverse engineering it, I had determined I'll use the slots reserved for the second chain for the LED lights, and the third chain for buttons. I had confirmed the pinout works per the document before cutting away at pins. In the end, I had chopped 5 legs off the stacking connector so that they wouldn't pass through to the rPi-P10 hat for the buttons, and using Dupont connectors found the right R0/G0/B0/R1/B1 pins within the second connector so I could take advantage of the 5V level shifter on this board. You could simply use a level shifter and build your own board, but this crude board does the job for now. In the coming month, I'm going to give KiCad a go for this board and check out a process using JLCPCB or PCBWay to produce and send them through. It's so cheap these days to get custom PCBs, but it would have helped here to not have jump wires all over the board.
The final step was to wire it up, write some test code to ensure the buttons all work and to have some songs and pictures show up. Impressively, this set up under normal usage sits around 1A at 5V, so this whole thing is powered for several 10s of hours from a Romoss 30,000mAh battery. I had a Raspberry Pi 4 in at the time to do some debugging with (much faster to compile), but even that kept all lights lit and the matrix running at around that 1A mark (65% brightness). Obviously, the more white on the screen and loudness of the speakers all play a part, but impressive none-the-less.
Suffice to say as I sit here on a lazy Sunday afternoon, it looks pretty awesome and kiddo loves it too. Hopefully it'll give my phone five minutes of peace while we can code some things for it such as some low-res PICO-8 games that make use of the buttons.
Building a Raspberry Pi mini rack - Part 1
Earlier this year, I managed to amass a table top full of electronics. Arduino's, Raspberry Pi's, Breadboards and components - you name it, it was covering my desk. Most of that is now packed in drawers thanks to the 3D Printing workbench I built last weekend. With a growing number of projects requiring GPIOs or just brushing up on my Kubernetes skills, I need a way to logically organise my growing collection of Raspberry Pi 4's such that they are all usable and clustered for some upcoming projects.
The obvious choice was to build a mini rack that can stack neatly on the table while doing some development work. Each Raspberry Pi would need some way to quickly identify what's going on (via an OLED screen) and ideally a few LED lights for some general purpose identification work. This rack would need it's own power and networking, ideally with the capability to add a Mobile Internet (USB) or Wireless capability for any portable or outdoor use. With this in mind, the part list is below.
- 1 x Anker 60W USB Charger - This device looks great on paper and should comfortably run 3 x Raspberry Pi 4's with it's 15W draw at full load.
- 3 x Raspberry Pi 4's - The brains of the operation - while there are plenty of limits on the cheaper Pico's and Zero's, these don't tend to have restrictions so you can find them around fairly easily. I've opted for 8GB ones to add extra room for database containers.
- 1 x TP-Link AC750 - This ended up a difficult choice. The location of the Ethernet Port and Switch sold me on this one, the USB cable for Mobile Internet can be accessed on the side so this is a bit easier to get to than some of the other more capable GL.Net devices. The lack of an extra Ethernet port for WAN is a downer, but given it's only to provide internet connectivity to the cluster, the Wireless capability will have to do. It's also compatible with DDWRT so if I find myself stuck, there are a few hacks that might help this out.
- 1 x Ubiquiti Mini Switch - This USB-C powered mini switch has enough ports to connect the 3 x Raspberry Pi's, the Router and one spare for plugging a laptop into (or perhaps another network if the TP Link device is unreliable on Wireless.
With the parts sorted, it's time to determine what kind of rack to build. There are plenty of kits around for clusters - GeeekPi Raspberry Pi Cluster Case comes up a lot. On one hand, it looks to be sturdy and portable for the Raspberry Pi's themselves but the switch, router and power pack would need some work. There are many other similar styles all centred around the brass spacers and Perspex cut-outs but they're really just bigger with more fans and LEDs in the way.
Down the reddit rabbit hole, and there are a number of different 3D print options. The Ubiquiti Mini Rack was certainly appealing from a design and function perspective especially for odd-shaped components. As I'm looking at mounting some Raspberry Pi's though, I'd need to sketch up something modular to fit. I started mocking up a few designs in SketchUp 2017. Nothing too fancy at this stage - just something that would enclose each device with some cable management and the ability to stack them as I go. Having come up with one design for the Power Adapter, things were looking promising.
I wasn't too sure about having the USB power connectors go back through the case, as you might on a proper rack - but it would at least be sturdy. Other subsequent modules would match dimensions and become smaller or taller as required. Unfortunately, with 6 modules the height would be around 24cm. That's getting pretty tall - certainly taller than my PC case for sure. A few prints later and you can see that it's starting to take shape.
The first problem: the printing process was not great. These are some early prints after getting back into 3D Printing and many mistakes were made. I had assumed, for some reason, that I loaded the ABS Black spool in but it was PLA - I wouldn't find this out for some prints in. I had set the heat setting far too high for PLA - and just slightly low for ABS. The end result was that the molten plastic effectively scorched the printing tape underneath and caused a number of problems with the printing tape being embedded in the print itself. As I printed more, the quality seemed to get worse and the temperature of the garage certainly played a part in whether the first layer would stick to the tape.
Google and YouTube were fairly unhelpful - not because the content was wrong, but what I assumed to problem to be was wrong. I had followed advice to try Blue Painters Tape for adhesion, and this worked a little better. When I finally discovered that I had loaded the wrong spool in and I set the right temperature for PLA instead, it was far easier to replace the tape and so I continued a while with it.
I had only bought the one roll of PLA and further research would suggest and prove to be a far easier material to print with. But I'd bought several roles of ABS and needed to sort that one out. With some trial and error, I eventually settled on a Glass Square (200mm x 200m) with some Hair Spray to keep the ABS plastic down, and some Aluminium Foil inside the printer to help keep the heat in during printing (this had more of an impact than I thought it would - being in a Garage, it gets very cold in Victoria!). With some manual calibration of the Printer Bed, this turned out to be the best solution for both PLA and ABS. No more tape, super easy process to follow. If there was one thing I wish I knew before starting these prints again, is what 'bad' looks like.
There were a few other prints that were frankly rubbish. The design looked horrible and function definitely wasn't as good as it could be. So I continued browsing through Reddit and Thingiverse for more ideas. I saw a recent post about the Monty rack. This thing looks absolutely amazing albeit overbuilt for my purposes - but the concept is spot on. The case uses slotted extruded aluminium for the supports and 3D Printed rackmount inserts to mount everything in place. Prices in Australia for aluminium is not cheap though and frankly at the price just for the supports - I could certainly build something like this in a more visually attractive way, such as a wall mounted cluster.
I ultimately decided not to do that (although it would have looked pretty cool with some water cooling and cables laid out on a board), and instead look at 3D Printing some supports. I would design a 2cm x 2cm design, with a trapezoid cut out to help give the screws themselves a little more plastic to help hold each face plate in place. Each 'RU' would effectively be 3cm high, and 15cm wide (11cm usable space, given the 2cm each side). The power supply will be mounted at the back, inside the rack 'square' and as such would create a nice little cube - around 15cmx16cm accounting for legs and a top (20cm if I decide to add handles).
The holes are small enough to enable some self-tapping from some leftover M3 Thumb Screws I have from an old PC Repair kit to hold the face plates in place and each end will enable some standoffs to be glued in place to hold the top and bottom 'lids' in place. I chose Black for the Aluminium extrusions, Grey for the trays to hold components in place and Red for the face plates. The design would be somewhat reminiscent of 80's style electronics.
Ok - this thing looks about 1,000x better than the previous attempt and far better than I thought it would look. The holes are the right size for those M3 screws to grip without being overly troublesome (although if I were to do this all over again, I'd probably make the holes around 0.5mm smaller again) and the sizing for the first component is spot on. I'd just need to print a tray for this to sit in, some other faceplates and the other supports. If the Raspberry Pi now fits in the rack, along with the LED Lights / Buttons and OLED screen, we should be onto a winner.
This Raspberry Pi faceplate probably took the most amount of time to get right - aligning the USB and Ethernet ports. I needed enough room to place the 4 x 3mm LEDs, 4 x Push Buttons and enough room for a 128x32 OLED Screen. The idea being that I can see what's running on each Raspberry Pi without necessarily logging in to see what's going on. If I need to reboot them, I can do it from the controller. The lights will help build and diagnose some GPIO projects and also enable the remainder of the rack to run a series of ARM-compatible containers. I would use a consistent approach for cooling via an Armour shell - if these things are running databases and Kubernetes, as well as powering a potential light show at the end of the year, then they're going to produce a fair bit of heat from each CPU.
This leads up to the end of May when I thought I might only require a Raspberry Pi 2 as the Kubernetes master node. This has changed in design since then, but to give you an idea on what a full stack would look like (and when I noticed I didn't have an extra two thumb screws), I've placed the photo below.
At this stage, I'm pretty happy with the progress but still have a little bit more to do. For starters, I'll need to wire up a screen, buttons and do some programming before finalising the PCB for the slot. Secondly, I'll need to print all supports and the cover for top and bottom.
But that's where this post will end. Until next time!