Tips and Tricks

There are a number of things I need to document more formally elsewhere (to save my future self and others time in hardware-related setup with the Pi and accessories)… but for now, I’ll just note them here.

A good power supply is essential

I originally used a decent, name-brand 6-port 2A-per-port (except for a couple) power supply to power all the Pis in the Dramble, and now I use a 55W Power over Ethernet switch which supplies clean, consistent power. I could’ve also gone with a PC 5V PSU and powered the Pis through GPIO pins (a lot of cluster builds do this, since it’s easier to custom wire and doesn’t require micro USB cables or expensive PoE switches).

But either way, you need to get clean, 2A or greater power to the Pi, or you’re going to run into weird issues, like random restarts, USB device issues, network flakiness, etc.

If you ever run into strange issues with your Pi, check your power supply. For standalone Pis I’ve been using Samsung and Apple 2A chargers (like the one that comes with an iPad), and they have worked great for half a decade!

Increasing Current available for USB devices to 1.2A

I have an SSD that seems to require something like 300-500mA of current to function properly. Mix that with a 40 mA USB keyboard and a 100-200mA WiFi dongle, and the default 600mA supplied over the Pi’s bus is a bit cramped. To prevent plugging in of certain medium-high powered USB devices from crashing your Pi or taking down other USB devices, there’s a /boot/config.txt parameter that allows you to double the default current on USB. To enable this mode:

  1. $ sudo nano /boot/config.txt
  2. Add the line max_usb_current=1 and save the file.
  3. Reboot the Pi.

This modification is only available on the Raspberry Pi B+ and later Pis (like the Pi 2 or 3 model B).

Tips for getting WiFi to connect automatically and reliably

See this guide: Setting up an 802.11n WiFi adapter on the Raspberry Pi. Shows how to connect using WPA Supplicant, and how to prevent the WiFi from going into standby mode.

Tips for fixing a botched microSD card

If you accidentally break your Pi by editing the wrong file or breaking configuration somewhere on the microSD card you use to boot the Pi, you can usually just pull it and mount it on another workstation, edit the file to revert the change, and pop it back in your Pi.

I wrote a guide for mounting a Raspberry Pi’s ext4-formatted microSD card in Ubuntu 14.04 on a Mac, and the process for other platforms is similar (use a VM, make it easy). If you just need to recover a file from the Pi you can read the files from the microSD card without using a VM.

You can also re-image the entire SD card, and that’s generally what I do if I’ve botched things too badly (easy to rebuild things when the configuration’s all done in Ansible and you have backups of important data :).