Thursday, April 7, 2016

Raspberry Pi Utilities

I've been using the Raspberry Pi single-board computer for a number of projects including the Ommatid and some new things I'm working on at Gray Area. Since the RPi, like most computers, is susceptible to memory corruption when not shut down properly, I've had to reconfigure several SD cards. This is a little tedious so I made some notes for myself; hopefully others find it useful. If your pocket monitor is like mine, ukscone's overscan utility is particularly helpful in adjusting the HDMI scan so the bottom line of the terminal is actually visible on screen.

Another handy thing I wrote is a shutdown monitor. This runs in the background and checks a gpio; if it's grounded (e.g. by a switch or jumper) it executes a clean shutdown -P now command. If there's a blink(1) USB LED indicator, it will flash green to indicate the RPi started up happily and the shutdown monitor is running, and will turn red as the shutdown occurs, and eventually off to indicate the system is fully shut down (not obvious from the RPi power indicator which is always lit). You may also startup any other processes you want in the shell script that starts the shutdown monitor. Find this and other utilities here: https://github.com/headrotor/rpi-utils

Final pro tip: learn how to backup your SD cards, either using dd on unixen or Win32 Disk Imager on Windows. It's easy to make a backup and if your SD ever gets hosed it's much simpler to restore. Oh, and I've settled on 8GB SD cards which are capacious enough for most uses but small enough to make conveniently compact backup images.

Speaking of compact backup images, there's a great utility PiShrink https://github.com/Drewsif/PiShrink that will removed all the unused space in your disk images, which can make them dramatically smaller. Recommended!

Tagged: SW hacks


Archives:


Topics:


RSSicon.png  RSS feed