wifi-station.sh
NetworkManager is the standard tool of modern board distributions: two commands are enough to join a WPA2 access point and check the obtained IP. The script also lists visible networks with their security.
Hardware
A Radxa Zero 3W (Rockchip RK3566 quad Cortex-A55, 1-4 GB) in a stick form factor, with Wi-Fi 5, Bluetooth and a 40-pin header. None: the radio is built into the board.
Wiring
No wiring. Antenna: keep the board in its case or fit the external antenna when the signal is weak.
How it works
nmcli detects the wireless interface, triggers a rescan, connects with the credentials then prints active connections and the IPv4 address.
Running it
On the Radxa image: apt install gpiod python3-gpiod; gpiodetect/gpioinfo to identify the GPIO chip of the 40-pin header, then run the script.
Variants
Create an offline profile (nmcli connection add ... wifi-sec.pri-key ...), or chain with the web server to check connectivity remotely.
wifi-station.sh
#!/bin/bash
# Connexion Wi-Fi station via nmcli (NetworkManager, standard des OS carte).
# Usage : ./wifi-station.sh "MonSSID" "cle-de-securite"
set -e
SSID="${1:?Usage: $0 SSID CLE}"
CLE="${2:?Usage: $0 SSID CLE}"
echo "== Interfaces reseau =="
ip -brief link
DEV=$(nmcli -t -f DEVICE,TYPE device | awk -F: '$2=="wifi"{print $1; exit}')
[ -n "$DEV" ] || { echo "aucune interface wifi trouvee"; exit 1; }
echo "== Scan (peut etre vide en mode AP masque) =="
sudo nmcli device wifi rescan 2>/dev/null || true
nmcli -f SSID,SIGNAL,SECURITY device wifi list | head -15
echo "== Connexion a "$SSID" via $DEV =="
nmcli device wifi connect "$SSID" password "$CLE" ifname "$DEV"
echo "== Etat =="
nmcli -f NAME,DEVICE,STATE connection show --active
ip -4 -brief addr show "$DEV"