🛠 Premier démarrage de la Zero 2 W sans écran (headless)
Objectives
Unbox the Zero 2 W: flash Raspberry Pi OS with pre-seeded Wi-Fi/SSH, boot headless (without a screen or keyboard), connect via SSH, and run initial system commands. You will also understand the two micro-USB ports on the board: one is reserved for power, while the other (OTG) handles data.
Hardware
- 1 Raspberry Pi Zero 2 W (RP3A0 quad Cortex-A53 @ 1 GHz, 512 MB LPDDR2)
- 1 high-quality microSD card (8 GB min.), a card reader
- 1 high-quality 5 V / 2 A power supply + short, thick micro-USB cable — The Zero 2 W consumes ~350 mA typically and, a critical particularity of the Zero range, it has NO undervoltage detection: a weak power supply corrupts the SD card without any warning message
- A PC (no screen needed: the mini-HDMI port will remain empty)
Complete Code
With Raspberry Pi Imager: choose "Raspberry Pi OS Lite (32-bit)", then in the settings (Ctrl+Shift+X) check: hostname "zero2w", enable SSH with password, Wi-Fi + country. Otherwise, via command line, after inserting the card into the PC:
# Vérifier que la carte est bien vue (remplacer sdb par votre périphérique !)
lsblk
# Copie brute d'une image (alternative à Imager) :
sudo dd if=2024-*raspberry-pi-os-lite.img of=/dev/sdb bs=4M status=progress conv=fsync
# Premier boot terminé, côté PC :
ssh pi@zero2w.local
# Puis, sur la Zero 2 W :
sudo apt update && sudo apt full-upgrade -y
vcgencmd get_throttled # doit répondre throttled=0x0
df -h / # place restante sur la SD
Expected Verification
After 1 to 2 minutes, "ping zero2w.local" responds and SSH works. "cat /proc/device-tree/compatible" mentions "raspberrypi,model-zero-2-w": the correct device tree is loaded. "vcgencmd get_throttled" returns 0x0 — a sign that the power supply is holding up.
Common Errors
- Poor power supply or micro-USB cable: lockups and SD corruption without any warning (no under-voltage detection on the Zero range). Use 2 A, short cable.
- Plugging the power supply into the data port instead of the port marked POWER: the board does not boot (or boots in gadget mode).
- Forgetting to pre-seed SSH/Wi-Fi and then looking for a screen: the mini-HDMI port and composite pads exist, but Imager avoids all this wiring.
- "dd" on the wrong device: check lsblk twice, otherwise goodbye to your PC's disk.
- Generic 64-bit image: the standard image for this board is the 32-bit armhf; third-party aarch64 (OpenWrt, moode) work but are chosen deliberately.
Other tutorials for this board
- Se connecter au Wi-Fi (et comprendre les limites 2,4 GHz / WPA2)
- Surveiller la température et la fréquence de la Zero 2 W
- GPIO en Python : LED et bouton avec gpiozero
- Le tour de passe-passe « clé USB Linux » : Ethernet sur USB (g_ether)
- Serveur de blocage de pub réseau avec Pi-hole
- Remettre une Zero 2 W en état de boot : usbboot et boot files
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash