🛠 WiFi sur la prise USB unique et SSH à distance
Objectives
- Make the Model A network-capable: it has no built-in Ethernet or WiFi, only a direct USB 2.0 port on the BCM2835.
- Configure wpa_supplicant in station mode and obtain an address via DHCP.
- Connect via SSH from a laptop, then operate without a screen and keyboard.
Hardware
- An old-stock USB WiFi dongle (driver included in the legacy image) or, as a dongle-free alternative, a
g_ethergadget setup connected to the laptop. - A quality power supply: some dongles exceed the single port's power budget and blow the polyfuse.
- An empty
sshfile on the boot partition to enable the SSH server on first boot.
Complete code
# /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR
network={
ssid="MonReseau"
psk="MotDePasseWiFi"
}
# Appliquer
sudo wpa_cli -i wlan0 reconfigure
sudo dhclient wlan0
ip -4 addr show wlan0
# Depuis le portable (le Model A n'a pas de MAC fixe en gadget, se fier au nom mDNS)
ssh pi@raspberrypi.local
Expected verification
ip -4 addr show wlan0 displays an address in the 192.168.x.x range; pinging the router works; the SSH session opens without a screen or keyboard connected to the Pi. >
Common errors
- Dongle drawing too much power: disconnections, brown-outs, throttling — try a powered hub.
- In
g_ethergadget mode, the MAC address seen by the laptop changes on each connection (known firmware bug #843): rely on raspberrypi.local. - WiFi password with accents or country not set: association fails.
- Forgetting
country=FR: channels 12-13 unavailable, network not found.
Other tutorials for this board
Code examples for this board
led_blink.pyPythonbutton_led.pyPythonservo_sweep.pyPythondht_temp.pyPythonoled_i2c.pyPythonmcp3008_read.pyPython