SpiderElectron

Electronic Engineering Blog

Getting Galileo on WiFi

A guide to getting Galileo on WiFi

The Intel Galileo development board has a full sized PCIe connector on the bottom.

Using this connector you can add a WiFi card to Galileo, so that it can joint your WiFi network, or even create one of it’s own. Galileo is compatible with a number of WiFi cards, and drivers for most of the popular Intel cards are included in the Linux distribution that runs on Galileo.

This guide shows you how I added Galileo to my wifi network.

wifiCompatible Wifi Cards

I have used both the Intel Centrino Wireless-N 135 and the Intel Centrino Advanced-N 6205 cards with success. You can pick up these cards pretty cheaply from places like Amazon and ebay. I got An N-135 card for about £12, and a second-hand N 6205 for under £5. You can also easily pick up various wifi antennas that will fit for very little cost.

Once you have the card installed there are a few steps to take to get it connected to your own wifi. You’ll need to know the SSID (i.e. the name) of your wifi network and the passphrase you use to connect.

Attach the card to your Galileo and boot from the Linux Image on SD Card – this has the required WiFi drivers included. Now you need to be able to login as root on the galileo, you can either do this by using a serial terminal and a serial cable attached to the 3.5mm jack on the board, or you can connect a wired network cable and login in remotely using ssh or PuTTY.

Generate wifi security credentials

When you attach any device to a WiFi network you normally provide a passphrase. This passphrase does not get used directly, and never gets sent across the wifi network. Instead, the device wishing to attach to the network uses the passphrase together with the name of the network, to create a non-reversible secure key. It is this key which is used to decrypt the network communications and allow the device to connect. By non reversible I mean that even if you know the formula for creating the key (which is described in the IEEE 802.11specification) you cannot use it to reverse engineer the key back to the passphrase.

To access the wifi network you need to generate the key from your wifi passphrase and SSID. (SSID is simply the name of the network). There is a utility called wpa_passphrase which will do this for you. If you ever change your wifi passphrase you’ll need to update the credentials we create here.

On Galileo, login as root and at the shell prompt enter the following command:

wpa_passphrase <SSID> <passphrase>

Where <SSID> is the name of your WiFi network and <passphrase> is the passphrase you normally use to connect new devices. This will output a few details like this:

root@clanton:~# wpa_passphrase mywifi mypassphrase
network={
        ssid="mywifi"
        #psk="mypassphrase"
        psk=1349c1956229b8291facebabe3939d4b0f2beef22e5dead6c04aabcafe16850b
}

The important data here is the long line of hex digits. Copy this because we will need it in the next steps.
Now you need to tell Linux to use your wifi card, and to connect to the network using the credentials you have just created.

At the shell prompt, change to the /etc/network directory:

cd /etc/network

And take a look at the contents of the interfaces file:

cat interfaces

This will look a bit like this:

# The loopback interface
auto lo
iface lo inet loopback

# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp

There may be more or less, depending on your system. The important thing here is that we can see it defines a loopback interface (lo) and a wired ethernet interface (eth0), but no wifi networks. We will edit this file to add an entry for the new wifi card.

Using your favourite text editor add the following lines to the interfaces file.

# Wireless interfaces
auto wlan0
iface wlan0 inet dhcp
 wpa-driver wext
 wpa-ssid <SSID>
 wpa-proto RSN
 wpa-pairwise CCMP
 wpa-group CCMP
 wpa-key-mgmt WPA-PSK
 wpa-psk <KeyFromPreviousInstruction>

Obviously you need to replace <SSID> with your own network name, and <KeyFromPreviousInstruction> with the string of hex characters we generated earlier. Don’t include the < or > characters.

On completion the whole file should look something like this, with your own data instead of mine:

# The loopback interface
auto lo
iface lo inet loopback

# Wired or wireless interfaces
auto eth0
iface eth0 inet dhcp

# Wireless interfaces
auto wlan0
iface wlan0 inet dhcp
    wpa-driver wext
    wpa-ssid SpiderNet
    wpa-proto RSN
    wpa-pairwise CCMP
    wpa-group CCMP
    wpa-key-mgmt WPA-PSK
    wpa-psk 1349c1956229b8291facebabe3939d4b0f2beef22e5dead6c04aabcafe16850b

Using WPA instead of WPA2

The above file assumes you are using WPA2 security on the network, if you are instead using plain old WPA then change RSN to WPA, and change CCMP to TKIP

Now, save the file, reboot galileo and it should be attached to your wifi network.

Removing automatic connection to wifi.

If you don’t want Galileo to connect to your wifi automatically at boot, then go back to the interfaces file in /etc/network and comment out (by prefixing with #), or delete, the line:

auto wlan0

Then if you want to bring up your WiFi connection you need to logon to Galileo and issue the command:

ifup wlan0

And to take it down again:

ifdown wlan0

Further reading

For more information on configuring networking on Linux, see this page: http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

 

Leave a Reply