A Friendly Introduction to XBee

Digi XBee radios sure are handy for wireless communication in embedded systems, so let’s take a look from a newbie perspective at how to get two of ‘em talking to each other quickly.

This tutorial can be applied generically to any setup with any two XBee radios, so long as you have them plugged in and ready to work with a serial port. That being said, this is a list of parts used in this tutorial:

As far as software goes, we’re going to need to use the one and only Xbee programming tool, XCTU from Digi (Windows, Mac OS, and Linux). Although, I suppose if you were hardcore, you could program using raw AT commands at the console, but I doubt that’s a path you’re willing to take at this time!

We’ll start with installing the software, configuring the XBee radios, installing them, and finally get them talking to each other.

Digi XCTU Software

Installation of the Digi XCTU software should be straightforward enough. Head over to the XCTU download page, download it for your platform, and follow the install instructions.

When you’ve installed it, open it up. Here’s what you should see:

Okay! Now, we’ll move onto hooking up the XBee radios using the XBee explorer breakout board and configuring them using our newly installed XCTU program.

Configuring the XBee Radios

Here’s where the rubber meets the road, so to speak! We’re going to break out the SparkFun XBee Explorer and program both of the XBee radios so they can talk to each other. All we need here is a USB Mini-B cable to connect the XBee Explorer in with our computer with XCTU installed. Grab one of the XBee radios and install it into the XBee explorer, then plug the XBee explorer into the USB cable connected to the computer.

 

 

 

Once you’ve made the connections, open XCTU (if you haven’t already) and click on the “Discover devices” button. From here, you just have to scan for your device plugged into the XBee Explorer.

 

Now, before we continue, there are a couple of concepts and some terminology we’ll need to be familiar with.

With an XBee network like we’re setting up, there needs to be a coordinator and an end device. You can almost think about it as having a router and a computer.

  • With an XBee network like we’re setting up, there needs to be a coordinator and an end device.  You can almost think about it as having a router and a computer.
  • We need both of the radios to be on the same channel and network, or PAN in this case.
  • Every option is abbreviated with a two letter key.  The ones we’re concerned with for this guide are:
    • CH – Channel
    • ID – PAN ID
    • MY – 16-bit Source Address
      • This is the address of the current device and can be any 16 bit number.
    • DL – Destination Address Low
      • DL is the address of the device you want to talk to, it can be any other 16 bit number other than MY.
    • CE – Coordinator Enable
    • BD – Interface Data Rate (Optional)
    • CT – AT Command Mode Timeout (Optional)
  • The XBee radios are programmed using AT commands over serial console.  The XCTU program makes programming the XBee incredibly easy as it takes care of running all the AT commands transparently in the background.

Pro Tip: Save yourself some headaches and label your XBee radios in order to tell them apart. A piece of tape or tiny post-it note and permanent marker will do just fine. Label one with “C”, for “Coordinator” and the other with “ED”, for “End Device”. You could also write the MY, 16-bit Source Address, for extra clarity.

Program the Coordinator

Okay, let’s take our first XBee radio, which we’ll designate as our Coordinator (and will ultimately be installed in the TS-7553-V2), and open the “Configuration” window in XCTU. This is what you should be looking at:

Pro Tip: XCTU is pretty well designed, with handy little UI gems like a blue ‘dog ear’ triangle to mark which settings have changed from defaults. Firmware updates, updating individual settings, and more come in pretty handy. Be sure to familiarize yourself once you’re ready.

Here’s what we’re going to set on our coordinator:

These two configuration changes are optional, but if you do change them, make sure to set the same on both XBee radios. We found these additional settings make things run smoother and more responsive.

Once you’ve set these configurations, make sure to click on the “Write” button to save the changes to the XBee radio. Once it’s finished writing, go ahead and unplug the XBee Explorer and take out the XBee radio.

Installing the Coordinator

This is where our TS-7553-V2 comes into play. This guide is going to assume you’re already familiar with getting the TS-7553-V2 powered on and ready for development. If you’re not there yet, you can take a look at the “Practical Guide to Getting Started With the TS-7553-V2”. There’s a XBee socket on the TS-7553-V2 that shows up under the /dev/ttymxc7 serial device.

Before we can plug in our XBee radio, we need to remove or bend pin 8 of the XBee radio in order to avoid conflicts (to be fixed in a later revision).

Then, plugin the XBee radio we’ve designated as the coordinator like this:

Pro Tip: Make sure that the flat end of the XBee radio is facing back towards the USB and Ethernet connectors. Otherwise, you may do permanent damage to the XBee radio.

Then, let’s be sure that the XBee radio is powered on and ready to communicate. First, issue the command to make sure it’s turned on (it should be by default):

Then, let’s open a serial connection with the XBee radio using picocom, making sure that the baud rate is set to the same value as BD, Interface Data Rate on the XBee radios.

Perfect! Now, we’re ready for the next step.

Program the End Device

Now, we’re going to install the second XBee radio into the XBee Explorer and then plug in the XBee Explorer into the computer. We’re going to designate this radio as our End Device. Do the same thing as before and click on the “Add devices” or “Discover devices” buttons to find your device and load up the “Configuration” window, like so:

Here’s what we’re going to set on our end device:

And again, these are optional, but they must be the same on both devices.

Great! Now, we’re going to leave this one plugged into the XBee explorer for the next step.

Time to Start Talking!

Now, the exciting part, communicating wirelessly over a serial port provided by the XBee radio. We start off by going back to our XCTU program where we left off and open the “Console” window, like so:

