Cool Cap Engineer

Engineering by an anime nerd

Tutorial: X-Bee Wireless Radios

2 Comments

xbee

I remembered my professor at RPI had a famous saying about RF electronics: “Once you build an RF transmitter from scratch that can transmit 50 feet, then you’re ready to get a P.H.D.” The point she was trying to make is that RF electronics is one of the toughest electronics engineering fields out there.  It requires a lot of impedance matching, fabricating printed circuit boards, and choosing the right amplifier just to make a RF transmitter. Rather than trying to build an RF transmitter/receiver from scratch, Digi sells the X-Bee Wireless Radio, which is specifically designed to work with microcontrollers. Today’s tutorial will show you how to get started using X-Bee Radios. Although I typically use PIC microcontrollers for my tutorials and this tutorial can be revised for any microcontroller, I will use an Arduino Mega board this time.

Parts List

X-Bee_Radio_Communication

Hardware

  1. Arduino Mega (1x)
  2. FTDI Programmer (1x)
  3. X-Bee Radios (2x)
  4. X-Bee Radio Breakout Boards (2x)
  5. Breadboard (2x)
  6. 3.3V Voltage Regulator (1x)

Software

  1. Arduino IDE
  2. X-CTU

First things, first

Solder the X-Bees to the X-Bee breakout board. The X-Bee modules cannot fit onto a breadboard due to the pitch spacing and the breakout boards allow the modules to be placed on a breadboard.

Setting Up The X-Bee For The Computer

Wire the FTDI programmer, 3.3V voltage regulator, and X-Bee Radio to the breadboard as shown in the figure below.

xbee_tutorial_one

Make sure that…

  1. GND of the FTDI programmer is connected to GND (pin 1) of the voltage regulator and GND ( pin 10) of the X-Bee module
  2. VCC of the FTDI programmer is connected to VIN (pin 3) of the voltage regulator.
  3. VOUT (pin 2) of the voltage regulator to Vin (pin 1) of the X-Bee module.
  4. RX of the FTDI programmer to Dout (pin 2) of the X-Bee module.

Now connect a USB cable to your FTDI programmer. From there, open up X-CTU.

xbee_tutorial_2

Select one of the COM ports (for me, my FTDI programmer was connected to COM6) and select Test/Query. This just checks to make sure your FTDI programmer is properly connected to X-CTU. You should receive this message if the FTDI programmer is successfully connected to the computer.

xbee_tutorial_3

If you did not receive this prompt, then it could mean the following…

  1. One of the connections is loose. Make sure your connections are solid.
  2. The COM port is in use. Disconnect the programmer and reconnect it to the computer. If that does not work, then restart the computer and try again.
  3. You could have a bad programmer if 1 and 2 does not work.

Now click on terminal. Leave this open! We will come back to this later.

xbee_tutorial_4

Setting Up The Arduino Mega

Now upload the following code to the Arduino Mega.

void setup()
{
  Serial2.begin(9600);
}

void loop()
{
  Serial2.print("Hello World \r\n");
  delay(1000);

}

While your Arduino is connected, make the following connection.

xbee_arduino_pic

Make sure that….

  1. 3V3 of the Arduino Mega is connected to VCC (pin 1) of the X-Bee
  2. RX2 of the Arduino Mega is connected to Din (pin 3) of the X-Bee
  3. GND of the Arduino Mega is connected to GND (pin 10) of the X-Bee

Now For Some Action!

Navigate back to your X-CTU terminal window. You should start to see “Hello World” printed on the screen multiple times.

terminal

Couple Key Things To Keep In Mind

  1. The X-Bees in this tutorial  can only work with a baudrate of 9600. If you want a X-Bee with a higher baudrate, then look at this one.
  2. X-Bees can only work with 3.3V power. DO NOT CONNECT ANYTHING HIGHER! IT WILL NOT WORK.
  3. X-Bees can work with any microcontroller. Just connect the microcontroller TX line to the X-Bees Din to allow your microcontroller to transmit data. If you want your microcontroller to recieve data, then connect its RX line to the X-Bee’s Dout line.

Well that’s it for me! Feel free to post a comment underneath this post for any comments or suggestions. See you guys later!

Advertisements

2 thoughts on “Tutorial: X-Bee Wireless Radios

  1. Excellent work, it’s very useful !!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s