Mistake on this page? Email us

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.2+ 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 and systemd-networkd to set up a Wi-Fi connection:

  1. Shell or serial into the gateway. There is only one login user by default, root. The default password is set to redmbed.

  2. Create a wpa_supplicant directory:

    mkdir /etc/wpa_supplicant
    
  3. Use any editor of your preference to edit this file. This example uses nano:

    nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
    
  4. 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>"
    }
    
  5. Save and exit.

  6. With nano, run the commands:

    Ctrl+X, Y, Enter
    
  7. Run this command to enable the wpa_supplicant service and configure systemd to start this service on boot:

    systemctl enable --now wpa_supplicant@wlan0
    
  8. Create this file, and save the following content:

    nano /etc/systemd/network/00-wireless-dhcp.network
    
    [Match]
    Name=wlan0
    
    [Network]
    DHCP=yes
    
    [DHCP]
    RouteMetric=20
    
  9. We have observed packet loss and abrupt network disconnection when both wired (ethernet) and wireless are enabled at the same time on the gateway. To provide wireless connectivity to your gateway, disconnect the ethernet cable and reboot your gateway. It should come back up and connect with your Wi-Fi AP.

  10. Run this command to determine whether your Pi has acquired an IP on wlan0 interface:

    ifconfig wlan0
    
  11. Ping an external IP address to test your connectivity:

    ping -I wlan0 8.8.8.8
    

    If successful, you should see something like:

    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

For troubleshooting information, please see: