Intel Galileo Networking Cookbook
上QQ阅读APP看书,第一时间看更新

Accessing Galileo via Wi-Fi

Using the onboard Ethernet port is great for accessing your Galileo board remotely. However, this is not always convenient. Most of our devices nowadays are connected wirelessly, and it can be strange sometimes to still use Ethernet cables.

This is why we are going to find out how to easily install a Wi-Fi board on the Galileo and then access the board remotely. You will then be able to complete all the projects in this book without ever connecting an Ethernet cable again.

Getting ready

For this recipe to work, you will need to have followed most of the previous recipes in this chapter. You need a working Galileo board, with either the simple Linux image or the IoT image installed. You should also have checked that you can access the board via Ethernet first, to make sure that everything is working.

Then, you need a Wi-Fi board. I recommend using the Intel N-135 Wi-Fi board, which is very easy to install and will work out of the box. This is a picture of this board:

Getting ready

You can easily find it online, for example on Amazon, here:

http://goo.gl/70UXFw

It might be possible to use other Wi-Fi boards, but they could be more difficult to use or require the use of drivers to work. You can also use a Wi-Fi dongle that is compatible with the Galileo board.

How to do it...

You can simply install the board by following all the steps in this section:

  1. First, power down the Galileo board and remove all the connection cables.
  2. Then, turn the board over and locate the mini PCI express port, as shown here:
    How to do it...
  3. Insert the Wi-Fi card into the port at a small angle.
  4. After that, press it down until you hear a click, meaning the board was successfully installed.
  5. Connect all the cables to the Galileo board again and power it up.

Now that the Wi-Fi module is correctly installed, you will have some simple steps to follow to set up your Wi-Fi connection. Let's assume here that you have a WPA-secured Wi-Fi network, which is the case for most Wi-Fi networks, then follow these steps:

  1. Log on to your Galileo as root, just as you learned in the previous recipes in this chapter.
  2. Create the file that will contain your network's configuration by typing the following command, replacing MySSID with your Wi-Fi network name:
    # wpa_passphrase MySSID << EOF > /etc/wpa_supplicant.conf
    
  3. Then, type the following command, replacing MyPassPhrase with your Wi-Fi network password:
    > MyPassPhrase
    
  4. Finally, type:
    > EOF
    

This will connect your board to your Wi-Fi network. You can then follow these steps to connect it to your network automatically:

  1. Edit the /etc/network/interfaces file with vi.
  2. Add the line auto wlan0.
  3. Save, using the :w command followed by the :q command.
  4. Restart the wireless interface by typing:
    /etc/init.d/networking restart
    ifdown wlan0
    ifup wlan0
    

From now on, your Galileo board will automatically connect to your network using Wi-Fi. You need to take these steps again if you modify your Wi-Fi network name and/or password.

You can now remove the Ethernet cable and login to your Galileo board again via Wi-Fi.

How it works...

The Galileo board mini PCI express port was made specifically to support extensions such as this Wi-Fi board. This port can be used to extend the possibilities offered by the Intel Galileo board.

There's more...

You can use the mini PCI express slot that we used in this recipe for many extensions other than Wi-Fi. For example, there are specific extensions for Bluetooth 4.0, and for more SD card slots for additional storage.