Filter results by

Wi-Fi Client

This article explains how to configure and use Wi-Fi® as the client of an external Wi-Fi access point (such as a home gateway-router). Setting up your ARTIK system as a Wi-Fi client is prerequisite to most of the development work you will do.

Want to keep this simple? Just set up two things:
– your Wi-Fi name and password
– a script for Wi-Fi to auto-start every time.

Configuring Wi-Fi

On ARTIK Linux-based systems, Wi-Fi operations go through the Wi-Fi Protected Access (WPA) Supplicant services program wpa_supplicant – it supports authentication and encryption for a wireless LAN.

There are basic and advanced network management methods. We start with the basic one, but you might want to jump to the more advanced one instead.

Make sure you start with an upgrade to patch the

Step 1. Upgrade your OS. ARTIK modules come pre-loaded with a specific Linux operating system (OS), depending on module type:

  • Ubuntu only (ARTIK 530s and 710s modules)
  • Fedora upgradable to Ubuntu (ARTIK 530 and 710 standard modules)
  • Fedora 24 only (ARTIK 520)
  • Fedora 22 only (ARTIK 1020).

Fedora is more compact than Ubuntu, but its support lifetime is limited compared to Ubuntu (5 yrs). Move to Ubuntu now to avoid reloading all your software and tools later. Click to install the latest ARTIK image and choose the newest image for your module.

Step 2. Connect to a Network. To load software, you'll need to either connect an Ethernet cable or set up your Wi-Fi® network and password.

Try out "on-boarding." If you like, jump ahead to the Connect to the World article to set your network connection using a simple smart phone app.

Step 3. Upgrade installed packages. Start by reading a primer on package management systems. Now you're ready for the latest software updates.

In the version of Ubuntu we use, apt-get and apt are nearly interchangeable. We use apt but you can feel free to use either.


apt update

apt upgrade

apt install build-essential


Verify your repository first as noted below, then type
dnf upgrade

Note: A patch is available in the repositories for the KRACK vulnerability of wpa_supplicant. Simply run the normal update/upgrade process to implement the fix. You can also patch just the affected package as follows.


apt update

apt install --only-upgrade wpasupplicant


dnf upgrade wpa_supplicant

Step 4. Install a development environment on your PC. If you loaded the ARTIK IDE earlier, you're nearly done – go to the Update SDK article to check for updates. If not, go to Software Tools to get an overview of what's available.

Step 5. Update SDK. ARTIK API support is included automatically when you install the ARTIK IDE. For the latest Ubuntu images (os_18.05.00 or newer), just update the SDK version on the board.

apt install libartik-sdk

For Fedora or older Ubuntu images, you need to enable repository access on your ARTIK board first and then install the SDK as directed in that article.

Step 6. Add additional packages. You'll eventually want to add other software, typically using a package installer. We've included instructions throughout the articles about what packages you'd need for a specific feature (like adding Node-RED as we describe in the Tutorials).

Verifying Fedora repository

At the conclusion of active development for a given Fedora release, Fedora repositories may be phased out and moved to a permanent archive. If you are having any problems with dnf update or package downloads, make sure the repository URLs point to the right locations.

You'll find the information in /etc/yum.repos.d/ in various files. You can either change them manually or use a command like the one below to make the substitution.

