This guide will describe the setup procdures for a Raspberry Pi Zero 2W for use in the FlyPi system. This includes the installiation of the OS and the Setup of the networking. These steps may apply to other hardware version of the Pi Zero, but this guide is made specifically for a Pi Zero 2W
## OS Install
The OS installed on the RPi Zero used for the FlyPi system in a headless *(server)* version of Ubuntu 22.10. There is no supported Desktop version so you will need to know you way around the command line.
***Note: These Instructions are subject to change with the inclusions of the FreeRTOS baremetal implementation. More researched needs to be done to on correct procedure of implement the two "OS"***
1. Launch the Raspberry Pi Imager on a development machine.
- To install rpi-imager for your device see [here](https://www.raspberrypi.com/software/)
2. Connect a micro-sd card to the development machine
- The current micro-sd card size used for development is 16GB
3. Select Ubuntu 22.10 Server from `Other General Purpose OS -> Ubuntu -> Ubuntu Server 22.10 (32-bit)`
4. Select the newly attached storage device to upload the image to from the rpi-imager program.
5. Open the advanced options window by selecting the GEAR icon in the bottom right corner
6. Set a hostname for the device
- Current hostnames are `flpi`, `flypi2`, and `flypi3`
7. Enable ssh and use password authentication
8. Set username and password
- Current username and password are the same on both devices
- username: `ucart`
- password: `ucartpw`
9. Then press `SAVE` and `WRITE` to begin the flashing process
After the install is complete you can move the sd-card to the Pi Zero and power up the device. If flash was successful a green LED will turn on to show the device is booting.
## Register on IASTATE Network
SSHing to the device is difficult using the give microUSB ports. The easier form of development is connecting the Pi to the IASTATE network and then sshing over the network to develop on the device
#### Getting the MAC Address
To get the device connected to the IASTATE network it will need to be netreg'ed with ETG. To complete this step you will need the MAC address of the Pi
1. Boot up the Pi connected to some basic IO to allow OS navigation
- Keyboard
-*The Zedboards used in 488 have an adapter from microUSB to USBA-Female (You can reach out to ETG to get one of these cables)*
-*Issues have been encounter while running Ubuntu Server 23.04 (64-Bit) and attempting to use a keyboard (Current solution is to boot a RPi 3 using the desired sd-card to continue the Register on **IASTATE Network** insctructions)*
- Monitor
-*There should be microHDMI cables in the UCART lab that will allow you to connect the Pi to the lab monitors*
2. Once the Pi boots, sign in with you user created in the OS install step.
- Currently setup devices username and password are the same on both devices
- username: `ucart`
- password: `ucartpw`
There packages needed to run `ifconfig` or some other network manager are **not** installed on inital setup. You will need to use an alternative method of getting the MAC Address
3. Running `cat /sys/class/net/wlan0/address` will print out the MAC Address of the `wlan0` interface
- On the currently setup Pis the wireless interface has been `wlan0`. This may be different on new Pi
4. Copy down the MAC Address and send a request via email to ETG to have the device registered.
- Once the device has been registed, power will need to be cycled and remain off for 2 to 3 minutes
- You will be asked for a name to register it as. This will be the name you use to ssh to the device. *Ex*`ssh <username>@<PROVIDED-NAME>.ece.iastate.edu`
- Current PROVIDED-NAMEs are `ucartpi`, `ucartpi2`, and `ucartpi3`
#### Setting up the netplan
In order to connect to the IASTATE network on boot a netplan will need to be setup so the device has instructions when booting.
***Note: The device cannot be ssh'ed into yet after netreg'ing. The Pi needs to be connected to the network. The following steps are still using the IO physically attached to the Pi***
1. Open `/etc/netplan/<PRESET-FILE-NAME>.yaml` in your prefered text editor
- One the previously setup Pis the netplan files were named `50-cloud-init.yaml`
2. Add the following to the bottom of the file
```
wifis:
<INTERFACE-NAME>
optional: true
access-points:
"IASTATE": {}
dhcp4: true
```
3. After closing the file run the following command to enable the netplan
-`sudo netplan generate`
-`sudo netplan apply`
4. Test that the device is connected using `ping google.com` and confirming that the ping is successful
-*The device may need a reboot for changes to take effect*
## SSHing to the Pi
Currently the Pis can only be ssh'ed into from computer setup on the IASTATE network *such as the lab computers*
1. To connect to the Pi run `ssh <username>@<PROVIDED-NAME>.ece.iastate.edu`
- Current PROVIDED-NAMEs are `ucartpi`, `ucartpi2`, and `ucartpi3`. These names are written on the Pis
- Currently setup devices username and password are the same on both devices