🛠 Se connecter au Wi-Fi en ligne de commande (nmcli)
Objectives
Diagnose and configure the Wi-Fi on the Zero W from a terminal: the board features the Cypress CYW43438 chip (802.11n 2.4 GHz only, ~35 Mb/s, + Bluetooth 4.0/BLE), interface wlan0.
Hardware
- 1 Raspberry Pi Zero W running Raspberry Pi OS (SSH session or screen + keyboard via mini-HDMI / micro-USB adapters)
- A 2.4 GHz access point
Steps
- Set the radio country:
sudo raspi-config→ 5 Localisation → L4 WLAN Country. Incorrect country = incorrect channels/power, legality issues, and degraded performance. - Check the radio:
nmcli radio wifimust displayenabled. - Scan:
nmcli dev wifi list(SSID, SIGNAL, SECURITY). - Connect:
sudo nmcli --ask dev wifi connect <ssid_of_the_spot>then enter the passphrase. - Check the link and signal level:
iw dev wlan0 link(signal:line in dBm).
nmcli -t -f IP4.ADDRESS dev show wlan0 # bail DHCP
ping -c 3 1.1.1.1 # sortie Internet
Verification
iw dev wlan0 link displays SSID, channel, and signal; ping goes out to the Internet.
Common Errors
- Looking for 5 GHz: the Zero W is single-band 2.4 GHz, with the same chip as the Pi 3 B.
- Metal case: the antenna is a simple PCB trace (cut ground plane); metal significantly weakens it.
- WLAN country not set: network "not found" even though it is broadcasting on a channel outside the allowed domain.
Other tutorials for this board
- Premier démarrage headless de la Zero W (Wi-Fi + SSH)
- Suder le header 40 broches et faire clignoter une LED
- Pi-hole : bloqueur de pub DNS sur Zero W
- Gadget USB : Ethernet sur le port OTG + relais Wi-Fi
- Balise BLE : diffuser un beacon avec le CYW43438
- Nœud capteur autonome sur batterie : énergie et fiabilité
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash