Skip to content

3) Raspberry Pi setup

Stéphane Caron edited this page Feb 20, 2024 · 28 revisions

The prerequisites for this stage are:

3.1) Write OS image to the microSD card

  • Install the Raspberry Pi Imager on your computer, for instance on Ubuntu: sudo snap install rpi-imager.
  • Launch it, select the Raspberry Pi OS Lite (64-bit) image and write it to the microSD card.

On Ubuntu 20.04, note that the imager seems to only work from GNOME (otherwise it fails to get root privileges).

Ask questions about this step in Software discussions.

3.2) First boot of the Raspberry Pi

  • Connect a keyboard and screen to the Raspberry Pi (hereafter "raspi" for short).
  • Power it up and log in. By default the user would be pi and the password raspberry. We will assume these values in what follows.
  • Set your own password with passwd.
  • Run sudo raspi-config
  • Go to "System Options", "Wireless LAN" and configure your Wi-Fi access.
    • Optionally, go to "System Options", "Hostname" and set a custom host name.
  • Exit raspi-config and reboot to apply wireless settings.
  • Update Debian packages: sudo apt update && sudo apt upgrade -y && sudo apt install vim

Ask questions about this step in Software discussions.

3.3) SSH configuration

  • Run sudo raspi-config
  • Go to "Interface Options", "SSH" and enable the SSH server
  • Exit raspi-config
  • Run ifconfig and locate the IP address of the raspi under wlan0
  • Let's say the address is 192.168.XXX.YYY: from your computer, run ssh pi@192.168.XXX.YYY
    • For convenience, now is a good time to upload your SSH public key.

Ask questions about this step in Software discussions.

3.4) Setup script

Following step 1.4) from 1) Getting started, you should already have cloned the main upkie repository.

  1. Go to tools/setup in your local copy of the repository
  2. Copy the setup script to your raspi: scp setup-raspi.py pi@192.168.XXX.YYY:~
  3. Run the setup script on the raspi:
pi@raspberrypi:~$ sudo ./setup-raspi.py

3.4-optional) Wi-Fi access point

If you want, you can turn your raspi into its own Wi-Fi access point. This way, your robot will carry its own Wi-Fi network, making sure you can always connect to it.

NB: if you have anything else to download to the raspi from the Internet, better do it now. After the following steps, the raspi will turn into its own Wi-Fi access point (with no Internet access).

  1. Go to tools/setup in your local copy of the repository
  2. Copy the Wi-Fi configuration script to your raspi: scp setup-wifi-ap.py pi@192.168.XXX.YYY:~
  3. Run the setup script on the raspi:
pi@raspberrypi:~$ sudo ./setup-wifi-ap.py

where:

  • XXX and YYY come from the previous step
  • SSID will be the SSID for the robot's Wi-Fi network
  • WIFIPASSWORD will be the password of the robot's Wi-Fi network
  • COUNTRY should be your two-letter country code for Wi-Fi compliance (e.g. FR or UK)
  • 192.168.0 will be the IPv4 prefix for the robot's Wi-Fi network interface
    • The IP address of the robot itself will be 192.168.0.42
  • 192.168.1 will be the IPv4 prefix for the robot's wired network interface

The script will download and install software packages, configure CPU isolation and turn the raspi into its own Wi-Fi access point.

Ask questions about this step in Software discussions.

You may have to reboot the Pi after this step. An access point should be created with your specified SSID.

3.5) Convenience SSH configuration

You should now be able to log into to the robot by connecting to its Wi-Fi access point and running:

$ ssh pi@192.168.0.42

For convenience, you can add the following to your ~/.ssh/config file, replacing "upkie" with your preferred nickname:

Host upkie
Hostname 192.168.0.42
User pi

Ask questions about this step in Software discussions.


Next: 4) Electronics testing

Clone this wiki locally