Home Cloud & Networking Intel Galileo Networking Cookbook

Intel Galileo Networking Cookbook

By Marco Schwartz
books-svg-icon Book
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Installing and Configuring Linux
About this book
Publication date:
August 2015
Publisher
Packt
Pages
174
ISBN
9781785281198

 

Chapter 1. Installing and Configuring Linux

In this chapter, we will cover the following recipes:

  • Configuring your Galileo for the first time

  • Using a simple Linux image

  • Using the IoT Linux image

  • Accessing the Galileo board remotely

  • Installing and updating modules

  • Accessing Galileo via Wi-Fi

  • Troubleshooting Linux installation issues

 

Introduction


This first chapter of the book is focused on getting you started with Linux on your Intel Galileo board. You will learn how to set up your board out of the box. You will also learn how to install the different Linux images that you can install on the Galileo board. We will also learn how to install Linux on an external SD card that can be inserted into the Galileo board.

We are also going to see how to access a Galileo board remotely, and how to install new modules on it. Finally, we will see how to get rid of the Ethernet cable and use Wi-Fi to access the Galileo board.

Note

Note that all of the projects in this chapter and this book use the second generation Intel Galileo board. Several projects might work with a first generation type, but this is not guaranteed.

 

Configuring your Galileo for the first time


The first step when you receive your Galileo board is to set it up. This is relatively easy but is a bit more complex than it is with other boards such as the Arduino. Therefore, we need to make sure that it is perfectly configured and set up before we move on to the other recipes in this chapter.

Inside the box, you will find the board itself and a power adapter that you can use to power up the board. You will also find a short manual about the board and the Intel Galileo platform.

Getting ready

The first thing you will need is, of course, a Galileo board, which is shown here:

Note that you will need a Galileo Gen 2 board for the rest of this book. You might be able to follow along just fine with a Gen 1, but there might be some differences.

You can find a Galileo board on SparkFun:

https://www.sparkfun.com/products/13096

You also need an external power supply for your board, which is shown here:

This power supply is usually provided with the Galileo board but, if this is not the case, or you got your Galileo board separately, you will need to use the 12V DC power supply found in the box, or any other DC power supply in the 7V to 15V range.

Finally, you will also need a micro SD card, as shown here, which we will use in some projects in this chapter:

This SD card will be used to install the different Linux images, and also to store measurement data. I recommend an SD card with more than 2 GB of storage.

How to do it...

Let's now assemble our Galileo board. These are the steps to follow to set up your Galileo board:

  1. Insert the micro SD card into the corresponding slot on the Galileo board.

  2. Insert an Ethernet cable from your router into the Galileo board.

  3. Connect the Galileo board to your power supply by connecting the DC jack.

This should be the result:

You will see that some LEDs light up when this is done.

How it works...

The Galileo board basically needs three things to work correctly:

  • The correct power supply

  • A connection to your local network via Ethernet or Wi-Fi

  • A micro SD card inserted into the board (this is not required for the basic operation of the board, but to install Linux images)

Having done this, we are then able to use our board for all the projects in this book.

See also

This is really the foundation of the whole book, so make sure that you complete this recipe correctly. To go further, follow one of the two upcoming recipes to install Linux on your Galileo board.

 

Using a simple Linux image


To really make use of the board and create exciting projects, we need to install a Linux image on our Galileo board. We will see that we have two options. The first one is the one we are going to see in this recipe—it is a simple Linux image, which is also simple to install. We will see how to install it in this guide.

Getting ready

First, you have to make sure that you have followed the recipe at the beginning of this chapter, so you should have your board ready to be use.

Then you can get the Linux image from the following location:

https://communities.intel.com/docs/DOC-22226

You will be redirected to a page that contains a table with all the available downloads for the Galileo board:

Simply click on the first link and wait until the image is downloaded onto your computer.

How to do it...

You are now ready to install the Linux image on your Galileo board. To do so, simply follow these steps:

  1. Unzip the contents of the file you just downloaded.

  2. Remove the micro SD card from the Galileo board.

  3. Insert the micro SD card into your computer.

  4. Format the SD card, if necessary, in the FAT32 format (if there are files on it already).

  5. Copy the contents of the Linux image to the SD card.

  6. Power down your Galileo board. You can also connect your board to your local network with the Ethernet cable at this point.

  7. Insert the SD card into your Galileo board again.

  8. Power the Galileo board up again.

The simple Linux image is now installed and running on your Galileo board.

How it works...

The Galileo board will now boot every time on this Linux image, allowing you to access all the functions and modules that we listed earlier.

There's more...

