Day 1 of 5
⏱ ~60 minutes
Raspberry Pi in 5 Days — Day 1

Setup and SSH

Day 1 is getting your Pi running without a monitor, keyboard, or mouse — headless setup. This is how every professional uses a Pi.

Hardware You Need

Raspberry Pi 5 (4 GB is fine for most projects) or Pi 4. MicroSD card (32 GB minimum, 64 GB recommended — use a Class 10 / A2 rated card for good performance). USB-C power supply (5V/5A for Pi 5, 5V/3A for Pi 4 — don't cheap out, underpowering causes random crashes). Optional: a case with a fan for the Pi 5 (it runs hot).

Flash Raspberry Pi OS

Download and install Raspberry Pi Imager (free, from raspberrypi.com). Select your Pi model, choose Raspberry Pi OS (64-bit, Lite for headless). Click the gear icon to pre-configure: set hostname, username/password, enable SSH, configure WiFi SSID and password. Flash to the microSD. This pre-configuration means you never need a monitor — the Pi boots and connects to WiFi automatically.

SSH and First Configuration

Insert the SD card, connect power. Wait 60–90 seconds for first boot. Find the Pi's IP address in your router's DHCP table, or use ping raspberrypi.local (mDNS). Connect: ssh [email protected]. Run sudo raspi-config: expand filesystem (important!), set locale/timezone, enable I2C and SPI interfaces (needed for sensors), update the tool. Run sudo apt update && sudo apt upgrade -y.

bash
#!/bin/bash
# First-boot setup script for Raspberry Pi
# Run after SSH login: bash setup.sh

set -e
echo "Raspberry Pi first-boot setup..."

# Update everything
sudo apt update && sudo apt upgrade -y

# Install useful tools
sudo apt install -y git vim htop tree curl wget tmux

# Install Python tools
sudo apt install -y python3-pip python3-venv python3-dev
pip3 install --upgrade pip

# Install GPIO and sensor libraries
pip3 install RPi.GPIO gpiozero smbus2 adafruit-blinka
pip3 install adafruit-circuitpython-dht

# Enable I2C and SPI via raspi-config (non-interactive)
sudo raspi-config nonint do_i2c 0   # 0 = enable
sudo raspi-config nonint do_spi 0
sudo raspi-config nonint do_camera 0

# Set up SSH key authentication (paste your public key)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# echo 'your-public-key-here' >> ~/.ssh/authorized_keys

# Check hardware
echo ""
echo "=== Hardware Info ==="
vcgencmd get_throttled  # 0x0 = no throttling
vcgencmd measure_temp   # should be < 50°C at idle
free -h
df -h /

echo ""
echo "Setup complete! Reboot: sudo reboot"
💡
vcgencmd get_throttled returns a hex code. 0x0 = all good. 0x50005 means undervoltage detected and thermal throttling — you need a better power supply or cooling. Check this whenever your Pi behaves strangely.
📝 Day 1 Exercise
Get Your Pi Online and Configured
  1. Flash Raspberry Pi OS using Raspberry Pi Imager. Use the gear icon to set hostname, WiFi, and enable SSH before flashing.
  2. Boot the Pi and connect via SSH. Time how long until ping raspberrypi.local responds (should be under 2 minutes).
  3. Run vcgencmd measure_temp and vcgencmd get_throttled. Is temperature under 50°C at idle? Is throttled status 0x0?
  4. Run the setup script above. Verify Python, GPIO libraries, and I2C/SPI are enabled.
  5. Connect from VS Code using Remote-SSH extension (install 'Remote - SSH' extension, connect to [email protected]). Edit files directly on the Pi.

Day 1 Summary

  • Raspberry Pi Imager pre-configures WiFi, SSH, and credentials — no monitor needed
  • Always run vcgencmd get_throttled to check for underpowering (0x0 = healthy)
  • raspi-config enables I2C, SPI, camera, and other interfaces needed for sensors
  • VS Code Remote-SSH makes Pi development as comfortable as local development
Challenge

Set up a static IP address on your Pi so it always gets the same address on your network (either via DHCP reservation in your router or by editing /etc/dhcpcd.conf). Then set up SSH key authentication so you never need to type a password. Finally, configure ~/.ssh/config on your laptop so you can connect with just ssh pi.

Finished this lesson?