Chapter 6. Remote Control

Now you might want your project to be mobile. You'll at least want to disconnect it from the tether cable that you have been using to communicate with it to send control commands. In this chapter, you'll learn how to communicate wirelessly with your project. Depending on your choice of device, you'll be able to communicate across the room or across a distance of up to a mile.

In this chapter, you'll learn the following:

  • How to communicate with the Galileo using an XBee transmitter/receiver, a point-to-point communication system that allows you to communicate between two Galileos or between a Galileo and a host computer
  • How to configure the Galileo using a Wi-Fi mini PCI Express card so you can communicate via Wireless LAN

Connecting an XBee interface to the Galileo

One of the most popular and well-documented ways of connecting to the Galileo via an RF connection is to use an XBee device. This device uses a technology called ZigBee and it is made for longer-range wireless communications. These types of devices can work up to a range of one mile. The ZigBee standard is built upon the IEEE 802.15.4 standard, a standard that was created to allow a set of devices to communicate with each other to enable low data rate coordination of multiple devices.

The other standard that you might hear about as you try to purchase or use devices such as these is XBee. This is a specific company's implementation, Digi, of several different wireless standards with standard hardware modules that can connect in many different ways to different embedded systems. They make some that support ZigBee. Here is an image of this type of device that supports ZigBee attached to a small, XBee-specific shield that provides a USB port:

Connecting an XBee interface to the Galileo

The advantage of using this device is that it is configured to make it very easy to create and manage a simple link between two XBee series #1 devices. To make this work, you'll need four items:

  1. Make sure you have two XBee devices that support ZigBee series #1.
  2. You'll also need to purchase a small, XBee-specific shield that provides a USB port connection to one of the two devices. This will provide communication from a host computer.
  3. You'll also need to buy a shield that plugs into your Arduino so you can interface to the XBee devices. This shield is the Wireless SD card shield, and has header pins ready for the XBee device. Here is an image of the shield plugged into a Galileo, with the XBee device plugged in:
    Connecting an XBee interface to the Galileo

Now let's get started with configuring your two devices to talk.

Configuring the XBee devices

You'll need to configure both devices by plugging them into your host computer. Plug one of the devices into the small, XBee-specific USB shield and then connect the shield to your personal computer. Your computer should find the latest drivers for the device. If your computer does not find the device or is unable to correctly install the drivers, see http://ftp1.digi.com/support/images/Win7DriverInstall.pdf for help. You should see your device after you've selected Devices and Printers from the Start menu, like this:

Configuring the XBee devices

The device is now available to communicate via the IEEE 802.15.4 wireless interface. You could set up a full ZigBee-compliant network, but you're just going to communicate from one device to another directly, so you'll just use the device as a serial port connection. Double-click on the device, select the Hardware tab, and you should see this:

Configuring the XBee devices

Note that the device is connected to the COM20 serial port. You'll use this to communicate with the device and configure the device. You can use any terminal emulator program; I like to use PuTTY. If you don't have PuTTY, you can download it from www.chiark.greenend.org.uk/~sgtatham/putty/download.html. This will provide an executable that you can run to talk with and configure the devices.

Note

Digi has recently introduced a new graphical tool for configuring XBee devices. It provides access to all the configuration settings on the XBee. If you would like to use this tool, see http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/xctu

Perform the following steps to configure the device:

  1. Open up PuTTY, select Serial, and the (in this case) COM20 port. Here is how to fill in the PuTTY window to do this:
    Configuring the XBee devices
  2. Configure the terminal window as shown in the screenshot:
    Configuring the XBee devices
  3. Now, in the Terminal window, make sure you also select Local echo Force on, and check the Implicit CR in every LF and Implicit LF in every CR (available under Terminal in the Category: selection.):
    Configuring the XBee devices
  4. Connect to the device by selecting Open.
  5. Enter the following commands by typing them into the terminal window:
    Configuring the XBee devices

The OK response comes back from the device as you enter each command. The first device is now configured. Remove it from the small, XBee-specific shield and plug it into the Arduino XBee shield.

Now plug the second device into the small, XBee shield and then plug it into the PC. Note that it might choose a different COM port, go to the Devices and Printers option, double-click on the device, and select the Hardware tab to find the COM port. Follow the same steps to configure the second device, except there are two changes. Here is the terminal window for these commands:

Configuring the XBee devices

The two devices are now ready to communicate.

Configuring the device using a Mac is very similar. Follow these steps to start a terminal connection with the device:

  1. Plug the XBee module into the XBee shield and hook it to your Mac via USB.
  2. Open up a CoolTerm window and then hit the Options on the toolbar.
  3. Select the correct port for your XBee device. It will look something like usbserial-XXXXXXXX.
  4. If your device doesn't appear, plug it back in and click on Re-Scan Serial Ports.
  5. Hit the Ok button and the rest of the defaults will work just fine.
  6. Hit the Connect button on the toolbar and you should be talking to your XBee.

Now you can configure your device as shown previously. If you are using Linux to configure your device, you will similarly open a terminal window, connect it to the proper USB serial port, and then configure the device.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.158.137