-
Notifications
You must be signed in to change notification settings - Fork 0
3 Raspberry Pi
The machine given to you by staff is called a Raspberry Pi. For the purposes of this class, your Raspberry Pi comes preinstalled with a slightly customized copy of Raspberry Pi OS -- Trixie.
The Raspberry Pi 5 requires an active cooler to properly cool the board during heavy computations (i.e. image processing). To install the cooler, follow the installation guide at: https://datasheets.raspberrypi.com/cooling/raspberry-pi-active-cooler-product-brief.pdf
Along with the Pi you should have received a microSD card in a microSD card case labeled with your team name. You should insert the given microSD card into the microSD card slot found on the underside of the Pi.
For WiFi connection, your kit should include a new USB to WiFi adapter. Unbox it and plug it into a USB 2.0 slot (black USB slot) on the Pi.
For powering the Pi, you should have received a 27W AC-DC converter sporting a usb-C cable. The Pi comes equipped with a single usb-C port, which you should connect this power supply to.
After inserting the microSD card, the WiFi adapter, and connecting the Pi to power, you should see an array of blinking lights and a momentary spinning of the on-board cooler. During this time, your Pi is booting and running its first-time-setup scripts. Once the power indicator (the, more often than not, green blinking light) momentarily turns red, the Pi will have rebooted. After rebooting, the power indicator should return to its green-blinking state and is ready for you to hop in.
After your Pi has completed it's initialization, it should now be broadcasting a wireless network labeled after your team name; e.g. team1wifi. Ask the staff for your team's WiFi password and connect to the
Warning
After connecting to your Pi's wireless network, you will not have access to the "internet" until later on in this guide.
Note
Having a basic understanding of navigating a shell through a command-line interface (CLI) to interact with a computer without a screen is an extremely useful skill. The shell you will use to connect to your Pi will differ system-to-system. On Apple laptops, this is done through the use of the zsh-shell, which can be accessed through spotlight by searching for "terminal". On a Windows machine, this is done through the Command Prompt, or the Windows PowerShell. On Linux devices, this is done through whatever shell you please. It is highly encouraged to your familiarize yourself with the basics before proceeding.
To connect to the Pi, we use Secure Shell (SSH). SSH is an extremely powerful tool for remotely accessing another computer's shell. This class involves a significant amount of coding, and being able to do so in the absence of a desktop environment is a very valuable skill. SSH allows multiple agents to remotely attach the same machine, at the same time. Most modern operating systems like OS X, Ubuntu, and Windows come with SSH preinstalled. Double check by running ssh -V in a shell. If SSH is installed, you should get something similar to this:
PS C:\Users\MASLAB> ssh -V
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2To connect to your Pi using SSH, you need to first be connected to its broadcasted wireless network. Open a shell, or SSH-client / application and enter the following command, where X is your team number:
ssh teamX@teamXpi.local
The format of this is as follows: ssh user@hostname; where the user is your team name, and the hostname is your your team name with the pi.local suffix appended. You should keep note of your device's hostname.
You should be shown a field resembling the following and prompted for a password. Ask a staff for the password.
teamX@teamXpi.local's password:
There are a variety of tools to make your life easier while working in a shell. Some of the staff's personal favorites are vim or neovim in tandem with tmux. Becoming proficient with these tools can, in many ways, be much more powerful than a traditional desktop IDE.
There are times in which accessing a desktop on your Pi will be important. To do so, we use Remote Desktop Protocol.
On an OSX/iOS device, the Windows App application on the app store can be used. In the application, create a new connection by clicking the plus icon, and navigating to the "PC Name" dropdown. In the field labeled Hostname or IP Address, enter your team's hostname, teamXpi.local where X is your team number. Exit the dropdown and save.
To start a connection to your device, click on the saved configuration in the application's "devices" tab. When prompted for a username and password, enter your team's credentials:
user: teamX
password: <ask staff>
On a Windows device, you can use the preinstalled "Remote Desktop Connection" app. For "Computer", enter your team's hostname, teamXpi.local where X is your team number.
There will be a warning about the computer's certificate. Feel free to select "Don't ask me again for connections to this computer" and click "Yes" to connect.
Enter username as teamX where X is your team number your team's password.
Visual Studio Code (VSCode) is a very popular code editor for many languages, including Python which runs the MASLAB library.
We would recommend using VSCode to interact with the Pi for the majority of your robot software development. You can download the appropriate version at https://code.visualstudio.com.
VSCode has an extension to remotely connect to the Pi's and open its folders directly on VSCode. The extension is available here: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh
Install and follow the Getting started note with simple SSH host setup.
The Pi is a full computer running a full operating system that needs to stop background processes when shutting down. Therefore, you should run this command in a shell connected to the Pi to gracefully shut it down.
sudo shutdown 0The 0 in the command indicates that we want to shutdown with 0 wait instead of the default 1 minute wait before shutdown.
Alternatively, you can log in with RDP and use the graphical interface to shutdown.
After you've successfully connected to your Pi via either SSH or XRDP, you should now connect your Pi to the internet. This can be done either over SSH or XRDP through the desktop. It is recommended to connect to MIT's wifi using the desktop over XRDP.
However, this can also be done by using the raspi-config tool, navigating to the "System Options" tab, selecting Wireless LAN, and following the prompts.
Once you have connected the Pi to WiFi, your computer should also have access to the Internet through the Pi's hotspot.
Congratulations! You have set up and familiarized with the Pi. If you haven't already, please checkout the following how-tos to interact with the electronics, battery, and MASLAB software.