🛠 Connexion WiFi station et administration en SSH
Objectives
Configure the Raspberry Pi 3 A+ as a WiFi station — its only native network, as the board has no Ethernet port — then connect to it via SSH. The IEEE 802.11b/g/n/ac module covers 2.4 and 5 GHz, with Bluetooth 4.2/BLE; the radio module is FCC modular certified.
Hardware
- Raspberry Pi 3 A+ with Raspberry Pi OS Lite (integrated WiFi antenna on the board)
- A 2.4 GHz or 5 GHz access point; a client PC on the same network
- On first boot without WiFi: screen + keyboard, or USB gadget mode on the micro-USB (
dtoverlay=dwc2,modules-load=dwc2,g_etherincmdline.txt)
Complete code
# 1) Préparer la carte : Raspberry Pi Imager permet d'enregistrer le WiFi
# (préconfiguration) ; sinon, sur la partition boot :
sudo tee /boot/firmware/wpa_supplicant.conf > /dev/null <<'EOF'
country=FR
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="MonReseau"
psk="MotDePasseWifi"
}
EOF
# 2) Activer SSH : créer le fichier vide « ssh » sur la partition boot
sudo touch /boot/firmware/ssh
# 3) Après boot : vérifier l'association et l'IP
sudo wpa_cli status | egrep 'ssid|wpa_state|freq'
ip -4 addr show wlan0
# 4) Depuis le PC, via mDNS/avahi (pas d'Ethernet, pas de DHCP filaire possible)
ssh pi@raspberrypi.local
Expected verification
wpa_cli status displays wpa_state=COMPLETED with the network frequency (e.g., 5180 MHz for 5 GHz); ssh pi@raspberrypi.local opens a shell. ping -c3 1.1.1.1 confirms Internet connectivity.
Common errors
- Misspelled
pskkey or WiFi not restarted:wpa_stateremainsSCANNINGor the 4-WAY handshake fails. - Missing
country=FR: 5 GHz DFS/TPC channels unavailable, speeds throttled. - Looking for an IP on eth0: the 3 A+ has no Ethernet, only wlan0 exists (unless using a single USB adapter).
- mDNS blocked by the PC firewall: use the fixed IP (static DHCP lease on the router).
- >
Other tutorials for this board
- Allumer une LED en C avec libgpiod sur le GPIO 40 broches
- Bouton poussoir et retour console avec gpiozero
- Premier script Python : inventaire du système
- Variation d'intensité d'une LED avec le PWM matériel
- Capteur I2C : température et pression avec BME280
- Démarrage SD/USB et récupération d'une carte qui ne boot plus
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython