Students will learn how to setup a simple single board computer through SSH. They will download the operating system and copy it onto theirflash drive. They will boot the system. To test the installation, they will hook up a camera and run example face tracking python program and a target recognition program using computer vision.
Learning outcome:
Prepare portable computing platform with operating system and practice Unix shell skills.
Urs Utzinger, Updated 1/14/2025
Raspberry Pi (version 4 is used here but others will work too)
Either
Power Bank 5V 2.5A (this will not work for Raspberry Pi 5 as it requires 3A ore more)
USB-C power supply 3A (Raspberry Pi 5 recommends 5A)
USB flash drive [or SD Card] (16 GBytes or larger)
Micro-HDMI to HDMI adapter (depending on your monitor)
Either
Ethernet RJ45 connector on a computer OR access to
USB to Ethernet Adapter (List of suggested USB to Ethernet adapters with pictures of USB ports). A USB to Ethernet adapter costs between $10-20, a wired keyboard and mouse costs about $20.
Patch Cable
And
WiFi network to which you can connect your own devices.
{Optional] Display with HDMI cable such as your TV,
[Optional] Keyboard and mouse
!! Don't power Raspberry Pi on the USB port of your desktop or notebook computer. It might permanently damage it !!
!! Electronics are exposed. If you place the Raspberry Pi on a metal part you will fry it. If you drop screws, tools or jewelry on it, you will fry it!!
You can add the mouse, keyboard and display when your Raspberry Pi is running but you shall not remove SD card or flashdrive while it is running.
Please connect your Raspberry Pi according the written step by step instructions here. [YouTube video also available below]. We will want to accomplish the following tasks:
Installation of a boot medium that contains the operating system. In this setting we use a flashdrive because they are less expensive and faster than SD cards. Raspberry Pi does not have solid state disk drive interface.
We will need to set up the Network. For the lab the Network SSID is MEDDEV-5G. The password is provided by the instructor.
For easier operation will need to configure other common options every computers has:
Hostname: e.g. urspi
Username: e.g. urs
Password: *****
Less Common Options:
Remote headless operation (no display) using SSH. [servers and many internet of things devices.]
Remote display mirroring using VNC. You will need VNC viewer on your laptop. RealVNC provides RealVNC viewer. You do not need an account with RealVNC nor the VNC server. VNC is a remote desktop program and not commonly used on UNIX or Windows computers.
We will use a network patch cable to connect your laptop to the raspberry pi. If you don't have Ethernet RJ45 receptacle on your laptop, use the USB to ethernet adapters (black works for PC, sliver works for Mac). This is the simplest network connection between two computers and works on all computers.
Install the Raspberry Pi Imager: https://www.raspberrypi.com/software/
Change the boot order so that the Raspberry Pi will boot from flash drive by default [instead of SD card]:
Run the Raspberry Pi Imager and select Raspberry Pi 4, Operating System: Misc Utilities: Boot Loader: USB Boot, Choose Storage: your flashdrive. !! Do not select any other drive otherwise you brick your computer.!!
Write the selected option to the flashdrive. Ignore requests from your computer to format the flash drive
Temporarily attach a display to the Raspberry Pi and energize the Raspberry Pi.
When the screen is green and the green LED is flashing the process is completed.
Now install the Operating System:
Run the Raspberry Pi Imager again and select Raspberry Pi 4, Operating System: Raspberry Pi OS 64 bit, Choose Storage: Your flashdrive. ! Do not select any other drive otherwise you brick your computer.!!
Edit the configuration on next screen:
Set hostname, username, password, configure wireless lan (as shown by instructor), set local timezone to Phoenix and keyboard to "US".
Under Services enable SSH and password authentication.
Write the operating system to the flash drive.
Ignore requests to format the flash drive.
Temporarily attach a display to the Raspberry Pi and energize the Raspberry Pi. When the system starts properly and shows the desktop you can disconnect the display.
Further configure the Raspberry Pi:
Connect the network patch cable to your notebook and Raspberry Pi
Open Power Shell (Windows) or Terminal (Mac) and type ping hostname.local replacing hostname with the name you choose above.
If the Raspberry Pi responds we connect to it with ssh username@hostname.local. Accept the certificate, type your password and you are connected.
Configure the Raspberry Pi by executing sudo raspi-config in the Terminal / Power Shell.
Under Interface Options, select VNC and enable it, select I2C and enable it, select SPI and enable it.
Exit and reboot.
Now you can connect with VNC from your notebook computer to the Raspberry Pi
Donwload Real VNC Viewer {RealVNC is a good option]. You dont need the VNC Server. You do not need to make an account with the VNC Viewer provider.
Start VNC Viewer.
In the line on the top of the window type hostname.local where hostname is the name you just configured for your raspberry pi.
Accept the security certificate and login with your username and password. If you forgot your password, instructors can not retrieve it.
Update the Operating System
Open terminal on Raspberry Pi which is the black icon on top left
Execute sudo apt-get update in the terminal.
Decide if you have time to execute sudo apt-get upgrade in the terminal. This will take at least 10 minutes to complete especially if 20 other students are using the network for the same purpose.
Add additional WiFi credentials
If you plan to use the Raspberry Pi on campus, you can add UAWiFi to the list of known SSIDs. You will want to edit the network by clicking on the wireless symbol on the top right. Please note, that your password is entered in readable form.
Security: WPA/WPA2 Enterprise
Protection PEAP
Anonymous: Empty
Domain: arizona.edu
Certificate: None
No CA certificate is required needs to be selected
PEAP version: automatic
Inner authentication: MSCHAPv2
Username: your netid
Password: your netid password
You can also add the WiFi settings from your home.
If your raspberry pi shows text on a monitor, borrow an SD card from last year and we will switch the boot order to use USB first.
Connect Raspberry Pi to Monitor and Keyboard and boot.
Open Terminal (top left corner symbol)
sudo apt-get update
sudo raspi-config
either option 3 for boot options
or advanced options and select boot order (USB)
Please verify following:
You have the raspberry pi power cable connected and power is provided. The red power LED on the raspberry needs to be on constantly.
If it goes off and on, the power supply is insufficient.
You have the SD card or USB Flash drive mounted properly. When you provide power, the green LED on the raspberry pi is turning on and and off many times for about 30 seconds. The green LED is in proximity to the red power LED.
If the LED flashes only for a short time, you need a new image burned onto the SD card or USB Flash drive. It will need to complete the boot sequence.
When you connect the Ethernet cable, one of the two lights on the receptacle is on constantly and the other might flash or is on constantly.
If no lights are on on the receptacle on the raspberry pi you need to make sure that your network cable is plugged in and your computer is on.
You need to make sure the network adaptor is enabled on your computer (Windows Search: View Network Connections, right click on wired adaptor, Enable)
If you are using USB to Ethernet adaptor you might need to install correct driver software from the manufacturer. ASIX for example has different drivers for their 100Mbit and 1000Mbit model.
You might need to update the driver for the Ethernet adaptor (Windows Search: Computer Management, Right Click on Adapter, Update Driver)
If your ssh connections disconnects with "no permission" or "not authenticated" you might want to delete the file called known_hosts in the ".ssh" folder in your home directory. This will reset passwords on previous connections. On Windows powershell you can list the content of .ssh with ls ~/.ssh and del ~/.ssh/known_hosts . This will delete any saved passwords and certificates of any previous connections.
Run sudo netstat -ltpn on the Raspberry Pi. It needs to show that vnc-server is running and connected to a port.
Open port 5900 on your computer's firewall. If you are using a windows computer:
Click on Start then on Control Panel.
Click on Windows Defender Firewall and then click on Advanced Settings.
Right click on Inbound Rules then on New Rule:
Select Port and click on Next:
Enter a specific TCP and local port (5900) and click on Next:
Click on Next and allow the connection
Name the rule "VNC" and click on Finish
There is an option to switch window manager on Raspberry Pi in raspi-config, advanced options, wayland, to x11 backend. Most issues were resolved without looking into that.
There is also option to turn off security certificates for VNC on the raspberry pi. Most issues were resolved without looking into that.