We’re now going to send a packet to the coordinator installed in our TS-7553-V2 from our end device. Click on the plus icon (+) next to the “Send packets” field. Here, type in your ASCII message. Something as simple as “Testing” will work. Save the packet once finished. Then, select the new packet and click on the “Send selected packet” button. Head over to the TS-7553-V2 picocom session we opened earlier and you should now see “Testing” written on the screen! Start typing in picocom, like “Testing back!”, and you should see the message being written in the Console log field of the XCTU program!

Congratulations on setting up your wireless serial console connection! You’re well on your way to creating something awesome using XBee radios!

Conclusion and Next Steps

In this guide, we walked through what it took to install, configure, and wireless transfer data over two XBee radios. Now that you have the basics out of the way, it’ll be time to dive into a wireless XBee world with different topologies and configuration options.

If you have any further questions, or feel like we’ve forgotten to mention anything, please let us know in the comments below!

Practical Guide to Getting Started with the TS-7670

This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7670 single board computer. We’re going to take a look at how to make our first connections, and setup the network. These are usually the first things we do before starting development. In the grand scheme of things, this is just a friendlier extrapolation from the official TS-7670 manual, so be sure to keep it handy for more advanced topics and specific details. The only assumption being made is that you’ve purchased the TS-7670 with a development kit, including the pre-programmed microSD card. Right then, let’s get started!

Continue reading “Practical Guide to Getting Started with the TS-7670”

Practical Guide to Getting Started With the TS-7553-V2

 

This practical guide gives us an opportunity to take a relaxed approach to getting started with the TS-7553-V2 single board computer. We’re going to take a look at how to make our first connections, and setup the network. These are usually the first things we do before starting development. In the grand scheme of things, this is just a friendlier extrapolation from the official TS-7553-V2 manual, so be sure to keep it handy for more advanced topics and specific details. The only assumption being made is that you’ve purchased the TS-7553-V2 with a development kit, including the pre-programmed microSD card and enclosure with 128×64 px LCD and 4 button keypad. Right then, let’s get started!

Continue reading “Practical Guide to Getting Started With the TS-7553-V2”

Example C Code for Reading ADC Inputs on i.MX28 Based Embedded Systems

Let’s take a quick look at what it takes to read from the ADC inputs of a i.MX28 based embedded system using example C code provided by Technologic Systems. Now, while this can be generically applied to many i.MX28 based embedded systems, we’ll be working with a TS-7680. Right, let’s get started!

Continue reading “Example C Code for Reading ADC Inputs on i.MX28 Based Embedded Systems”

How To Compile the Mainline Linux Kernel v4.9 for TS-4900

embedded-linux-ts-board

Here’s a quick how-to guide straight from one of our engineers on how to compile the mainline Linux Kernel v4.9-rc1 and install it on the TS-4900. Support for the TS-4900 in the mainline kernel image (v4.9 and up) is a pretty big deal for us, and we’re excited about it. A big shout out to our friends at Savoir-faire Linux for their hard work in making this happen!

Step 1: Install the Toolchain

We need to install the toolchain from Ubuntu or Debian Jessie by running the following command:

Continue reading “How To Compile the Mainline Linux Kernel v4.9 for TS-4900”

Develop a Simple Qt Quick Interface for HMI/SCADA Applications

Introduction

We’re graduating from our Getting Started with Qt Creator on the TS-TPC-8390-4900 guide, where we ran an example program which came preloaded with Qt Creator on our TS-TPC-8390-4900, and moving into a more real world situation. This guide builds upon the foundations that we set up in the getting started guide and will walk you through building a simple human machine interface (HMI) for supervisory control and data acquisition (SCADA) applications. We’ll be controlling a register connected to a red LED as well as reading a temperature sensor connected to our CPU. This is about as basic as you can get to demonstrate both system control and data acquisition, and it’s not far from a basic real world use case. In the real world, you’d be toggling DIO or relays instead of toggling an LED. As an end user of the touch panel computer (TPC), you’d be transferring control signals or other data via RS-232 or Ethernet with the press of a button. Once you complete this tutorial it’s a small jump to toggle DIO and relays to control a remote system.

For this guide, a project file containing TS-TPC-8390-4900 specific code written in C++ called “HeatLaser” will be provided for you. It reads CPU temperature every second and toggles the red LED. You’ll simply download it and open the project within Qt Creator. By the end of this guide, you’ll be able to run and have a basic understanding of a Qt Quick Controls application. When you’re comfortable, you can make some edits to the project file to implement other similar tasks that may be more relevant to your needs.

Continue reading “Develop a Simple Qt Quick Interface for HMI/SCADA Applications”

Getting Started with Qt Creator on the TS-TPC-8390-4900 or TS-TPC-7990

Introduction

In this getting started guide, we’re going to look at what it takes to get an example Qt Creator project running on the TS-TPC-8390-4900 or TS-TPC-7990. This will help pave the way for developing a human machine interface (HMI) for supervisory control and data acquisition (SCADA). We’ll start out by talking about the expected workflow and specific versions compatible with our chosen hardware, TS-TPC-8390-4900 or TS-TPC-7990. Next the TS-TPC-8390-4900 and Qt Creator will need to be prepared to work together. Finally, we’ll test our environment by running an example Qt Quick Controls Application. In a follow up guide, titled Develop a Simple Qt Quick Interface for HMI/SCADA Applications, we’ll look into what it takes to gather some system data and control DIO.

Continue reading “Getting Started with Qt Creator on the TS-TPC-8390-4900 or TS-TPC-7990”