UCSD Robocar
ECE / MAE 148
Raspberry Pi Setup Guide
UCSD Jacobs School of Engineering

Raspberry Pi 5
Setup Guide

Complete reference for ECE/MAE 148 — covering OS flashing with the Legacy 64-bit image, hostname and WiFi configuration, hardware assembly, SSH access, system settings, date/time sync, and backup procedures for DonkeyCar 5.2.x compatibility.

🍓Raspberry Pi 5
💾128GB microSD
🐍Python 3.11
🚗DonkeyCar 5.2.x
01

Install Raspberry Pi Imager

Download and launch the official flashing tool for your Raspberry Pi

Raspberry Pi Imager is the official tool for writing OS images to a microSD card. It handles downloading the OS, verifying the image, writing it to your card, and applying customizations like hostname, WiFi, and SSH — all in one place. Always use the most current version.

New to this? Think of the microSD card as the Pi's hard drive. Flashing the OS means copying the operating system onto that card so the Pi has something to boot from. Imager automates the entire process.

🚨
Critical — Use Legacy 64-bit Only
You must install Raspberry Pi OS (Legacy, 64-bit) — the Debian Bookworm port. This ships with Python 3.11 and is the only version compatible with DonkeyCar 5.2.x.

Do NOT install Debian Trixie. Trixie ships with Python 3.13, which breaks DonkeyCar and is the root cause of all camera issues reported in this class.
1
Download Raspberry Pi Imager
Navigate to the official Raspberry Pi software page and download the latest Imager for your operating system (Windows, macOS, or Linux). Install it normally like any other application.
Official download URL
https://www.raspberrypi.com/software/
2
Insert Your microSD Card
Insert your 128 GB microSD card into your computer using a USB hub, card adapter, or built-in slot — whichever is available on your machine. The card must be detected by your computer before launching the Imager.
3
Select Device
Open Raspberry Pi Imager. Under Device, choose Raspberry Pi 5. This tells the Imager which hardware you are targeting so it can select the correct kernel, firmware, and drivers for the OS image.
SettingValueWhy
DeviceRaspberry Pi 5Selects the correct ARM64 kernel and firmware
OSRaspberry Pi OS (Legacy, 64-bit)Python 3.11 — required for DonkeyCar 5.2.x
StorageYour 128 GB microSD cardTarget device for the OS image
02

Flash the OS — Choose the Correct Image

Select Raspberry Pi OS Legacy 64-bit (Bookworm) — not Trixie
Critical

After selecting your device, click OS to choose the operating system. You must scroll down to find the Legacy version. The default recommended image shown at the top of the list is Trixie (Python 3.13), which will break DonkeyCar — do not select it.

Raspberry Pi Imager OS selection showing Legacy 64-bit highlighted
Fig 2.1 Select "Raspberry Pi OS (Legacy, 64-bit)" — the Bookworm port with Python 3.11. Do NOT select the default Trixie image shown at the top of the list.
Python Version Matters
Raspberry Pi OS (Legacy, 64-bit) → Python 3.11 → DonkeyCar 5.2.x works ✓
Raspberry Pi OS (Debian Trixie) → Python 3.13 → DonkeyCar broken ✗ / camera broken ✗

Why the Legacy Image?

DonkeyCar 5.2.x depends on several Python packages whose C extensions are only compiled for Python 3.11. Attempting to install them on Python 3.13 will either fail entirely or produce silent runtime errors that show up as camera failures — the most common issue reported in this class. There is no workaround; you must use the Legacy image.

03

Configure Hostname

Set a unique, class-standard hostname so your Pi is findable on the network

Before writing the image, click NEXT → Edit Settings (or the gear icon in older versions) to open the customization wizard. The first thing to set is your hostname. This is the human-readable name your Pi broadcasts on the local network — it is how you SSH into it using .local address resolution instead of having to look up an IP address.

Hostname Naming Convention

Class Standard — Follow Exactly
Format: ucsdrobocar-148-XX where XX is your two-digit team number.
Example: Team 7 → ucsdrobocar-148-07
TA unit: ucsdrobocar-148-TA
Raspberry Pi Imager hostname customization screen showing ucsdrobocar-148-06
Fig 3.1 Set your hostname to ucsdrobocar-148-XX — replace XX with your two-digit team number (e.g., 07 for Team 7).