The Linux image that you just installed comes with many extras. This is a non-exhaustive list of all the features and modules that come with the Linux image:

  • Wi-Fi drivers

  • A Python interpreter

  • SSH (to access your board via Ethernet)

  • OpenCV (for image and video processing)

  • Video4Linux2 (to record videos)

  • Advanced Linux Sound Architecture (ALSA) drivers (to play sounds)

  • Node.js (to run servers and applications based on JavaScript)

See also

If you need an even more advanced image installed on your Galileo board, look at the following recipes to see how to install the Internet of Things (IoT) image.

 

Using the IoT Linux image


Using the simple Linux image that we described in the previous recipe is great, but it can be quite difficult to use. You need to manually login to your board, and then use command lines to install new modules and run your applications. For example, you would have to use terminal software (such as PuTTY) to access the board.

Luckily for us, Intel has come up with a whole suite of software to allow you to code your application directly with a graphical interface, without typing a single line of code into a terminal. In this recipe, we are going to see how to install this software suite.

Getting ready

This software suite comes in two parts— a new image, called the IoT image, that you need to install on the SD card, and also some software called (Cross-Platform Development Kit) XDK that needs to be installed on your computer.

The first step is to download this IoT image from the Intel website:

https://software.intel.com/en-us/iot/downloads

This is the page you will see when going to this web address:

Download the image from the web page. Then, go to the following address to download the Intel XDK software:

https://software.intel.com/en-us/html5/xdk-iot

You will be redirected to the page where you can download the Intel XDK software for your operating system:

How to do it...

Installing the Intel IoT image is a bit more complex than it is with the simple Linux image. It varies depending on your operating system. Luckily for us, Intel has written guides to help install this image, depending on your operating system:

https://software.intel.com/en-us/iot/downloads

Simply follow the corresponding guide before continuing this recipe.

Installing the Intel XDK software is actually much easier. You simply need to execute the installer and just let yourself be guided by the instructions. When you first launch the software, you will be asked to create an account on the Intel website.

This is what the software looks like:

Congratulations, you are now completely ready to use the Intel IoT development suite on your computer!

How it works...

The Intel IoT image and Intel XDK work together to make development on your Galileo board much simpler. XDK is able to locate your Galileo board automatically on your network, develop applications in Node.js inside the software, and then automatically upload and run these applications on your Galileo board!

There's more...

You will see that the Intel XDK software offers much more than what we are going to use in this book. You can actually develop mobile applications that work on your phone and communicate directly with your Galileo board, right from Intel XDK!

You have other options to program your board at this point. The first option is to use Eclipse, which also lets you program the board, but by using C/C++ instead of Node.js. The next option is to use the special version of the Arduino IDE for the Galileo board, which lets you program the board with the well-known Arduino language.

See also

Using this recipe will allow you to make nearly all the recipes in the subsequent chapters of this book. Look at the remaining recipes in this chapter to see how to access your board once the IoT image is installed.

 

Accessing the Galileo board remotely


If you have followed one of the two previous recipes in this chapter, you now have a fully operational Linux image running on your Intel Galileo. Now, we are going to see what you can do with it. The first step is to verify that the installation was actually successful and that you can access your board remotely. To do that, we are going to use Secure Shell (SSH) to log in to your Galileo board remotely.

Getting ready

You will need to have a Linux image installed on your Galileo board. I recommend using the IoT image for this, as this is the image we will be using in the rest of the book.

For the rest of this recipe, we will assume that the IoT image is installed and running on your Galileo board.

How to do it...

The first step is to get the IP address of your board. This is important, as we will always use this IP to access your board. For your board to get a relevant IP address, it needs to be connected to the same local network as your computer.

To do so, the simplest way is to open the Intel XDK software. Log in, and then you will see, at the bottom part of the window, that you have a Select a Device menu. You should see your Galileo board in this menu, along with the IP address next to it, as shown in this screenshot:

For this to work correctly, you also need to have Bonjour installed on your computer.

Now, go to a terminal to login to your board via SSH. If you are using Linux or OS X, you already have a terminal that you can use.

If you are using Windows, I recommend using PuTTY:

http://www.putty.org/

PuTTY is a basic type of terminal software for Windows that allows you to use the board remotely.

Now, go to a terminal and type in the following command by putting in the IP address of your board:

ssh root@192.168.1.102

You should see that you are logged in to your Galileo board:

If you can see these messages, it means you can successfully access your board via SSH!

How it works...

SSH is a protocol to securely login to a remote Linux machine, such as the Galileo board, running a small Linux distribution. It allows you to control your board from any machine in your network, and install updates and new modules.

There's more...

This is just the first step in using your Galileo board remotely. In the next recipes, we will use it for much more than just logging in, for example to install new modules and to run applications.

See also

You should now go to the next recipe to learn how to install modules and install updates on your Galileo board.

 

Installing and updating modules


So far, we have learnt how to access the board remotely via SSH, from any machine on your local network. Now, we are going to see what we can actually do with that. As we are still in an introductory chapter, we will see how to perform a simple operation—update the Linux modules that are already installed on the board, and install new ones.

