How to set up a Raspberry Pi 4 for the first time?

 

What You Need for Raspberry Pi 4 Setup



 Required Hardware

  • Raspberry Pi 4 board

  • microSD card (16GB+ recommended, Class 10)

  • Power supply (USB-C, 5V 3A)

  • microSD card reader (for your PC or laptop)

  • HDMI cable (micro-HDMI to HDMI)

  • Monitor (or headless setup option)

  • Keyboard and mouse

  • Internet connection (Wi-Fi or Ethernet)


 Step-by-Step Setup (With Monitor)

Step 1: Flash Raspberry Pi OS to microSD

  1. Download Raspberry Pi Imager:
    https://www.raspberrypi.com/software

  2. Insert the microSD card into your PC.

  3. Open Raspberry Pi Imager and:

    • Select OS: e.g., Raspberry Pi OS (32-bit)

    • Choose storage: your microSD card

    • Click Write → wait until it finishes


Step 2: Boot Your Raspberry Pi 4

  1. Insert the microSD card into the Pi.

  2. Connect:

    • Monitor via micro-HDMI

    • USB keyboard and mouse

    • Ethernet cable (or Wi-Fi will be set up later)

  3. Plug in the power supply → Raspberry Pi will boot.


Step 3: First-Time Setup Wizard

  1. Set language, country, and keyboard.

  2. Connect to Wi-Fi (if not using Ethernet).

  3. Change the default password (default: pi / raspberry).

  4. Let it check for and install updates.

  5. (Optional) Enable SSH, VNC, or remote access.


 Headless Setup (No Monitor)

If you want to set it up without a display:

Step 1: Flash Raspberry Pi OS (Lite or Full)

Same as before — use Raspberry Pi Imager, but:

  • After flashing, open the boot partition (appears as a USB drive).

Step 2: Enable SSH

  • Create an empty file named ssh (no extension) in the boot partition.

Step 3: Set Up Wi-Fi

  • Create a file named wpa_supplicant.conf in the boot partition with this content:

conf

country=US ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YourWiFiName" psk="YourWiFiPassword" key_mgmt=WPA-PSK }

Replace "YourWiFiName" and "YourWiFiPassword" with your actual Wi-Fi credentials.

Step 4: Boot and Find IP Address

  1. Insert microSD into Pi, power it up.

  2. Use your router’s admin page or a tool like Advanced IP Scanner to find the Pi’s IP.

  3. Open a terminal and run:

bash

ssh pi@<IP address>

(Default password: raspberry)


 Optional Setup Tips

  • Update your system:

bash

sudo apt update && sudo apt full-upgrade
  • Install useful tools:

bash

sudo apt install git python3-pip build-essential
  • Enable GPIO access with gpiozero or RPi.GPIO libraries

评论

此博客中的热门博文

How To Connect Stm32 To PC?

Detailed Explanation of STM32 HAL Library Clock System

How to add a GPS sensor to ESP32 for Wokwi?