Setting up a Wi-Fi connection
To connect your device to the cloud, you must use either Ethernet or Wi-Fi. Pelion Edge officially supports connection over Ethernet. However, if you don't have access to Ethernet or an Ethernet cable, you can connect your device to your home Wi-Fi router, access the terminal and manually configure the Wi-Fi settings.
Note: This is not an officially supported feature. It has been tested with consumer or standard Wi-Fi networks and not with corporate networks or mobile hotspots. We recommend you connect your Raspberry Pi with an Ethernet cable to a network with Internet access.
Prerequisites
Before you can start this process, you need:
- Pelion Edge 2.0+ installed on a Raspberry Pi 3 Model B+ (having followed the quick start guide).
- Internet access.
- Router supporting DHCP.
- Ethernet cable or access point, or Wi-Fi enabled router.
Creating and configuring wpa_supplicant
Follow these steps to create and configure wpa_supplicant
to set up a Wi-Fi connection:
-
Shell or serial into the gateway. There is only one login user by default,
root
. The default password is set toredmbed
. -
Create a
wpa_supplicant
directory:mkdir /etc/wpa_supplicant
-
Use any editor of your preference to edit this file. This example uses nano:
nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
-
Copy one of the sections according to your Wi-Fi network settings:
# If the Wi-Fi network is password protected then copy the following content and replace <ssid> and <passphrase> with your network credentials. network={ key_mgmt=WPA-PSK ssid="<ssid>" psk="<passphrase>" }
or:
# If the Wi-Fi network is open and doesn't require password, then copy the following content and replace <ssid> with your Wi-Fi name. network={ key_mgmt=NONE ssid="<ssid>" }
-
Save and exit.
-
With
nano
, run the commands:Ctrl+X, Y, Enter
-
Run this command to enable the wpa_supplicant service and configure systemd to start this service on boot:
systemctl enable --now wpa_supplicant@wlan0
-
It takes some time for maestro dhcp_client to acquire an IP address. Run this command to know if your Pi has acquired an IP on wlan0 interface:
ifconfig wlan0
-
Ping an external IP address to test your connectivity:
ping 8.8.8.8
If successful, you should see something like this -
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=56 time=3.10 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=56 time=4.27 ms ^C --- 8.8.8.8 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 2ms rtt min/avg/max/mdev = 3.097/3.682/4.268/0.588 ms
Troubleshooting
- Make sure maestro dhcp_client is enabled on wlan0 interface. By default, we have configured both interfaces - eth0 and wlan0 with maestro.
- wpa_supplicant Arch Linux Wiki.
ip
Linux man page.