Wednesday, February 08, 2012

Arduino to Android on BeagleBoard via Zigbee

It eventually became clear that it was time to combine two projects, Contraption, in which I run Android overlaid with GNU on the BeagleBoard, and Amigo, my latest effort in which I build a wireless sensor platform using Arduino and Zigbee radios. Now I have Amigo reporting sensor readings to Contraption via a wireless serial connection using XBee Series 1 radios from Digi.

Here's an aerial view. Up at the top you can see the LCD monitor for the BeagleBoard running Android FroYo. Below is my tiny Mac Mini desktop system and it's huge Cinema display. To the right is the explosion of boards and cables.

Aerial View: Android on BeagleBoard, Arduino Sensor Platform

Here's a closeup of the boards. To the left is the BeagleBoard xM Revision C inside its clear plastic case festooned with cables. To its right is the Arduino with two shields stacked on top of it, an Ethernet shield and a Xbee shield. In front of them is the tiny Xbee Explorer board connected via USB to the BeagleBoard.

BeagleBoard running Android, Arduino Sensor Platform

I had budgeted a couple of days to getting this working. It took a couple of hours. I had to rebuild the Linux 2.6.32 kernel used by FroYo to include the ftdi_sio driver (kernel option CONFIG_SERIAL_FTDI_SIO). This supports the FTDI USB-to-serial chip used on the Explorer board, and whose driver has been part of the mainline Linux kernel distribution since 2.6.31. Once Android was booted up on the BeagleBoard, I plugged in the Explorer and was greeted by a new serial device /dev/ttyUSB0. I set the serial baud rate via

stty -F /dev/ttyUSB0 9600

using BusyBox running on the GNU layer in Contraption. Then I just did a

cat /dev/ttyUSB0

on the BeagleBoard serial console and saw the CSV output of the Amigo sensor platform wirelessly over Zigbee.

Android Serial Console

Amigo implements a tiny web server through which its sensors can be interrogated across its Ethernet connection. It seemed like a moral imperative to try this from the Android browser.

Android Web Browser Interrogating Arduino Web Server

I'm eventually going to migrate to XBee Series 2 radios, which are capable of much more complicated topologies than the wireless serial link provided by Series 1. I'm playing with Series 2 radios right now. But this was a useful first step.

1 comment:

Anonymous said...

Can you explain more about recompile Android kernel for BB enabling the CONFIG_SERIAL_FTDI_SIO flag?

I also need to connect an external FTDI based device to BB (running ICS, kernel 2.6.37), but i've no idea how to recompile the kernel including FTDI drivers.