Arduino Fio and XBee

I had several criteria for selecting the onboard Arduino.

  1. It should be as light as possible to keep boat weight down. This includes the battery.
  2. It should have low power consumption to reduce the number of times I have to access it in the boat hull.
  3. It should be as small as possible due to limited space in the boat.
  4. It should be able to gather information from several sensors.
  5. It should be able to transmit the data wirelessly through an XBee.

The Arduino Fio seems like an ideal choice because it fits the criteria and they are pretty cheap.

I had previously set up my XBees (Pro Series 1) to communicate with each other using an Arduino Uno (on shore) and Arduino Mega (on boat). I thought I would be able to seamlessly upload the sketch that was used on the Mega onto the Fio, but no such luck. I was getting only garbage characters coming through. After hours of rechecking XBee settings and stepping through iterations of XBee/Computer/Arduino setups, I found that the issue was how the Fio treats the XBee serial connection.

On the Mega and Uno, I use SoftwareSerial to communicate with the XBee. On the Fio, you can write and read directly from Serial, like the code below. The most up to date code is here.

 * A simple example program that will send text every second.
 * I use this to make sure my Fio and XBee are working appropriately.
 * I hook another XBee up to my computer with an breakout board and
 * use CoolTerm to display the messages.

void setup() {
  Serial.begin(57600);	// opens port at 57600 bps

void loop() {
  Serial.print("Fio is working");
  Serial.write(10); //ascii line feed

  // wait 1 second then loop again

This makes sense when you remember that the Fio has a restriction where you can use the UART connection or the XBee, but not both at the same time.

At first I was hesitant to tackle uploading the sketches over the XBee, but the tutorial here was great. A couple pieces of information I wish I knew when I started:

  • Use a baud rate of 57600 so you don’t have to reprogram the XBees.  The tips section mentions this, but the description was confusing to me.
  • You don’t have to reconfigure the XBees when you are done uploading your sketches. The XBees can still be used to communicate Arduino to Arduino when set up to bootload to the Fio.

1 thought on “Arduino Fio and XBee”

Leave a Comment