Here are some further insights learned in the building of one particular cube. This one was heading to a maker convention and would be seen and handled by many over the course of a day, thus needs to be extra durable and with extended run time.
Miscellany
For added robustitude, before anything else, the edge frame magnets were set in place using 5-minute epoxy. Be super extra careful that the polarity is correct…there’s no do-overs! Proceed in small batches a few at a time and keep the pieces spread well apart. Even from a few inches away, these magnets will pull each other from their sockets! Also, “5-minutes” is the working time, but the epoxy is still pliable, so allow 30–60 minutes between groups.
Four magnets were intentionally left off the last face. This would serve as the “access door” and needed to be less grabby. It’s still very strong, and even two magnets near opposite corners might suffice.
The end plug from a spare ribbon cable was sacrificed to create a pull tab for opening the cube. This plugs into the “out” header of the last matrix in the chain — our access door.
Looked at using the Electrodragon RGB LED Matrix Panel Drive Board — which can drive three matrix chains in parallel (e.g. 2 matrices each), reducing flicker — but it hangs quite a lot over the edge of the Raspberry Pi board and wouldn’t fit inside the smaller cube. For a larger DIY cube, it’s something to consider!
With some patience, careful ribbon cable folding and right-angle USB cables, it’s possible to fit two USB power banks inside the cube. Over six hours of run time is possible!
CAUTION: some USB cables (like the braided one here) have metal plug housings, which could cause a catastrophic short if it shifts and contacts the wrong part of a matrix. This will get covered with tape, or better yet replaced with a plastic-bodied cable.
Originally one battery was dedicated to the matrices, the other to the Pi. Turns out the matrices use substantially more power. Moving two matrices over to the Pi battery (via the Bonnet’s screw terminals) made for a fairly balanced load, improving run time by 50%.
Consider this just a napkin-sketch schematic…neither a precise layout nor complete bill of materials…it’s merely to illustrate how power is split from the two battery banks to the Pi and matrices. Some improvised cobbling of parts and wires is needed!
We can get away with splitting power like this because the ribbon cables along the matrix chain include several ground lines; the two circuits have a common point of reference.
To save space, instead of bus bars, a section of Perma Proto board was used to distribute power to the matrices, then sealed in heat-shrink tube. Wires were clipped extra short…just long enough to reach across the cube…but one pair was left a bit longer for the access door to swing open.
This photo is from the early “all matrices on one battery” stage, hence the large number of wires. Two matrices were later moved to the screw terminals on the Matrix Bonnet.
A second USB-to-DC-barrel cable was used, connecting to a DC-socket-to-screw terminal adapter to power four of the matrices. Heat shrink tubing and hot glue provide insulation and strain relief.
Cutting a few inches from a USB cable and connecting that to the matrix power distribution is also an option, but I didn’t feel my soldering and heat-shrink skills were up to the task.
A few strategic dots of hot melt glue keep cables in their sockets. Normally hot glue is “the wrong adhesive for any job,” but a redeeming property is easy removal later…touch it with a cotton swab dipped in alcohol, and it pops clean off.
Raspberry Pi Setup
Running in its default configuration, and seated between those LED matrices, the Raspberry Pi 4 can get incredibly hot. This leads to thermal throttling (the Pi slows way down to cool off), causing the LEDs to visibly flicker. And it’s nearly hot enough to burn fingers when reaching inside to power off. Underclocking the Pi just a little — 1.2 GHz instead of the default 1.5 — plus some LED tweaks below, are sufficient to keep it running at a steady rate, and safe to touch (warm, but not dangerously so).
These lines went in /boot/config.txt:
arm_freq=1200 gpu_freq=400
If there’s an arm-boost line in there, comment it out!
#arm_boost=1
These settings are specific to the Pi 4. Earlier boards aren’t likely to run so hot…or if they do, would need different clock settings. This would take some experimentation.
With the CPU throttled down, the --led-gpio-slowdown
argument for the software can be adjusted down to keep the matrix refresh peppy.
One more step both to reduce the interior temperature and improve battery life is simply to turn down the brightness…sometimes a little, sometimes a lot. In fact, when initially testing with a single battery, even half brightness with certain globe images would lock up the Pi due to brownouts. The fade-in effect available to some of the demos…originally there just to look cool…actually helps us here by avoiding sudden surges.
Here’s a demo loop script that worked, cycling between sand, life and globes:
#!/bin/sh set -- --led-slowdown-gpio=2 --led-pwm-bits=9 --led-brightness=80 while true; do timeout 20s /home/pi/Adafruit_PixelDust-pb-multiplane/raspberry_pi/cube $@ /home/pi/Pi_Matrix_Cube/globe $@ -e 128 -E 132 -a 3 -t 15 -f 1 -i /home/pi/Pi_Matrix_Cube/maps/earth.jpg -v --led-brightness=60 /home/pi/Pi_Matrix_Cube/life $@ -t 15 -f 1 -k 2 timeout 20s /home/pi/Adafruit_PixelDust-pb-multiplane/raspberry_pi/cube $@ /home/pi/Pi_Matrix_Cube/globe $@ -e 128 -E 132 -a 3 -t 10 -f 1 -i /home/pi/Pi_Matrix_Cube/maps/boing.jpg --led-brightness=20 -s 5 /home/pi/Pi_Matrix_Cube/life $@ -t 15 -f 1 -k 1 timeout 20s /home/pi/Adafruit_PixelDust-pb-multiplane/raspberry_pi/cube $@ /home/pi/Pi_Matrix_Cube/globe $@ -e 128 -E 132 -a 3 -t 15 -f 1 -i /home/pi/Pi_Matrix_Cube/maps/adafruit.jpg -s -5 done
This was placed in the file /home/pi/Pi_Matrix_Cube/cycle.sh
The “set” line configures a few things globally for all programs, then each one provides its own additions or overrides.
Notice the absolute paths to everything, even the image files. That’s because it’s going to run as root (not pi) on startup, using the systemd service.
This process is already explained on the Auto-Start on Boot page…so if you’ve already done that, you just need to modify the service file. The only change here is we’re calling a shell script rather than one specific demo. If you don’t yet have that, create a service file like so:
sudo nano /lib/systemd/system/cube.service
…containing the following lines:
[Unit] Description=Cube Service After=multi-user.target [Service] Type=idle ExecStart=sh /home/pi/Pi_Matrix_Cube/cycle.sh [Install] WantedBy=multi-user.target
Again, absolute path to the cycle script.
Save changes to the file, then activate the service using:
sudo systemctl daemon-reload sudo systemctl enable cube.service
On next boot, the script should start automatically. If it doesn’t, it’s likely a typo in the file or commands.
After ample testing and tweaking, the Pi was was then configured for read-only mode, as explained in this guide. This allows simply cutting power (or battery to fully run down) without a formal system shutdown. Do this as a penultimate step after demo changes are finalized, because files can’t simply be edited afterward. That requires unwinding the read-only steps, rebooting, editing files, then reinstating read-only mode. A chore!
The last last step was to make a backup of the SD card. These things do fall out if jostled, and a ready spare might save your bacon!
These LED matrices are notoriously fragile, and one must handle an assembled cube carefully with flat palms, otherwise corner and edge pixels could get sheared off. You and I understand that, but the public at large does not.
So…a custom laser-cut acrylic box holds this cube, providing an unobstructed view while protecting those delicate edge pixels. There’s a couple millimeters clearance all around, so the LED cube can slide in without shearing off pixels. There’s nothing “clever” in the box’s design, but it does the job.
The files below are in Adobe Illustrator format, but other software (such as the free Inkscape) can also read these.
This box is for the smaller cube only, but with a little editing might accommodate the larger cube by rubber-band selecting the points along each edge and scooting them 16 millimeters outward (bigger cube is 32 mm larger on each axis). The scoot (rather than scaling) keeps all the slots and tabs aligned and the internal clearance and 3mm thickness intact.
This file is for the sides of the box. Cut four copies; they’re identical. 141×141 mm. One edge has a protruding tab that aligns with a corresponding notch on an adjacent piece.
This file is the top and bottom of the box. 141×141 mm. Laser cut two copies. One will be affixed to the four side walls, the other is left unconnected.
Our box used bog standard 3mm (1/8") clear acrylic. Consider anti-glare or scratch-resistant acrylic if you want to get ~fancy~. As much as we love black LED acrylic, it would be a poor choice here! There’s a necessary clearance to the box dimensions, and the resulting shifting of the cube inside would cause some faces to be blurry.
Assembly
Laser-cut, peel, rinse and fully dry all six faces. Set aside the top piece so you don’t inadvertently seal the whole thing shut. Work with just the acrylic for now; the LED cube slides in later.
Puzzle out how the remaining five pieces fit. The “+”-shaped piece is the bottom, while the four sides have keys that align one to the next. Hold everything together temporarily with rubber bands or masking tape. As you start joining pieces, you’ll need to move some bands to a different direction or remove tape from one edge at a time.
Some options for joining the edges:
- Transparent sticky tape. Not the most durable but it’s cheap and might suffice. Run a strip down a whole edge, trim the ends with a hobby knife, then rearrange the bands or tape to expose the next edge, one at a time.
- Acrylic cement. This is considered the Good and Proper Way to join acrylic. It’s a little toxic (follow precautions on bottle) and takes patience, as each edge should be done one at a time and allowed to fully set up. Use a sable brush or tiny syringe and capillary action. You MUST clear any bands or tape away from the edge being glued, else it will seep into anything and ruin the pristine face of the cube.
- UV-curing resin. A kit with a bottle of resin, ultraviolet flashlight and UV safety glasses runs about $20. Squeeze a pea-size drop near an inside corner and patiently allow gravity to do the work, then cure for one minute using the UV flashlight before moving on to the next edge. Like the acrylic cement, keep bands and tape away from the edge being glued. Once all eight edges are done, the bands/tape can be removed and the box set out in the sun for an hour or two to ensure it’s fully set up.
Carefully slide the assembled cube into the acrylic box, stopping if there’s any hint of resistance. The “access door” face of the cube should align with the open face of the box. It might be easier to turn the cube over and lower the box over it.
The top face is then held on with clear sticky tape. A long piece along one edge forms a hinge, and a couple shorter pieces on the opposite edge hold it shut temporarily. More durable would be to run long strips down all four edges, understanding that it will take some work to get back inside and power it down. Bring the tape dispenser with you and keep an eye on that tape, in case it wears down with all the handling. Can also use the tape to temporarily repair glued edges if they should crack apart.
Clear rubber feet on the bottom face are nice but optional.
Presentation
“Are they heavy? … Then they’re expensive, put ’em back.”
— Donald Genarro, Jurassic Park
The accelerometer sand demo in particular just screams to be handled, and no passers-by are denied that pleasure. With the acrylic enclosure, the cube is reasonably well protected. There’s a little extra step we can take though…
Might carry it around with white inspection gloves. These aren’t really there to protect the cube, which will be handed around to bare-fingered folks. The gloves are for two things…
- Rubbing off fingerprints so the cube’s always appealing and shiny.
- Without a word, it tells others “this is a treasure, please handle it kindly.”
Theatrics, really.
The cube contains around $500 in parts, and that’s before the Raspberry Pi 4 got jacked up in short supply. There’s also tremendous work and love putting this together.
Not expecting it to walk away at an upstanding convention…but other times, like in a parked car, smash-and-grab crime is rising. As an experiment, trying an Apple AirTag inside the cube…these are tiny and can fit in any remaining crevice. It remains to be seen whether this can even function through the LED matrix PCBs, so this will be a Learning Experience. Since the AirTag is metal on one side, it goes in a small ziploc bag to avoid shorting anything inside the cube.
Page last edited March 08, 2024
Text editor powered by tinymce.