🛠 Se connecter au Wi-Fi (et comprendre les limites 2,4 GHz / WPA2)
Objectives
Configure and diagnose the Wi-Fi connection on the Zero 2 W: the onboard radio combo (Cypress/Infineon class 43430 chip) is limited to 2.4 GHz 802.11n (35 Mb/s max) and WPA2 — no 5 GHz, no WPA3 (upstream bug open since 2021, raspberrypi/linux#4718). Knowing how to read link quality is the foundation of any reliable IoT project.
Hardware
- 1 Raspberry Pi Zero 2 W already booted in headless mode (see the installation tutorial)
- A 2.4 GHz access point using WPA2 (if your router is WPA3-only, create a guest network with WPA2/2.4 GHz — the Zero 2 W will not be able to join the main network)
- Onboard antenna under the metal shielding: no external antenna connector (the u.FL footprint on the board is for certification only) — the placement of the board therefore matters a lot.
Complete code
# Avec wpa_cli (Raspberry Pi OS Lite) :
sudo wpa_cli -i wlan0 scan
sudo wpa_cli -i wlan0 scan_results | grep -i "mon_reseau"
sudo wpa_cli -i wlan0 add_network
sudo wpa_cli -i wlan0 set_network 0 ssid '"mon_reseau"'
sudo wpa_cli -i wlan0 set_network 0 psk '"motdepassewifi"'
sudo wpa_cli -i wlan0 select_network 0
# Diagnostic du lien :
iw dev wlan0 link # état + signal en dBm
iw dev wlan0 info # canal, bitrate
ip -4 addr show wlan0 # adresse IP obtenue (DHCP ?)
ping -c 4 1.1.1.1 # connectivité hors DNS
Expected verification
iw dev wlan0 link displays Connected to with a signal: above -70 dBm is comfortable, below -85 dBm is marginal on 2.4 GHz. The ping to 1.1.1.1 succeeds. If the target network is WPA3, the scan sees it but the association fails indefinitely — this is the documented hardware limitation, not your password.
Common errors
- Router in WPA3-only mode: the chip cannot handle it; stick to WPA2 or WPA2/WPA3 mixed mode.
- Enterprise network 802.1X:
wpa_cliwith PSK is not enough, you need a dedicatedwpa_supplicantfile (EAP-PEAP + identity). - Connecting only to 5 GHz: the Zero 2 W is blind to 5 GHz; if the router broadcasts only a 5 GHz SSID, it will never see it.
- 2.4 GHz interference (neighbors, microwaves): throughput and latency collapse without visible disconnection — compare the bitrate with
iw dev wlan0 info. - Errors
brcmfmac ... failed: -5and disconnections after upgrading to Bookworm: known bug (raspberrypi/firmware#1962); test an earlier kernel/firmware or log the output withdmesgbefore suspecting the antenna.
Other tutorials for this board
- Premier démarrage de la Zero 2 W sans écran (headless)
- 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