Skip to main content
Version: 2025

Connecting RPi to WiFi

To connect your Raspberry Pi to the internet, you will need to modify the 50-cloud-init.yaml file. Open a terminal on the backseat and open the file:

sudo nano /etc/netplan/50-cloud-init.yaml
warning

Any mistyped characters or any extra spaces will break the network connections. If this occurs, you may not be able to SSH into your Raspberry Pi, so please follow these instructions very carefully.

When you open this file, it will look something like this:

network:
ethernets:
usb0:
dhcp4: false
dhcp6: false
link-local:
- ipv4
match:
name: usb0
set-name: usb0
version: 2
wifis:
renderer: networkd
wlan0:
access-points:
MIT:
password: MIT_PASSWORD
dhcp4: true
optional: true

To add your home WiFi network, add a new wlan0 interface to WiFis at the bottom of the file:

        wlan0:
access-points:
HOME_WIFI:
password: YOUR_SUPER_SECRET_PASSWORD
dhcp4: true
optional: true

Change HOME_WIFI to the name of your home WiFi network. Also change YOUR_SUPER_SECRET_PASSWORD to your home WiFi network's password.

danger

Before closing your file, please ensure that the new lines have the same number of spaces and no incorrect characters. If there are, you may not be able to SSH into your RPi and the TAs must fix it in class.

Once you are sure that your file has no formatting mistakes, apply the netplan. This will likely close your SSH connection.

note

At the bottom of the terminal, there will be instructions to save and close the file. It should appear like CTRL or CMD + S to save the file and CTRL or CMD + X to close the file.

To apply your changes:

sudo netplan apply