Localization Settings

On the Localization tab, set the fields below. These ensure the Pi uses the correct timezone and keyboard layout, which prevents subtle issues with scheduled tasks and terminal input.

FieldValue
Capital cityWashington, D.C. (United States)
Time zoneAmerica/Los_Angeles
Keyboard layoutus
Raspberry Pi Imager localization screen showing US timezone and keyboard
Fig 3.2 Localization settings — set the timezone to America/Los_Angeles and the keyboard layout to US.
04

Set Username, Password & WiFi

Configure login credentials and pre-load the class WiFi network

Username & Password

On the User tab, set the username to pi. This is the account you will use every time you SSH into the Pi. Choose a password you will remember and share only with your team.

Raspberry Pi Imager username screen showing pi and password fields
Fig 4.1 Set the username to pi and choose a secure password. The TA reference password shown here (ucsd148TA) is for documentation purposes only — do not use it on your own car.
Keep Your Password Secure
Share your password only with your team. Do not use the TA password on your car — it is shown in this guide for reference only. Anyone who knows your password can SSH into your Pi and modify your DonkeyCar configuration.

WiFi Configuration

On the Wi-Fi tab, enter the class network credentials. Pre-loading WiFi here means the Pi will automatically connect to the network on its very first boot, so you can SSH in right away without needing a monitor or keyboard attached.

