I work on Raspberry Pi hardware daily as part of my job and for fun at my local makerspace. Below I’ve outlined some practices that have streamlined my Raspberry Pi workflow both at work and on hobby projects.
1. Use a Serial TTL Cable When Possible
A traditional setup in new RPi projects is to attach a monitor, keyboard, mouse, and associated cables to configure the device and application. This is an adequate starting point for novices but can be a hassle for medium and large scale projects. It can also add a considerable amount of setup and teardown time to a weekend project, particularly in a shared environment like an office or makerspace.
There’s a much better way to go about this, assuming you have already learned RPi and Linux basics. Instead of attaching your Pi project to a keyboard and monitor, you can use a compact serial TTL cable directly attached to your main laptop. You can then access the Linux shell prompt as a serial USB device.
Once the cable is connected, you can operate from the device’s command line as usual. With a serial TTL cable, it’s simple to perform tasks such as viewing logs and updating code, all without the need for a monitor and with a setup that can fit into your bag.
Although some developers prefer the convenience of SSH-over-WiFi, I still prefer a USB cable. It allows me to investigate problems before WiFi connectivity is available (for example, kernel panics). It also allows me to work on the device outside of the WiFi router’s range.
Using a serial TTL cable instead of a graphical monitor is the single best workflow improvement you can make. Still, it might not seem so obvious on the surface. Every graphical tool on a Raspberry Pi has a command-line based alternative. It will take time to learn, but much less time in the long run than lugging around a monitor. You will also find that command-line tools are much more convenient after the initial learning investment has been made.
Adafruit has written an in-depth tutorial here.
When accessing a Pi via USB, the common practice in Linux is to use
minicom on the host machine. Many of these options offer an OK experience. Nevertheless, I’ve found that the interfaces are not always obvious, and often the tools show their age.
Recently I discovered Tio, a modern alternative to Screen. It is much easier to use than any other command-line terminal application while still having a handy command set.
By default, Tio will auto-reconnect to a USB device, even if the device is unavailable. This is great if you move your project around a lot and need to constantly reconnect to the board. As soon as you re-attach the RPi, Tio will start printing logs to the screen by default.
Tio is also very easy to learn, as all commands are viewable via
ctrl + t, ?.
micro Text Editor
When editing text files from the command line,
vi offers a powerful interface for advanced users. Personally, I’d rather just use an editor that offers inferrable shortcuts. The common suggestion in these cases is to use Nano, and indeed, Nano is easy to learn and easy to install. However, there is a newer project available that reflects more modern usage.
Micro is a text editor built in the last 5 years. It is actively maintained and has a very ergonomic set of default keybindings. Configuration files are stored in plain JSON, though it requires almost no customization and works exceptionally well out of the box. The default key bindings will make sense to anyone that has used a computer in the last decade. You copy test with ctrl+c, move the cursor via arrow keys, and highlight text using the shift key. If you are working in a graphical environment, mouse support works out of the box.
For these reasons, Micro is now my go-to text editor for command line work.
4. Use an HDMI Capture Device Instead of a Monitor
If you’re building a project that requires a graphical display by design, such as a kiosk or media player, a USB TTL serial cable might not be an appropriate solution. That’s not to say you are required to park another computer monitor at your desk. In these situations, it is still possible to avoid hooking a second monitor up through an HDMI capture device. An HDMI capture device is an adapter that takes any HDMI source and turns it into a USB webcam on the PC side.
Once your HDMI capture device is attached, you can then view the stream as any other USB webcam. On Linux, I use Cheese for viewing the display. One additional advantage to this approach is that you can very easily take screenshots of your work.
Although some professional units used for video editing are expensive, most can be purchased cheaply, especially since the video quality is not a huge concern when debugging. At the time of writing, I was able to find several options on Amazon for under USD 20.
5. Use Ethernet-enabled USB Hubs
Modern laptops with integrated Ethernet become harder to find every year. The integrated Ethernet port may have finally gone the way of the floppy drive.
The Raspberry Pi 0 does not have integrated Ethernet, either. In addition to the missing Ethernet port, the Raspberry Pi 0 only has one USB port available. The simple solution to this problem is to purchase a USB hub and attach a USB Ethernet adapter to an available slot.
I’ve recently seen more USB hubs on sites like Amazon that contain an integrated Ethernet port. This is great because it frees up a USB slot and gives you Ethernet access for free. They are also extremely inexpensive, so I like to keep a few in my toolbox.
6. Something Else?
Did I forget something? If you have a trick that has made life easier when developing on the Raspberry Pi, feel free to send me a message on Reddit- I will keep this list as up-to-date as possible.