Zelda Link to the Past RGB Matrix Clock
by Lotek in Workshop > 3D Printing
4530 Views, 66 Favorites, 0 Comments
Zelda Link to the Past RGB Matrix Clock
3/17/22 UPDATE! My Etsy store is finally online, and i'll be making these clocks for the foreseeable future. The only caveat is that i have to exclude the Raspberry Pi (3B/3B+) from being included because of the current supply chain issues. The only other thing you will need is a 2.5mm hex wrench, and the installation is quite easy.
3/1/22 UPDATE! I should be up and running soon, so stay tuned! I have a Twitter and a Discord server up and running, and you can find the links to those on my website https://lotekdesign.net/
2/15/22 - Notice! This project is my first complete tutorial ever. So if there is something that i haven't explained fully or you need help, i would love your feedback <3 Attempts were made.
I took some interest in RGB matrix panels a few years ago and noticed that they had Hats and Bonnets for the Raspberry Pi that allowed you to drive these panels. Adafruit also had a bit of software that allows you to mirror what is displayed on the HDMI port over to the RGB panels. To tell you all the truth, i'm not much of a software engineer, but the good news is that even though this project gets quite complicated, the software side of things is quite easy. So since LTTP is my favorite Zelda game i got the idea of turning Links spin attack animation into an analog clock. Although you can mirror anything on the Raspberry Pi desktop i decided to go oldskool with things and use Flash .swf to create everything. It was the easiest for me so i ran with it. This project can be a bit tricky because it requires a 3D printer with 300x300 dimensions and a nozzle size of .2 mm along with the standard .4mm. The reason for this is that the pixel grid that i created requires very tiny grid lines for this to work. Although, if you decided to take my concept and resize the grid with larger panels that could work too. And the hardest part was indeed the epoxy resin aspect of this project. I went through several grids until i found a way to get most of the bubbles out of the resin. So with that being said lets get into the laundry list of supplies.
PS: I was considering keeping this project private because i indeed am replicating and selling these complete on Etsy, but i was so excited about this idea i made this tutorial anyways. And if you indeed enjoyed my tutorial here's a link to my Paypal if you feel like throwing me a few dollars for coffee. Even if you don't tip, i appreciate you being here anyways <3
Supplies
---------Tools---------
3D printer with a build plate 300x300mm or more. 0.2/0.4mm Nozzle required.
3D Pen for welding plastic. SRC
Hakko-CHP-170 Micro Cutter SRC
Xacto Knife
Hex Screwdriver
Dremel Cutting tool with typical attachments.
---------Main Components---------
Silk Gold 3D Printer 1.75mm PLA Filament SRC
PLA 3D Printer Filament 1.75mm Black SRC
16OZ Epoxy Resin - Crystal Clear Resin SRC
Loctite Super Glue, Ultra Liquid Control 0.14 oz SRC
x2 RGB Matrix Panels 64x32 SRC
Adafruit RGB Matrix Bonnet SRC
Raspberry Pi 3 / 3 B+ SRC Consider Ebay since current prices are outrageous...
5V 5A AC to DC Power Supply SRC
32g microsd (Technically you only you need 16g) SRC
2.2uF Capacitor SRC
5516 Photoresistor SRC
M3x10mm Thread 304 Stainless Steel Hex Socket Head Cap Screw Bolt SRC
3mm Small Stainless Steel Female Thread Hex Screw Nut SRC
PCB Double-Sided Prototyping PCBs Circuit Boards SRC
Solid core Ethernet cable (CAT6) (For internal wiring, although you can use other types of small wire)
Dupont Crimper and connectors SRC
16 Pin IDC Socket connectors SRC
16 Strand Flat Ribbon Cable SRC
---------Custom Resin mold (Optional)---------
2 Pack 15.7" x 11.7" Large Silicone Sheet SRC
430x230mm 1.8mm thick Clear Acrylic SRC <---- Check other local area's
3D Printing the Frame
The first step in this project is to 3D print the shell and the inner frame. The reason why the top is split into 4 pieces is to increase the vertical resolution of the final product. The only downside to this is the 4 custom supports use a bit more filament, but in the end it is worth it because you will get the most detail possible. Everything except the pixel grid should be printed with a standard .4mm nozzle the grid requires a .2mm nozzle because the gap between each square should be as thin as possible so that each pixel appears blocky from the outside. There will be some additional files included that i used to create a mold for the epoxy resin. It was kind of an elaborate build just for one pixel grid, but i intend to mass produce as many of these as i can. You might be more comfortable using something as simple as 2 big pieces of silicon and some hotglue to create the mold. I just might have gotten a bit carried away with the grid because i've probably printed 8 grids before i got my technique right. Also, feel free to use any color combination of filament you want. I just went with a silky gold and some yellow filament for the hours on the top. However, if you wanted to you could use some paint on the hours if you were careful enough. Just remember that you need to superglue the hours to the frame at the end of this tutorial
Cut Off the Top Four Support Structures
Now the second step once everything is printed will be to remove the support structure for the 4 top pieces. BE AWARE that certain brands of filament can be prone to delamination, so be careful when shaving off that first 2mm of support filament or you'll take some of the bottom Triforces with it! One thing that you could do to remedy this issue would be to print at a slower speed, or tinker with the fan or temperature settings. Having a Dremel sander or clone of one is basically required if you are a hobbiest 3D printer, so this will help shave off the support. Exacto knifes also work great. The back of the top also has support material that needs to be removed. I have highlighted in red everything that counts as a support structure.
Remove the Mid Custom Support Structures
The only two other custom support structures are located in the center ring for the light sensor and the power cord. So once again, having a Dremel really helps at removing these.
Insert the Top Nuts
This step is where having a 3D pen makes things a bit easier, because once you put the nut and cap on the top of the frame you can weld the plastic together. Although to be fair you could also use superglue if you wanted the inside of the clock to look better. But the inside of the clock isn't visible from the outside so you can make it as messy as you want as long as you protect the outer shell
Remove the Rgb Matrix Stock Frame
These panels have little screws on the back that need to be removed, but save them for later because we will be screwing them back again to the internal frame. To my knowledge the formfactor for these should be nearly identical, but please be on the lookout! If the matrix circuit board has capacitors or other electronics in the way, the Raspberry Pi won't fit right in the center. But if you pay attention to what you're buying you should be fine
Attach the Rgb Matrix Panels to the Custom Frame
Since the screw holes are on the small side you might need to poke a needle or a small drill bit down the hole so that the tiny screws will fit. The two screws that go in the center are mostly optional. to be honest i just left those holes empty, but if you wanted you could cut off the tips of the screws so that they would fit the center. Just don't undercut the screws or you might scratch the pixel grid! Make sure you don't put the screws in all the way at first, because the margins in the center can be a bit tight. Once all the screws are placed, then turn them all the way in.
Welding the Four Parts of the Top Frame
Now here is the part where having a 3D pen is crucial instead of using super glue. We're going to temporarily attach the the hex screws to the frame without the pixel grid so we can align all four corners together. When welding i typically increase the temperature of the pen to 220c and slowly extrude the filament out of the pen so it bonds well with the corners of the frame. Depending on your 3D printers settings, and taking tolerances into consideration, you may need to lightly sand the sides of the frame so everything fits in place. There is about a .1mm tolerance built in, but you may need to lightly sand a bit more.
Welding the Side Frame to the Top
Same thing as the previous step. Again you might need some light sanding on the corners for everything to fit. Once you complete this step you can unscrew the center frame again since now everything is welded.
Welding the Photoresistor
After you print the tiny photoresistor mount, just insert the photoresistor into the mount. After that 3D pen weld the mount onto the midframe. I bent the pins out a tad, then welded the two entrance holes so the photoresistor stayed in place. Now there are obviously quicker and dirtier ways of wiring everything together, but to make things slightly neater i used a 2x26 PCB prototyping board, and Dupont connectors. First i crimped two female Dupont connectors to the photoresistor, then used some of the CAT6 ethernet wire to make things cleaner.CAT6 ethernet cables are great because each wire is a single solid piece of copper. This also makes it way easier to make the cable that runs from the photoresistor module to the Bonnet/HAT. Also when you trim the PCB down, if you use power tools like a Dremel to cut through the PCB be aware that you are creating fiberglass dust which can cause health problems. So make sure you limit your exposure to the dust, and you should be fine.
Print the Pixel Grid
Now this is where the .2 mm printer nozzle comes into play. My goal was to make the grid itself nearly invisible to someone at a distance so i went with one of the smallest nozzles possible. The result is quite beautiful because its nearly a perfect square, and there is next to no light bleeding effects from adjacent squares. Given the fact that the nozzle is so small this is quite a long print. Also you might have to fiddle with your slicer settings a bit in order to get things right. Stringing is devastating to this particular piece, so you might have to print at a slower speed, adjust retraction settings, and or lower the temperature of the extruded filament. The first layer is the most crucial to get right so you may have to monitor it quite a bit. However, if you have a few strings on the first layer that doesn't necessarily mean you have to cancel the print. The first layer sits directly on the PCB of the matrix, while the top layer is the outside visible layer. This means that a few mistakes on the first layer won't matter too much because you won't see it.
Epoxy Resin
Now we get to the interesting part where bubbles of air become the enemy! When i did this resin part i ended up making a rather elaborate mold since i intend on "mass" producing these clocks on a slow basis. Having silicone sheets made this part for me a lot easier since the resin wont stick to it, and sandwiching the grid between two silicone mats with a weight on top might be enough. For my particular mold i nearly doubled the amount of resin required so i could submerge the entire grid. This is to minimize the bubbles. Above is an exploded view of the mold i made so that may give you an idea of what to do.
As far as the resin itself, its a binary mixture of equal volume. Heating it slightly above room temperature and mixing it together for at least 5 mins helps minimize bubbles, and it also makes sure that everything hardens really well. I had some plastic cups and a small kitchen scale at my disposal so i just calculated the volume in water, and used a marker to mark the amounts i needed. In the end i used 160 grams of water. So divide that in half and make the marks on your cups accordingly. After 24hrs it should be fully hardened
The second picture above shows the steps i took with my custom mold
Cleaning Up the Pixel Grid
Once everything is hardened remove the scrap resin from the side of the grid. It should be relatively easy to remove because the epoxy doesn't actually adhere to the PLA plastic well. The only reason the resin sticks to each of the individual pixels is due to the way the each layer is printed. The picture above explains what i mean. It causes the resin to lock in place.
Now once this scrap is removed now comes the sanding the top and the bottom. Don't forget that we don't actually want a mirror finish on the grid because the sanding actually works in our favor. The roughness of the finish scatters the light around each pixel. 220 grit sand paper is an option you can use for sanding, but i had a Dremel attachment that made easier for me personally. Just try to avoid applying too much pressure or it will cause deeper scratches that might be visible once you're done. The good thing is you don't even need to worry about some slight imperfections because once the clock is on, and you're looking at it from a distance, you cant notice any scratches at all. Do pay attention to which layer is the top layer based on the way you printed it. The bottom layer should be placed on the Matrix PCB, and the top layer should be the outer layer. A little trick i like to do is apply a tiny bit of mineral oil to the top layer. Once you sand the black plastic it can turn slightly grey, but the mineral oil returns it back to a deep black. The final thing to take into consideration is using a lower grit sandpaper on the bottom layer. At one point i went as low as 120grit to maximize the light scattering
Preparing the Rpi Bonnet
First lets talk about GPIO14 and GPIO18. The Bonnet/software has two options that determine the performance you're going to get out of the matrix panels. The "Quality" option is the one i went with so i can get the best display possible. The only catch is this disables the internal soundcard, and it requires you to solder GPIO14 and GPIO18 together. It is however entirely possible to add a soundcard to the USB slot if you wanted to implement some sort of chime system, but i never liked chimes so i never explored that possibility yet. If you wanted to just solder a quick and dirty wire so that it shorts these two pins, go for it. I just made another Dupont connector that loops right back. We also need 3 other male Dupont posts for GPIO25, 5V, and GND.
The Bonnet and i believe that HAT module both have half sized GPIO interfaces, so i made a little spacer that raises the Bonnet up so that it matches a typical Dupont interface. If everything goes well the pins should still make a good connection between each other.
Mounting the Raspberry Pi
The mounting system i made takes use of one of the USB ports, because, why not. I also included both the Hat and Bonnet version of the "screw side" of the mount. I added in some fault tolerances, but you may need to do a little light sanding so that everything fits the way it's supposed to. Just don't bend the USB port too much for obvious reasons.
Making a 16 Pin Matrix Data Cable
The way that you would typically daisy-chain two 32x64 matrix panels would be to have one of the panels reversed. Interestingly enough, this reversal causes issues where you can see the dividing line slightly when you are looking at the clock from different angles. This is due to the positioning of the diodes in each of the 4096 LEDS. If both panels are exactly parallel this effect goes away. The only problem is the 16pin connectors that come with the matrix panels wont stretch that far to make the daisy chain possible. So i decided to make my own cable, with wires and connectors! And if you have a vice you really don't need a special tool to clamp things down. Just make sure the cable is long enough, and the orientation matches the original cable! Mine was 290mm in length.
Connecting the Data and Matrix Power Cables
In the end the internals should look relatively like this.
The Back Panel & the Main Screws
After printing the back panel the main power cable should snake itself through the bottom of the clock. The main screws are capped so that it wont scratch your wall. If you place the cap in between the screw, when you screw it in it should wedge itself tightly on the back of the clock.
Mounting the Numbers
You are going to want to print the top numbers at a slower speed for obvious reasons. Just make sure to get some decent quality superglue. I avoided using the gel type of glue because i was having issues with it. Just be very gentle and use very tiny drops and you should be fine!
Software
This is the DIY section for the software if you don't want to use my prebuilt IMG
First we need to download Raspbian Stretch Lite from HERE
Once we've logged into SSH for the first time we're first going to update and install the PIXEL desktop environment.
sudo apt update sudo apt install xserver-xorg sudo apt install raspberrypi-ui-mods sudo apt install unclutter sudo apt install gnash sudo reboot
-------------------------------------------------------------------------------------
Next we need to run raspi-config to enable VNC, and force the Pi to autologin to the PIXEL desktop
sudo raspi-config
Go to Boot Options --> Desktop / CLI --> Desktop Autologin Desktop GUI, automatically logged in as 'pi' user
Go to Localisation Options --> Change Timezone (Sets your current timezone)
(Optional)
Go to Interfacing Options --> VNC (If you would like to enable remote desktop)
-------------------------------------------------------------------------------------
Next we need to edit the config.txt file in the boot folder so that it makes a few changes.
sudo nano /boot/config.txt
Uncomment the following line. This will force HDMI on.
#hdmi_force_hotplug=1
to
hdmi_force_hotplug=1
Add this right after #hdmi_mode=1
This will force the desktop dimensions into a square. For some reason when i downscaled all the way down to 64x64 it was creating some problems. Thankfully 128x128 still works, because the mirroring software downscales and approximates to the actual 64x64 matrix.
hdmi_group=2 hdmi_mode=1 hdmi_mode=87 #-----custom matrix dimensions----- # default dimensions hdmi_cvt 128 128 60 6 0 0 0 # highres dimensions #hdmi_cvt 1280 1024 60 6 0 0 0 #---------------------------------- #---------disable bluetooth-------- dtoverlay=disable-bt #----------------------------------
And finally add this to the very bottom
dtoverlay=i2c-rtc,ds1307 avoid_warnings=2
-------------------------------------------------------------------------------------
Downloading and compiling the mirroring the software
You can find a link to the more detailed guide on Adafruit's website HERE & HERE
cd ~ curl https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/rgb-matrix.sh >rgb-matrix.sh sudo bash rgb-matrix.sh
Follow the setup by selecting either between the HAT or the Bonnet. Just make sure you select the quality option since we soldered those two pins together earlier. After this is complete, select reboot.
This next part installs the desktop mirroring software.
sudo apt-get update sudo apt-get install -y build-essential git libconfig++-dev cd ~ git clone --recursive https://github.com/adafruit/rpi-fb-matrix.git cd rpi-fb-matrix
Then compile the software with
make clean all
-------------------------------------------------------------------------------------
Next, download the flash and startup scripts.
When prompted, replace the old matrix.cfg with the new one.
cd ~ wget https://github.com/Lotek-Design/rgbian-lttp/releases/download/1.1/rgbian-lttp-v1.1.zip unzip rgbian-lttp-v1.1.zip
-------------------------------------------------------------------------------------
We are then going to create three services that control the matrix
sudo nano /etc/systemd/system/light.service
[Unit] Description=Autolight [Service] User=root ExecStart=/bin/bash /home/pi/rgb/autolight.sh Restart=always [Install] WantedBy=multi-user.target
sudo nano /etc/systemd/system/rgbhigh.service
[Unit] Description=Adafruit RGB HIGH [Service] User=root ExecStart=/bin/bash /home/pi/rgb/autorgbhigh.sh Restart=always [Install] WantedBy=multi-user.target
sudo nano /etc/systemd/system/rgblow.service
[Unit] Description=Adafruit RGB LOW [Service] User=root ExecStart=/bin/bash /home/pi/rgb/autorgblow.sh Restart=always [Install] WantedBy=multi-user.target
-------------------------------------------------------------------------------------
Then run the following commands to set up everything with those services
chmod +x /home/pi/rgb/autorgbhigh.sh chmod +x /home/pi/rgb/autorgblow.sh chmod +x /home/pi/rgb/autognash.sh sudo systemctl daemon-reload sudo systemctl enable light sudo systemctl start light.service
-------------------------------------------------------------------------------------
To automatically start the clock once the Pi has booted to PIXEL we need to modify the autostart file
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
The file should contain the following
@lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi @xscreensaver -no-splash point-rpi @xset s off @xset s noblank @xset -dpms @sh /home/pi/rgb/autognash.sh @unclutter -idle 0
-------------------------------------------------------------------------------------
Once you reboot, the clock should automatically start up!
Tweaking the light sensitivity script
Messing with the lightlevel_val will change the threshold between high and low brightness.
nano /home/pi/rgb/autolight.py
Final Thoughts
On the software side of things, i plan on doing a major overhaul to all 12 hours of the day so that Link actually explores, every part of each dungeon. Also, i might go into further detail on how i made the .SWF on a livestream or something. I'll be sure to update you all very soon. Oh and also, i do have two of these already made, so i'll shove both of them on Etsy soon. Although because of the supply chain shortage messing with the Pi supply, im not going to include it with the unit since the prices are insane at the moment.
3/1/22 UPDATE! I should be up and running soon, so stay tuned! I have a Twitter and a Discord server up and running, and you can find the links to those on my website https://lotekdesign.net/