sed -i 's|archive\.fedoraproject\.org\/pub|archives\.fedoraproject\.org\/pub\/archive|g' /etc/yum.repos.d/*

Manual Wi-Fi Setup

Follow these steps if you want to get your system set up quickly using a manual process. We provide a more advanced approach, using Connection Manager, later in this article.

  1. Make sure the Wi-Fi antenna is attached as noted here.

  2. Configure the wpa_supplicant.conf file to include your Wi-Fi router settings. You only need to set up the password information once. Use the 'wpa_passphrase' command to write your router SSID and password into the file.
    cd /etc/wpa_supplicant
    wpa_passphrase "SSID" "PASSWORD" >> wpa_supplicant.conf

    For example,
       wpa_passphrase MyAP abcd1234 >> wpa_supplicant.conf

    Connecting to an unsecured Wi-Fi access point? Put in any password here; we'll delete it below.

  3. Use an editor to verify and clean up the file contents.
       vi wpa_supplicant.conf

    1. If using secure Wi-Fi, delete your cleartext personal passphrase (the line that starts with #psk), leaving only the encrypted version.

      If you are connecting to unsecured Wi-Fi, delete both psk lines and use:

    2. Check whether the file contains multiple network login assignments. If it does, you may want to comment out the ones you do not need to prevent them from being selected instead of your chosen network.

    3. Make sure that the first lines of the file look like this. If not, add them in.


      Where you replace group_name with

    4. Save and exit when finished.

  4. Type reboot to write open files and reset your system.

If your connection is through a company proxy server, you have more work to do! Refer to the Proxies article for details.

For more advanced Wi-Fi security settings, you can refer to this page or other online resources.

Initialization on each startup

Every time you restart the system, the WPA supplicant service must be called to start the wireless LAN. You will then use the DHCP client services program dhclient to request a WLAN IP address from your DHCP server.

  • systemctl start wpa_supplicant should start automatically.
       – Run systemctl status wpa_supplicant to check
       – Run systemctl start wpa_supplicant if you need to start it.

  • dhclient wlan0 must be run manually or through a start-up script.

After both services are running, you'll want to execute
   ifconfig wlan0
to check whether the previous command succeeded in assigning an IP address. This will be your "localhost" IP address as we refer to it in our articles.

If you don't see a valid IP address, verify that your wpa_supplicant.conf file is correct – it should look very similar to this:


  psk=27d496e9b...961761af7a78b466 }

If you edit the file, you need to start everything up again.

  1. Kill DHCP (if needed) with dhclient -r
  2. Run systemctl restart wpa_supplicant to restart the WLAN service
  3. Run dhclient wlan0 again.

If it still doesn't work, execute a reboot and try once more.

If successful, you are finished with Wi-Fi setup.

Run dhclient from a script

You can configure your system to automatically reconnect Wi-Fi after each reboot. There are several methods that will work, but you can start with the ones provided here.

Under Ubuntu, simply append these two lines to /etc/network/interfaces

auto wlan0
iface wlan0 inet dhcp

Reboot and verify operation.

For Fedora 22 or later, an init script like the following can re-establish the Wi-Fi connection after each power cycle.

  1. Under your /etc/init.d/ directory, open a file named wlan and paste in these contents. Save and exit.
    #! /bin/bash
    #chkconfig: - 99 10
    /usr/sbin/dhclient wlan0
    kill dhclient
    case "$1" in
    echo "Usage:$0 {start|stop|restart}"
    exit 0
  2. Change the wlan file mode to be executable, and enable it for reboot.
    chmod a+x /etc/init.d/wlan
    chkconfig --add wlan
    chkconfig --level 12345 wlan on
  3. Reboot and verify operation.

Connection Manager

The Connection Manager (connman) service is a more advanced network manager option with a lot of functionality. To get an idea, type:
and then type technologies at the prompt. You'll see that it even integrates Bluetooth® management, which we use in our related article.

With all its convenient features, Connection Manager is a bit overwhelming and can sometimes interfere with your intended connection configurations. Here we discuss how you can start making use of it, as well as how to avoid some of the pitfalls. Refer to a Web article like this one or this presentation for more detailed information.


For both Ubuntu and Fedora systems, Wi-Fi operations go through wpa_supplicant services. Connection Manager adds automation (and some complexity) on top of wpa_supplicant. Here's how it figures in.

wpa_supplicant method. Initially, the /etc/wpa_supplicant/wpa_supplicant.conf is used by the system to store Wi-Fi access point names and encrypted passwords.

  • You use wpa_passphrase to encrypt your password, and then write it to the configuration file for future use.
  • You have to start wpa_supplicant followed by dhclient to get Wi-Fi access.
  • The boot default is to enable wpa_supplicant but leave dhclient to be run manually or by a startup script.

Connection Manager method. ARTIK Ubuntu and Fedora 24 releases are additionally built with Connection Manager. It provides a more structured approach with a registration agent.

  • Connection Manager is enabled by default, but just enough to leave the system backwards-compatible with the older method.

  • It starts wpa_supplicant automatically using wpa_supplicant.conf and leaves it to you to run dhclient wlan0 if you choose not to use the advanced features.

  • However, once you choose to use the registration feature of Connection Manager, it takes over control. wpa_supplicant.conf settings should not be used.

Once you start using Connection Manager (either directly or through BLE on-boarding), do not use wpa_supplicant.conf for selecting access points. The file must remain in place with the lines specified in client setup step 3c, but without any networks listed.

Note that Fedora 22 systems can use only the wpa_supplicant.conf method.

Prepare for use

The latest version of Connection Manager has an odd quirk: With background scanning disabled, wifi scan does not reliably scan for networks. So you have to leave background scanning enabled.

  1. Bring up the configuration file for editing.
    vi /etc/connman/main.conf

  2. Search for BackgroundScanning (at the bottom of the first screen you see).

  3. Comment out the line so that it shows # BackgroundScanning = false

  4. Save the file and reboot.

Select an Access Point

  1. Attach a Wi-Fi antenna as noted here.
  2. Scan for wireless access points. Enter commands as follows.
    1. connmanctl to get the > prompt.
    2. scan wifi to scan for available access points (wait until finished).
    3. services to list them.
  3. Select an access point. Still within the > prompt, enter commands as follows.
    1. agent on if you want Connection Manager to prompt you for a password.
    2. connect wifi_xxxx to pick the desired access point (you can use the tab key to start, and to auto-complete, your entry).
    3. Respond to the agent query for a password if needed.
    4. quit when finished.

You won't need to repeat this process in the future: Connection happens automatically from now on.

If you need to manually remove or modify a connected service, you'll find directories for each one in:

Controlling net interfaces

At the connmanctl> prompt where you typed technologies to get a list of everything available, you can control those interfaces easily. For example, if the Ethernet controller is powered up and you need to turn it off, simply enter
disable ethernet
to take care of it.

Reverting to default operation

If you later need to revert to the default backwards-compatible approach, you can run
   systemctl disable connman
   systemctl enable connman
to get back where you started.

Connecting to WPA2 Enterprise

Click to learn about WPA2 Enterprise connections.

Wi-Fi Troubleshooting

Problematic operation

There are times that Connection Manager can get in the way of intended operations by "stealing" connections. You will likely encounter this scenario if you are trying to run through a proxy and see connection errors or timeout errors during transfers.

Troubleshooting Tip. Getting errors within a half-minute or so of booting? Try route -n before and after the failure to see if the routing is being changed by connman. Reconfigure or disable connman if needed.

To block the p2p interface that sometimes is the cause of the problems:

  1. Bring up the /etc/connman/main.conf file for editing.

  2. Search for blacklist (in vi type /blacklist and hit Enter).

  3. To the line starting with NetworkInterfaceBlacklist, add
    to the existing list.

  4. Save the file and reboot.

To permanently disable Connection Manager, type:

systemctl disable connman.service

and reboot your system. From that point forward, you will need to manually run
systemctl start wpa_supplicant
followed by
dhclient wlan0
on each reboot.

Note that if you have disabled Connection Manager, you can still use wpa_cli scan_results to get a list of available access points after you have started the WPA supplicant services.

To temporarily stop or start Connection Manager once it is enabled, you can use
systemctl stop connman
systemctl start connman

No Wi-Fi services

Does scan wifi fail to turn up any services? There is a lot of complex driver interaction going on with Wi-Fi and Bluetooth. Sometimes problems will cause Connection Manager to disable either or both technologies. To remedy:

> technologies

If any show Powered = False, re-enable them.
> enable wifi
> enable bluetooth
> quit


Also related, but requiring separate attention, is rfkill. If you see failures with BLE or Wi-Fi, first check to see whether the technologies are being blocked.

rfkill list

If you see either Bluetooth or Wi-Fi marked as disabled, try unblocking them.

rfkill unblock wifi
rfkill unblock bluetooth

then list again to see if the problem has been resolved.

Connect Devices to Wi-Fi through the Same Router

For much of your development work, you will want to set up both your ARTIK board and your development PC to be on the same Wi-Fi network. This configuration is required for the ARTIK IDE, the Arduino IDE, and the Node-RED environment, to name a few.

The ARTIK module must be on the same network as your PC host system to let them communicate with each other. A typical Wi-Fi router will default to allowing this (but may not do so if you have changed its factory settings).

Here we'll discuss setup using a Windows host PC.

  1. From the terminal emulator console, set up Wi-Fi either manually or through Connection Manager.

  2. Verify that an IP address has been automatically assigned to the board by the Wi-Fi access point. Run
    ifconfig wlan0
    and make a note of the IP address.

  3. To make sure your PC is on the same network, open a Windows command window and check its IP address too.
       Start » cmd [Enter] (you should see a command window open)
    Look for the Wireless adapter and verify that all but the last digits match.

The addresses will typically be something like

10.0.0.x or 192.168.10.x

Extra Credit: Linux scp and ssh

Once you have a network connection between your PC and ARTIK, you can use scp to transfer files. For example, if you're not fond of editing in vi, you can compose a C code file on your local PC editing program and then copy it over to your ARTIK board.

You can read online for the general usage of the command. As a quick example,
scp testfile.c root@
copies testfile.c from your current PC directory to the root directory of the ARTIK board on the network noted. The system will ask for your login password (default 'root') before completing the transfer.

  • For Mac® and Linux® systems: You can enter the scp command line in the terminal emulator.
  • For Windows® systems: You will need to open a Git bash window (not a DOS command window). You could instead install an scp client for Windows like FileZilla or WinSCP.

You can also run an ssh session for more complex tasks. With SSH, you generate two mated keys, one public and one private. You initially send the public key to any server you'll be transacting business with. Then during authentication, the server verifies that you have the private mate of the public key that it has on file.

Go to the directory at /etc/ssh and you'll see several ssh_host_... files. At any time, you can delete these and use the procedure below to regenerate these mated key pairs.

SSH keys are a separate topic from the SSL certificate environment described here.

Once again, you can read online for more information on these topics.

ssh Troubleshooting

Running into this error trying to ssh to ARTIK?

ssh: connect to host XXX.XXX.XXX.XXX port 22: Connection timed out 

If so, the SSH keys may have been corrupted. Re-create the host keys by using these two commands:
rm /etc/ssh/ssh_host_*
ssh-keygen -A

The keys will be regenerated in five formats: basic, RSA, DSA, ECDSA, and its variant ED25519.

Last updated on: