Skip to content

Instantly share code, notes, and snippets.

@sammlapp
Last active November 20, 2024 15:41
Show Gist options
  • Save sammlapp/20e8957f0b5e225f8afa4d88947d8b02 to your computer and use it in GitHub Desktop.
Save sammlapp/20e8957f0b5e225f8afa4d88947d8b02 to your computer and use it in GitHub Desktop.
Setting up a Raspberry Pi 4.0 to use as a Swallow

Setting up a Raspberry Pi 4.0 to use as a Swallow

These instructions are a work in progress

Operating system

  • flash SD card with raspberry pi OS using Raspberry PI Imager application
  • can now use the set-up features to:
    • set the host-name (swallow-016, eg)
    • enter wifi credentials for a local wifi network.
    • enable SSH
    • set username ("pi" is good) and password (ask a lab member)

Note: if setting up multiple swallows, can re-use the settings but need to re-enter the wifi password, login password, and modify the host-name

IP and SSH

  • SSH into the pi: ssh pi@[hostname].local, password: whatever you set during imaging

  • Get MAC address: from Pi's command line interface, run

ip link show | grep ether

  • write IP and MAC address in internal Google Drive swallow spreadsheet

  • Also add serial number to internal Google Drive swallow spreadsheet

cat /proc/cpuinfo | grep Serial

  • Expand file system to use entire SD card

sudo raspi-config > advanced > expand filesystem

  • add exfat file system support
sudo apt update
sudo apt upgrade
sudo apt install exfat-fuse
sudo apt install exfatprogs

Set up the picopy python script

  • make sure you are in the home folder
  • clone picopy from github and install:
cd
git clone https://github.com/sammlapp/picopy.git
sudo sh ./picopy/script/install.sh

test hardware

  • stop picopy to avoid competition for GPIO

sudo /etc/init.d/picopy.sh stop

  • run test script on pi: python3 /home/pi/picopy/test_leds_buttons.py
  • all leds will light up if they are working properly
  • check that all buttons work by pushing each button (should see text logged in console for each button)
  • use ctrl+C to exit

install power button control

power-button setup:

git clone https://github.com/sammlapp/pi-power-button.git
sudo sh ./pi-power-button/script/install
  • Reboot by holding the power button for 3 seconds, then check that it starts picopy (flashes green light 'ready' status) and recognizes an external exFat drive (source/dest drive LED lights up)

use Swallow to copy SD cards

Follow instructions from picopy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment