You've chosen Intel's new Galileo processor board and you are ready to start some amazing projects. However, you might be new to this kind of processor, or you might have used another similar processor but not the Galileo. This book is designed to lead you step-by-step through a number of examples that will provide you with the knowledge you need to access the power of the Galileo. You'll also learn how to add additional hardware to sense the world around you, display information, and even control motors or servos.
In this chapter, you'll start by unpacking and connecting the Galileo to your host machine, then you'll learn how to use the Galileo from your remote computer. If you know how to use Mac or Linux machines, this chapter will show you how to use them. You'll take a peek into the internals of the Galileo and learn about the Linux machine hiding behind the simple Galileo exterior.
For this chapter, the objectives are as follows:
Unpacking and connecting the Galileo to a host computer
Loading and configuring the Galileo IDE, based on the Arduino IDE
Downloading and running some simple example programs
Taking a peek at the Linux machine at the heart of the Galileo
The Galileo is packaged with a power cable. Here is a picture of the board:
This is how the board will look without the adapter:
Note
This particular Galileo is a Gen 2 board. This version is a slightly improved version of the original Gen 1 board, and has a few connector changes. The examples in this book have been tested on both versions, and should work unless noted.
The power connection is very straightforward. However, you'll also need another cable to start working with the Galileo. This is a USB-to-micro USB cable. Here is a picture:
This cable will go between the Galileo and the host machine to develop and debug the code. Here are the specific connections:
To prepare for developing the Galileo, plug the power into an outlet and the board. A green power LED close to the USB connector should light. Now you are ready to connect your board to a remote computer to begin programming The next sections will cover how to connect your Galileo to a computer running Windows, OS X, or Linux.
The first step in setting up your remote computer for development with the Galileo is to download the Integrated Development Environment (IDE) software from https://communities.intel.com/docs/DOC-22226. Choose the download link for Windows. This will download the IDE as well as the drivers for the Galileo. When this file is downloaded, unzip the file using an archive manager (for example 7-zip) to a location on your C:
. This will un-archive a set of files and directories under the arduino-1.5.3-Intel.1.0.3
directory structure.
Plug the USB from the Galileo into your computer. If you are using a newer version of Microsoft Windows, when you plug the Galileo into the system it will try to install the drivers automatically. The device will fail to install. You'll need to install the drivers manually, using the following steps:
Select the Start | Control Panel | Device Manager inside Windows. Under the Other devices menu, select the Gadget Serial v2.4 device. Then select Update Driver Software, as shown in the following screenshot:
Next click on Browse my computer for driver software.
Click on Browse… next to the file path input box.
If you installed your Arduino IDE folder in the root of your hard drive, navigate to
C:\ardunio-1.5.3\hardware\arduino\x86\tools
and click on OK. If you have installed it in a different location, navigate to this directory, select it, and then click on OK.
You will get a security warning; click on OK and the drivers will install. When your drivers are installed, you should see the following device when you navigate to Start Menu | Devices and Printers:
In this case, the device is connected to COM port 34. Note down the COM port the Galileo is connected to as you'll need that in a minute.
If you are using an OS X machine, download the OS X version of the IDE software at https://communities.intel.com/docs/DOC-22226. Unzip this file into your Applications
folder. Then connect the 5V power to the Galileo. Connect the USB cable from the Galileo to an available USB socket on your computer. Wait for a minute while the Galileo boots up. To verify that the Galileo has loaded properly, open the System Information window. Then check under the USB tab for a Gadget Serial v2.4 entry as demonstrated in the following screenshot:
You should also check under the Network tab to find the device name of your Galileo. It should be something like usbmodemXXXX. Note down this name as you will need it to select the correct port later when you configure the connection to the Galileo. You are now ready to run the software.
If you are using a Linux machine, download the Linux version of the IDE software from https://communities.intel.com/docs/DOC-22226. Unpack this file using tar -zxvf arduino-1.5.3-linux32.tar.gz
. You will also need to disable the modem manager on most Linux distributions to enable uploading to the board. How you do this will vary by distribution but, if you are using the Ubuntu distribution, type sudo apt-get remove modemmanager
.
To connect the Galileo board to the Linux machine, simply plug in the USB connector to one of the USB ports on the Linux machine. Open a terminal and type sudo ls /dev/ttyACM*
and this will list the device connected to the machine. You should note down this value as you will later need to specify the port.
Now that the device is installed, you can run the IDE. Select and run the program based on the type of machine you are using. The IDE should start and you should see something resembling the following screenshot:
This is the environment you will use to develop your applications. You can use this IDE to compile the code, upload it to the device, and then run it.
The first thing you'll need to do is set the IDE to create code for the proper Galileo board. Fortunately, the IDE lets you set that by choosing the board. To do this, navigate to Tools | Board | Intel® Galileo Gen2, as shown in the following screenshot:
The next step, selecting a port to connect the board to the IDE, will depend on the type of operating system you are using.
To specify the port for Windows, navigate to Tools | Serial Port | COM23, (the port you noted earlier) as shown in the following screenshot:
The IDE should now indicate that you are using the Galileo on COM23
in the lower-right corner of the IDE, as in the preceding screenshot.
To specify the port for Mac, navigate to Tools | Serial Port | and select the port you noted earlier when you installed the drivers. The IDE should now indicate that you are using the Galileo on the proper port in the lower-right corner of the IDE.
The first thing you'll want to do is update the firmware on the Galileo. To do this, select Help | Galileo Firmware Update, as shown in the following screenshot:
Having the latest firmware is always a good idea; you might want to repeat this step every week or so just to make sure you have the latest.
Now that your board is connected and you are running the latest firmware, you can open and upload a simple example file. It is called the blink application. It has already been written for you, so you won't need to do any coding.
To get the blink application, perform the following steps:
Navigate to File | Examples | 01.Basics | Blink, as shown in the following screenshot:
You should then see the Blink code in the IDE window, as in the following screenshot:
Once you have uploaded the file, it will tell you in the lower-left corner of the IDE display that the file is uploaded, as in the following screenshot:
When the program is uploaded, it will automatically start running and the green LED that is positioned close to the USB connection on the Galileo will start blinking. The following images shows the LED:
You have now successfully uploaded your first program to your Galileo!
There are several differences between the Galileo and the more common Arduino board that many of you might be familiar with. The Galileo has significantly more processing power. However, it also starts up into a Linux operating system, and then exposes its programming environment in an Arduino-like interface. While you'll almost exclusively use the Arduino IDE interface in this book, you can also access the Linux capabilities of the Galileo. You'll learn more about this in Chapter 7, Going Further with Galileo.