Raspberry Pi Imager WiFi screen showing UCSDRoboCar SSID
Fig 4.2 Enter the class WiFi credentials so the Pi connects automatically on first boot. Use the credentials from the table below.
LocationSSIDPassword
On-campus (class)UCSDRoboCarUCSDrobocars2018
Home / hotspotYour network nameYour network password
Pro Tip — Add Your Phone Hotspot Later
You can add a second WiFi network (such as your phone's hotspot) at any time after first boot via SSH. This gives you a backup connection when the class WiFi is unavailable or congested. See Section 8 for details.
05

Enable SSH & Write the Image

Enable remote access, then safely flash and eject the microSD card

Enable SSH

SSH (Secure Shell) is the protocol that lets you control the Pi remotely from your laptop over the network — no monitor or keyboard required. On the Remote Access tab, toggle Enable SSH on and select Use password authentication. Without this step, the Pi will boot but you will have no way to connect to it.

Raspberry Pi Imager SSH authentication screen with Enable SSH toggled on
Fig 5.1 Enable SSH and select "Use password authentication." This is required for all remote terminal access over WiFi.

Raspberry Pi Connect (Optional)

The Raspberry Pi Connect tab offers a cloud-based remote desktop service from Raspberry Pi. This is not needed for this class — leave it disabled.

Raspberry Pi Imager connect screen with Enable toggle off
Fig 5.2 Leave Raspberry Pi Connect disabled — it is not used in this course.

Review and Write

After completing all the customization tabs, the Imager will show a summary of everything you configured. Review it carefully, then click WRITE. The Imager will download the OS image (if not already cached) and flash it to your card — this typically takes 5–15 minutes.

Raspberry Pi Imager write image summary screen showing all customizations
Fig 5.3 Review the summary to confirm your hostname, username, WiFi, and SSH settings are all correct before clicking WRITE.

Write Complete — Eject Safely

When writing finishes, the Imager will show a success screen. Click Finish, then follow this exact ejection sequence to avoid corrupting the card:

1
Eject via Your OS First
Use your operating system's eject function (right-click the card → Eject on macOS/Windows, or umount /dev/sdX on Linux) to safely flush all pending writes to the card. Do not physically remove the card yet.
2
Physically Remove the Card
Only after your OS confirms it is safe to remove, carefully pull out the microSD card from the adapter or slot. Skipping the software eject step can corrupt the OS files you just flashed, requiring a full re-flash.
Raspberry Pi Imager write complete screen
Fig 5.4 Write complete. Click Finish, eject the card through your OS, then physically remove it.
🚨
Do Not Skip the Software Eject
Pulling the card out without a software eject is the most common cause of corrupted OS installations. If the card is corrupted, you will need to re-flash from scratch. Always eject through your OS first.
06

Cooling & Hardware Assembly

Install the cooler, case, and microSD before first boot

The Raspberry Pi 5 runs significantly hotter than previous models under sustained workloads like neural network inference. The active cooler (heatsink + fan) that comes with your kit is required — not optional. Assemble everything before powering on for the first time.

Step-by-Step Assembly

1
Clean the Board Surface
If the board was previously used by another team, clean the top of the processor and other chips with isopropyl alcohol wipes before applying new thermal pads. Old residue reduces thermal conductivity and can cause overheating.
2
Remove the Thermal Pad Plastic Film
Each thermal pad ships with a thin plastic protective film on both sides. Peel off both films before mounting the cooler. This is one of the most common assembly mistakes — if the plastic is left on, no heat will transfer and the Pi will overheat immediately under load.
3
Connect the Fan Cable
Locate the small fan connector port on the Raspberry Pi 5 board (it has a cover that snaps off). Connect the fan cable — the connector is keyed so it can only be inserted one way. Do not force it.
4
Install into Case
Place the Pi into the case, aligning all port cutouts (USB, HDMI, Ethernet, USB-C power). Attach the rubber feet to the bottom. Secure the board with the provided screws and snap on the cover. Verify all ports remain accessible through the case openings.
5
Insert the microSD Card
With the Pi seated in its case, insert the freshly flashed microSD card into the SD card slot on the underside of the board. Press it in until you feel it click firmly into place.
Power Supply Requirements
For initial setup, use the provided USB-C 5V/5A power supply. The Pi may show a desktop warning about power delivery — this is harmless and expected. The Pi is looking for a USB-C PD (Power Delivery) handshake that not all power supplies support. The warning does not affect functionality and can be suppressed later in raspi-config.
07

First Boot & SSH Connection

Power on the Pi and connect remotely over WiFi

Plug in the USB-C power supply to boot the Pi. On first boot, the Pi automatically performs initial setup tasks — expanding the filesystem, creating your user account, and applying all the customizations you configured in the Imager. This process can take 2–5 minutes and the Pi may reboot once on its own during this time. The green activity LED on the board will flash rapidly while it works. Do not unplug it.

Connect via SSH

Once the Pi has finished its initial boot sequence and connected to your WiFi network, you can SSH into it from any device on the same network. Open a terminal on your laptop and run the command below, replacing XX with your two-digit team number.

Your laptop terminal
ssh pi@ucsdrobocar-148-XX.local

# Example for Team 5:
ssh pi@ucsdrobocar-148-05.local
How .local Hostnames Work
The .local suffix uses a protocol called mDNS (multicast DNS) to automatically resolve your Pi's hostname to its IP address on the local network. This means you never need to look up or remember the Pi's IP address — as long as your laptop and the Pi are on the same WiFi network, the hostname will resolve automatically. On Windows, mDNS requires Bonjour (see troubleshooting table below if it does not work).

First Connection Security Prompt

The first time you SSH to a new Pi, your terminal will display a message asking you to verify the host's identity. This is a standard SSH security check. Type yes to accept and save the Pi's fingerprint — your computer will not ask again for this host.

Expected first-connection prompt
# The authenticity of host 'ucsdrobocar-148-05.local' can't be established.
# ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxx.
# Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Troubleshooting First Boot Connection

ProblemCauseFix
ssh: Could not resolve hostnamePi has not finished booting, or mDNS is not working on your laptopWait 2–3 more minutes. Ensure both devices are on the same WiFi network. On Windows, install Bonjour Print Services to enable mDNS.
Connection refusedSSH daemon has not started yet — Pi is still bootingWait and retry. The green activity LED should slow down or stop fast-flashing before SSH becomes available.
Permission deniedIncorrect passwordRe-check the password you set in the Imager customization step.
Cannot find Pi at all after several minutesWiFi credentials were entered incorrectly during flashingRe-flash the card with the correct WiFi credentials, or temporarily connect the Pi to your router via Ethernet cable for initial setup.
08

WiFi Configuration

List available networks, add additional access points, and find your IP address

Once connected via SSH, you can manage WiFi networks directly from the command line. The Pi uses NetworkManager to handle wireless connections. You can use either nmtui (a simple text-based menu UI) or nmcli (a direct command-line tool).

List Available WiFi Networks

Pi terminal
sudo nmcli device wifi list   # List all visible WiFi networks

Add a New WiFi Network via nmtui (Recommended)

nmtui is the easiest way to add new networks because it provides an interactive menu you can navigate with arrow keys. Launch it and choose Activate a connection to connect to a visible network, or Edit a connection to add one manually (for example, a hidden SSID like your phone hotspot).

Pi terminal
sudo nmtui
nmtui text interface showing Activate a connection highlighted
Fig 8.1 In the nmtui menu, use "Activate a connection" to join a visible network, or "Edit a connection" to add a network manually by SSID and password.

Add a Network via Command Line (Alternative)

Pi terminal
# Connect to a WiFi network by SSID and password
sudo nmcli device wifi connect "NETWORK_NAME" password "NETWORK_PASSWORD"

# Class network example:
sudo nmcli device wifi connect "UCSDRoboCar" password "UCSDrobocars2018"

Get the Pi's IP Address

If you ever need the Pi's numeric IP address (for example, to use an SSH client that does not support .local hostnames), run ifconfig and look at the wlan0 interface. The inet field shows the current IPv4 address.

Pi terminal
ifconfig
# Look for wlan0 → inet field (e.g., 192.168.x.x)

Install nano Text Editor

nano is a simple command-line text editor that makes editing configuration files much easier than the default vi. Install it now — it will be needed in later steps.

Pi terminal
sudo apt-get update
sudo apt-get install nano
09

System Settings

Change hostname, password, and system configuration with raspi-config

If you need to change the hostname or password after flashing — for example, if you inherited a Pi from a previous team — use raspi-config or the commands below. Always follow the class hostname standard so your car is identifiable on the network.

Change Hostname with raspi-config

raspi-config is the Raspberry Pi's built-in configuration tool. It provides a simple menu for changing common system settings. Launch it from the terminal and navigate to System Options → S4 Hostname to update your hostname.

Pi terminal
sudo raspi-config
# Navigate: System Options → S4 Hostname
# Set to: ucsdrobocar-148-XX (replace XX with your team number)
raspi-config menu showing S4 Hostname highlighted
Fig 9.1 In raspi-config, navigate to System Options → S4 Hostname to set the class-standard hostname.

Change Hostname via Command Line

Alternatively, you can update the hostname directly from the terminal. You must update it in two places — the active hostname via hostnamectl, and the local hosts file at /etc/hosts. Skipping either step will cause errors.

Pi terminal — replace xxx-yy with your class and team number
# Step 1: Set the active hostname
sudo hostnamectl set-hostname ucsdrobocar-xxx-yy

# Step 2: Update the hosts file to match
sudo nano /etc/hosts
# Find the line that reads: 127.0.1.1  old-hostname
# Change it to:              127.0.1.1  ucsdrobocar-xxx-yy
# Save with Ctrl-X → Y → Enter
Update Both Files
If you only run hostnamectl set-hostname without updating /etc/hosts, every sudo command will print the warning: "sudo: unable to resolve host ucsdrobocar-xxx-yy". This does not break anything, but it clutters your terminal output. Update both files to avoid it.

Change Password

Pi terminal
passwd   # Changes the password for the current user (pi)

View Current System Information

Pi terminal
hostnamectl   # Shows hostname, OS version, kernel, and architecture

Reboot to Apply All Changes

Pi terminal
sudo reboot now
10

Date & Time Configuration

Ensure the system clock is correct, or software installs will fail

The Raspberry Pi 5 does not have a battery-backed real-time clock (RTC), meaning it loses track of the current time whenever it is powered off and disconnected from the internet. If the Pi's clock is wrong, apt will refuse to install packages because SSL/TLS certificates will appear to be expired or not yet valid. Always check the date before debugging installation failures.

Check the Date First When Updates Fail
If apt update or pip install fails with SSL or certificate errors, the system clock is almost certainly wrong. Run date to check it before asking for help or debugging further.

Check the Current Date

Pi terminal
date   # Prints the current system date and time

Manually Set Date and Time

If the Pi is not yet connected to the internet or NTP has not synced, set the time manually using the command below. Replace the timestamp with the current date and time.

Pi terminal
sudo date -s '2025-09-15 10:30:00'   # Replace with current date/time

Set the Timezone

Pi terminal
sudo dpkg-reconfigure tzdata
# Navigate: America → Los_Angeles

Install NTP for Automatic Time Sync

NTP (Network Time Protocol) automatically synchronizes the system clock with internet time servers whenever the Pi has a network connection. Install it once and it will keep the clock correct on every subsequent boot.

Pi terminal
sudo apt-get update
sudo apt-get install ntp

# Force an immediate time sync:
sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start

# Reboot to confirm the time persists correctly:
sudo reboot now
Force a Re-Sync Anytime
If the time drifts later (for example, after the Pi was offline for an extended period), you can force a manual re-sync at any time without reinstalling NTP: sudo ntpd -q -g
11

GUI Settings & Filesystem Expansion

Disable the desktop GUI to free RAM, and expand the filesystem to use the full SD card

Disable the GUI on Boot (Optional but Recommended)

Since you interact with the Pi exclusively over SSH, the desktop graphical environment (GUI) runs in the background doing nothing useful — consuming RAM and CPU that DonkeyCar's neural network inference could use instead. Disabling it is safe for headless operation and frees a noticeable amount of memory.

When You May Want to Keep the GUI
If you are using sensors that require ROS visualization tools like RViz (for example, Intel RealSense cameras or LiDAR), keep the GUI enabled — those tools need the X display server to render graphics. For basic DonkeyCar driving, disabling the GUI is fine.
Pi terminal
sudo raspi-config
# Navigate: System Options → S5 Boot → B1 Console (Text console)
# This sets the Pi to boot to a text terminal instead of the desktop
raspi-config boot options showing B1 Console Text console highlighted
Fig 11.1 Select "B1 Console" under boot options to disable the desktop GUI on startup and free RAM for inference.

Expand the Filesystem

When the Imager writes the OS to your 128 GB card, it only creates a partition large enough to hold the OS image itself (~2–4 GB). The rest of the card is unused unallocated space. You must expand the filesystem to claim all remaining space — otherwise you will run out of disk space during DonkeyCar installation.

Pi terminal
sudo raspi-config
# Navigate: Advanced Options → A1 Expand Filesystem
# Select OK and reboot when prompted
raspi-config Advanced Options menu with A1 Expand Filesystem highlighted
Fig 11.2 Advanced Options → A1 Expand Filesystem makes the entire 128 GB of your SD card available for use.

Update and Upgrade the System

After expanding the filesystem, run a full system update to install the latest security patches and ensure all package lists are current. Do this before installing DonkeyCar.

Pi terminal
sudo apt update      # Refresh package lists from the internet
sudo apt upgrade     # Install available package updates (press Y when prompted)
sudo reboot now      # Reboot to apply any kernel updates
Do NOT Run apt full-upgrade
sudo apt full-upgrade can pull in kernel and firmware upgrades that break hardware compatibility with this class's software stack. Always use sudo apt upgrade (without "full") to install only safe package-level updates.
12

Passwordless SSH (Key-Based Auth)

Set up SSH key pairs to connect without typing a password every time
Optional

Key-based SSH authentication lets you connect to the Pi without typing a password each time. Instead of a password, your laptop uses a cryptographic key pair — a private key that stays on your laptop and a public key stored on the Pi. When you connect, SSH verifies the keys automatically. This is both more convenient and more secure than password auth.

Step 1 — Generate a Key Pair on Your Laptop

Run this command on your laptop (not the Pi). When prompted for a save location and passphrase, pressing Enter each time will use the default location (~/.ssh/id_rsa) with no passphrase — which is fine for development.

Your laptop terminal
# Generate an RSA key pair
ssh-keygen -t rsa
# Press Enter to accept the default save location (~/.ssh/id_rsa)
# Press Enter twice to skip the passphrase (or set one if you prefer)

Step 2 — View Your Public Key

The public key is the part you share with other machines. Print it out so you can copy it in the next step.

Your laptop terminal
# macOS / Linux / WSL:
cat ~/.ssh/id_rsa.pub

# Copy the entire output — it starts with "ssh-rsa AAAA..."

Step 3 — Add the Key to the Pi's Authorized Keys

SSH into the Pi using your password (as usual), then create the .ssh directory and paste your public key into the authorized_keys file. The Pi will trust any connection that presents the matching private key.

Pi terminal (SSH into Pi first, then run these commands)
cd ~
mkdir .ssh          # Safe to ignore "File exists" error if it already exists
chmod 700 .ssh
sudo chown pi:pi .ssh
nano .ssh/authorized_keys
# Paste your public key on its own line (the entire ssh-rsa AAAA... string)
# Save: Ctrl-X → Y → Enter
chmod 600 .ssh/authorized_keys

Step 4 — Test the Connection

Your laptop terminal
ssh pi@ucsdrobocar-148-XX.local
# Should connect WITHOUT prompting for a password
Bonus: Passwordless File Transfers Too
Once key-based auth is working, tools like scp and rsync also work without passwords — making it easy to transfer trained DonkeyCar models and collected data logs between your laptop and the Pi.
13

Backup & Troubleshooting

Back up your configured SD card and fix the most common setup issues
💾
Back Up Your SD Card Before Continuing
You have spent significant time configuring this Pi. Before proceeding to DonkeyCar installation, create a full backup image of your SD card. If anything goes wrong during software installation, you can restore this clean working state in minutes instead of starting the entire setup from scratch.

How to Back Up Your SD Card

Shut down the Pi gracefully (sudo shutdown now), wait for the green LED to stop blinking, then unplug power and remove the SD card. Insert it into your laptop and use a disk imaging tool to create a complete copy:

On macOS or Linux, use dd in a terminal to write a bit-for-bit copy to a .img file. On Windows, use Win32DiskImager — select your card as the source, choose a destination file path, and click Read.

Common Issues & Fixes

ProblemCauseFix
Camera not working, all-black feedInstalled Debian Trixie (Python 3.13) instead of the Legacy imageRe-flash with Raspberry Pi OS Legacy 64-bit (Bookworm). There is no software fix — you must re-flash the card.
apt update fails with SSL or certificate errorsSystem clock is set to the wrong date/timeRun date to check. If incorrect, follow Section 10 to set the correct time and install NTP.
Pi not found on network after rebootWiFi credentials were entered incorrectly, or Pi is still bootingWait 3 minutes. If still unreachable, re-check the SSID/password and re-flash, or temporarily use an Ethernet cable.
sudo: unable to resolve hostHostname was updated with hostnamectl but /etc/hosts was not updated to matchEdit /etc/hosts and update the 127.0.1.1 line to match the new hostname. See Section 9.
No space left on deviceFilesystem was not expanded after flashingRun sudo raspi-config → Advanced Options → A1 Expand Filesystem, then reboot. See Section 11.
Pi reboots unexpectedly under loadPower supply cannot deliver enough current — causes a voltage brownoutUse a 5V/5A (25W+) USB-C power supply. Underpowered supplies cause the Pi to reboot during CPU-intensive tasks like inference.
Fan not spinningFan cable not connected, or plastic protective film not removed from thermal padsPower off, disassemble the cooler, remove all plastic film from both sides of each thermal pad, and reconnect the fan cable firmly.
Connection refused on SSHSSH was not enabled during the Imager customization stepRe-flash and enable SSH on the Remote Access tab, or connect a keyboard and monitor and run sudo raspi-config → Interface Options → SSH.

Verify Your Python Version

After completing setup, run the following commands to confirm you have the correct Python version and OS release for DonkeyCar compatibility.

Pi terminal
python3 --version
# Expected output: Python 3.11.x
# If you see Python 3.13.x — you flashed Trixie, not Legacy. You must re-flash.

cat /etc/os-release
# Expected: VERSION_CODENAME=bookworm
# If you see trixie — you must re-flash with the Legacy 64-bit image.
Setup Complete
If python3 --version shows 3.11.x and /etc/os-release shows bookworm, your Pi is correctly configured and ready for DonkeyCar installation. Proceed to the DonkeyCar guide.

UCSD Jacobs School of Engineering — ECE/MAE 148 Intro to Autonomous Vehicles