Getting ready

To follow this recipe, you need to have a Galileo board with a fully operational Linux image, on which you can access via SSH just as we did in the previous recipe. The Linux image you are using doesn't actually matter that much.

How to do it...

Once you are logged in to your Galileo board via SSH, you are able to type commands directly into the terminal. Every time you see a line starting with root@galileo, this means we will be using the terminal.

If you are using the IoT image, the first thing you can do is type the command:

opkg update

This will update the list of available packages and updates for your Galileo board. This is the result inside the console:

Note that this also requires the Galileo board to be connected to the Internet, for example, by plugging it into your Internet router.

Now, you can actually update the packages themselves by typing:

opkg upgrade

This will automatically update all packages that need to be updated. Make sure you run it regularly, as Intel comes up with new versions of these packages all the time.

You can also use the package manager to install new modules. To see which packages are available, type:

opkg list

This will list all the available packages, as shown in this screenshot:

To install a given package, just type the following command, replacing package_name with the name of the package you want to install:

opkg install package_name

How it works...

The opkg command installs the package manager (opkg) for the Intel Galileo Linux machine. It allows you to update your existing packages automatically and also install new packages on your Galileo board. In this way, you can always stay up-to-date and extend the functionalities of your board with new modules.

There's more...

We only covered the basics of what the opkg tool can do. To see all the possibilities offered by the tool, type this into the terminal:

opkg –h

This will list all the commands and options offered by this tool.

See also

Installing new packages and updating existing packages requires you to access your board remotely. So far we have done this via Ethernet, but you can check the next recipe to learn how to do it via Wi-Fi.

 

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:

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:

  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.

 

Troubleshooting Linux installation issues


In this last section of the chapter, we are going to see what can go wrong when configuring your board and installing Linux on it. Indeed, some of the steps involved here are quite complex and many things can work out differently than expected.

How to do it...

Some of the most commonly faced issues working with the Intel Galileo board are as follows:

  • The board doesn't boot: The first thing that can happen is that the board doesn't actually boot. If no LEDs light up at all, you have some serious problems. First, make sure that the power adapter you are using is working. Then, if the problem persists, it probably means your Galileo board has a problem, and needs to be replaced.

  • Installing the Linux image failed: If you can't install the simple Linux image on an SD card, format the SD card first using your computer. It can be the case that there are files on the SD card or it was formatted using the wrong file format.

  • Installing the IoT image failed: If, for any reason, the installation of the IoT image fails, the first thing to do is repeat the procedure. Also, make sure to follow step-by-step the instructions from the Intel website, as only missing a single step can lead to a problem with the SD card.

    You can also try to reformat the SD card before following the steps from the Intel website.

  • The board cannot be accessed remotely: If you cannot log on to your board via SSH, first make sure that you are trying to access the correct IP address. Use the Intel XDK software for that. You can also try to ping the board from a terminal to make sure that it is answering network requests. Also, make sure that Bonjour is installed on your computer.

  • The package manager doesn't work: The main reason for the package manager not working is that you are not connected to the Internet. Make sure that your Internet router is configured to share Internet access across all devices connected to it.

    Also, I noticed that the Galileo board sometimes just loses Internet connectivity. To solve this problem, simply push the Reboot button on the board.

  • New packages can't be installed: If you are sure that your Internet connectivity is working, it could simply be that you are trying to install a module that is not available for the Galileo. Not all Linux packages are available, so make sure first that the desired package is available for the Intel Galileo board.

  • The board cannot be accessed via Wi-Fi: If the Wi-Fi connection doesn't work, first make sure that the Wi-Fi extension board is correctly connected to the board. If the board doesn't show up on the Galileo board interface (as wlan0), there might be a hardware problem with the extension board.

About the Author
  • Marco Schwartz

    Marco Schwartz is an electrical engineer, entrepreneur, and blogger. He has a master's degree in electrical engineering and computer science from Supélec, France, and a master's degree in micro engineering from the Ecole Polytechnique Fédérale de Lausanne (EPFL), Switzerland. He has more than five years' experience working in the domain of electrical engineering. Marco's interests center around electronics, home automation, the Arduino and Raspberry Pi platforms, open source hardware projects, and 3D printing. He has several websites about the Arduino, including the Open Home Automation website, which is dedicated to building home automation systems using open source hardware. Marco has written another book on home automation and the Arduino, called Home Automation With Arduino: Automate Your Home Using Open-source Hardware. He has also written a book on how to build Internet of Things projects with the Arduino, called Internet of Things with the Arduino Yun, by Packt Publishing.

    Browse publications by this author
Intel Galileo Networking Cookbook
Unlock this book and the full library FREE for 7 days
Start now