How to talk to a NXTBee from your PC or Mac

Dec 2011


The Dexter Industries NXTBee is a serial radio that allows your NXT to communicate at high speeds with other NXTs. What makes it so attractive is that there is no setup involved; you simply turn on the NXTBee and it finds all of the other local NXTBees and joins them in sending and receiving data.

Wouldn’t it be great to send and receive data to and from your NXT using your PC or Mac? Well thankfully that’s possible using the NXTBee. The NXTBee is basically a standard XBee radio in a convenient package for the NXT to use. An XBee uses a standard communication protocol to exchange data with other XBees, so if you attach an XBee compatible device to your PC you will be able to send and receive data with your NXT over long distances (up to 300ft for the standard NXTBee, and up to 1.2Km for the Pro version!)

But what to buy to connect your NXT to your PC? I found two options available online.

Option 1 is the The Sparkfun Explorer USB is a small board that allows you to mount an XBee device and connect it to your PC via a USB cable. The Sparkfun board uses a mini-USB cable to provide both power and data connection to your PC. Don’t forget that Sparkfun sell only a bare-board, you’ll need to purchase an XBee from them separately.

The Sparkfun Explorer board allows you to change the XBee, so you can experiment with both the standard and Pro variants.

Option 2 for communicating with the NXTBee is the XStick available from Digi International. The XStick is a small USB dongle that contains a standard XBee radio. It is a smaller form-factor than the Sparkfun board, and so ideal for mobile use. However it does not allow you to change the XBee which is an advantage of the Sparkfun Explorer board.

Configuring the XStick and Sparkfun Explorer

This short tutorial shows you how to configure the firmware in a new XBee, or the Digi XStick, so that you can communicate with the NXTBee connected to your NXT using a terminal program such as HyperTerminal on the PC or CoolTerm/ZTerm on the Mac.

For this tutorial you need to buy a NXTBee from Dexter Industries, and purchase an XStick from Digi, or an XBee and Explorer USB board from Sparkfun.

Windows Users: The Sparkfun Explorer board appears as a standard COM port serial device on the PC. The COM port number assigned to the Explorer board will depend on what hardware is attached to your PC. Right-click on the “My Computer” icon (in Windows XP)  to open the System Properties window. Then click on the “Device Manager” button to open the device manager window.

Scroll down to the Ports entries, and expand it. You’ll see a tree view of all the serial devices attached to your PC. For example, the Sparkfun Explorer appears as COM10 on my PC as shown in the window below. Remember that number because you’ll use it later on to configure the XBee to communicate with your NXTBee.

Mac Users:

Mac users will need to install updated drivers for the usb-serial interface from FTDI: The XStick and Explorer boards appear as a serial device in the /dev directory on your Mac. The actual device name will change depending on what type of device you attach. For example, the XStick device appears as /dev/tty.usbserial-00002006 on my Mac.


Configuring the firmware in the XStick or XBee is done using the XCTU tool from Digi. XCTU is a Windows-only program to change configuration settings in the XBee. You can use the XCTU tool to re-flash the firmware running in the XBee or XStick. Unfortunately this program only runs on Windows, so I used a Windows XP virtual machine image running in Parallels on my Mac. You may have some luck running XCTU under wine, but I have not tried that. If you are a native Windows user then you can download and run the XCTU tool directly.

The XBee device in the NXTBee is configured as an XB24-DM modem. Thus to make the XStick or a new XBee purchased from Sparkfun work with the NXTBee they too must be configured as XB24-DM modems. Once I discovered this both my XStick and my new XBee Explorer board worked perfectly with the NXTBee.

These steps are summarised from the tutorial presented by Instructables on how to configure an XBee.

Step 1: Set your connection settings

The XCTU tool needs to be told what baud-rate the XStick/Explorer is running at. By default this is 9600 baud. If the COM port for the XStick/Explorer board is not listed in the window, click on the PC Settings tab and then click the Add button in the bottom right corner of the window. Type the number for the COM port you obtained from the Device Explorer window earlier into the Com Port Number field. This will add the COM port into the Com Port Setup list. Click on the COM port (in this example I’m using COM11) and then click on the Test/Query button.

All going well you’ll see a window like this:

This means that you are now talking to the XStick or Sparkfun Explorer board.

Step 2: Choose the XB24-DM firmware image

Next click on the Modem Configuration tab on the top of the window. You’ll see a screen similar to this appear:

Click on the Read button on the upper left and the XCTU tool will read the current configuration settings from the XStick or Explorer XBee and display them in the window. The first thing we need to change is to verify that the Modem type is set to XB24-DM, and that the Function Set is XBEE DIGIMESH 2.4.

Select the checkbox that says “Always update firmware” and press the Write button. This will re-configure the XStick/XBee to use the new firmware, which is compatible with the NXTBee.

Step 3: Change the baud rate in the XBee/XStick

As I mentioned the default baud rate for the XStick/XBee is 9600 baud. This is a little slow, so let’s increase it to something more useful. 115,200 baud works better! In the window above you’ll see that I’ve scrolled to the Serial Interfacing section and changed the BD Baud Rate parameter to 115200. Click on the Write button and the XStick/XBee will change its default baud rate to 115200.

But remember - XCTU is still configured to talk at 9600 baud. Click on the PC Settings tab and change the baud rate setting to 115200, and click on the Test/Query button to verify that the baud rate change took effect and we can talk to the XStick/Explorer.

Communicating with the NXTBee

Now let’s receive some data from the NXT and display it on our PC or Mac. On the PC uses the HyperTerminal program to connect to the COM port you used in XCTU (be sure to close XCTU first or the COM port will be locked and HyperTerminal will be unable to open it). On the Mac there are a number of terminal emulation programs available. Either CoolTerm or ZTerm will work. For these examples I’ll use CoolTerm on my Mac, but the principles are the same no matter which terminal emulator you choose.

Step 1: Connect the NXTBee to port 4 on the NXT. The NXTBee will only work on port 4 as it uses the high-speed RS485 serial link.

Step 2: Download the NXTBee sample programs from Dexter Industries download page. If you are using NXC then download the NXTBee Raw Communications example. The program is written to use 9600 baud by default, so change line 73 to use 115200 baud:

// initialize the UART to default values

// hi level API function call

RS485Uart(HS_BAUD_115200, HS_MODE_DEFAULT); // use 115200 baud

and download and run the NXTBeeRawSend program on the NXT. This program will start automatically sending a string out over the NXTBee.

Step 3: Connect the XStick or Sparkfun Explorer board to your PC/Mac.

Step 4: Start your terminal emulator, in this case I’m using CoolTerm:

Step 5: In CoolTerm on the Connection-Options to select the serial port and set the baud rate. Click the Re-Scan Serial Ports button to detect the XStick/Explorer board if it does not appear at first in the Port pull-down list.

As you can see the serial port on the Mac for my XStick is /dev/tty.usbserial-00002006. Click OK.

Step 6: Click on the Connect button, and all going well you will see the text sent by the NXT appear in your terminal window!

Anything you type in the terminal window will be sent to the NXT through the XStick and hence to the NXTBee.


Last updated 18 December, 2011

All content © 2008, 2009, 2010, 2011  Mark Crosbie

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this site. This site, its owner and contents are in no way affiliated with or endorsed by the LEGO Group. For more please read the LEGO Fair Play policy.