Software setup for Adafruit's LED Matrix Sand Toy

As I talked about in my post where I was working with Adafruit's Matrix Bonnet, Adafruit takes a lot of shortcuts in their tutorial when it comes to working with the software side of the Matrix Bonnet. I don't think that's a problem for the main audience they are going for, but I like to know what's going on behind the scenes. So as I did for my other Matrix Bonnet writeup, I'm going to break out the details of what I did to get their LED Matrix Sand Toy up and running.

Obviously, you're going to want a Pi Zero, or Zero W, with the latest and greatest Raspbian Lite on it. Next, I grabbed their setup script and started figuring out what else I wanted to tweak.

Since they're using the hardware mod to decrease flicker, and this is a purpose-built setup, as opposed to my previous one which was just for testing and experimenting, I'm going to compile the software to default to use the Adafruit hardware. Also, technically, I just needed to compile the Python-related parts, but I opted to get everything set up just in case I wanted to play around with the other demos.

cd rpi-rgb-led-matrix/ make -C examples-api-use HARDWARE_DESC=adafruit-hat-pwm cd utils/ make HARDWARE_DESC=adafruit-hat-pwm cd ../bindings/python/ make build-python HARDWARE_DESC=adafruit-hat-pwm sudo make install-python HARDWARE_DESC=adafruit-hat-pwm sudo make clean make build-python HARDWARE_DESC=adafruit-hat-pwm PYTHON=$(which python3) sudo make install-python HARDWARE_DESC=adafruit-hat-pwm PYTHON=$(which python3) sudo chown -R pi:pi .

Next, we should disable the built-in audio hardware. Edit /boot/config.txt and set audio to off:

dtparam=audio=off

Once all the above is done, you'll need to reboot the Pi for the audio driver change to take effect.

After the reboot, I followed the rest of the tutorial and cloned the Adafruit Pixel Dust repo, enabled I2C via raspi-config and finally compiled the code.

I then opted to make the Raspberry Pi read-only. I followed the petr.io site that Adafruit linked to, instead of running Adafruit's script. I skipped into step 2 and did the following:

sudo apt-get remove --purge wolfram-engine triggerhappy cron logrotate dbus dphys-swapfile xserver-common lightdm fake-hwclock sudo apt-get autoremove --purge sudo apt-get install busybox-syslogd; dpkg --purge rsyslog

In his Step 3, I noticed the Stretch-based kernel command line looks different, but I did end up adding the "fastboot noswap ro" to the end of the command line and that ended up working fine.

I then followed Step 4, 5 and 6 as-is. I did some reading up on the UsePrivilegeSeparation option for OpenSSH and it looks like it's been deprecated. I didn't bother diving much deeper to understand what will need to be done in the future. Sorry, Future Dustin.

In Step 7, I moved the /etc/resolv.conf file to the /tmp name and location and then created the symlink.

I skipped the watchdog part, but I did end up adding the bashrc items to both the pi user's .bashrc and to /etc/bash.bashrc. The local user's .bashrc ends up overriding the PS1 variable, so at the very least, you have to tweak that file...or just put the block in both places. I opted for the lazy option and put it in both locations.

After all of that, everything works great. Another great project idea from Adafruit!