This week, I got my hands on a pair of Zigduino units. This is Pierce Nichols’ creation of a Arduino on steroids plus a Zigbee-compatible RF radio, all in one unit. From a hardware perspective, this replaces an Arduino, Xbee Shield and Xbee all at once. On top of that, there are a few more advantages: It’s compatable with further shields, unlike normal Xbee shields which don’t allow you to stack. And best of all, it uses the Atmega128RFA1 chip instead of the Atmega328p found on the Uno. This MCU brings 128KB of flash and 16KB of RAM to the party, plus a bunch of other great features for the power user (onboard AES, among others).
The biggest thing it lacks is a ready software stack. Xbee is easy for even the most non-technical user to bring up, which explains its popularity in the Internet community. So this what I’ve been working on, at least the beginnings of it. The most straightforward way to use Zigduino today is to get Atmel’s IEEE 802.15.4 MAC stack implementation of the IEEE 802.15.4 MAC standard. This is an extensible multi-layer stack that makes available the full power of this SoC. The source is available, it’s well-documented, and it comes with exhaustive examples.
What’s the problem? First, the licensing. While the source is available, it includes no redistribution rights, so it’s not something you can hack on and go share your changes. Second, the build system. For someone comfortable with GCC and Gnu Make, all is well. For folks who take comfort in the simplicity of the Arduino IDE, it’s a problem.
ZMAC is my solution to this problem, available at github.com/maniacbug/ZMAC. First, you download the Atmel MAC distribution yourself, sign up with Atmel, agree to the license, etc. Then you get ZMAC, and run the fileprep script. This will copy and modify the files as needed to organize them so the Arduino library can pick them up. It will even translate some of the examples into a form that will load and compile and run using the Arduino IDE.
The ZMAC README covers all the details on how to set it up, and test it. Once the examples are running, it’s time to learn more. The MAC by itself is not particularly easy to use for beginners. It expects a crisp understanding of the principles of the IEEE 802.15.4 MAC design. There are three things to study to help understanding this:
- 802.15.4 guides and documentation. Try This Whitepaper, and anything else you can find searching the web.
- The user guide in the Atmel MAC. Read through the Doc/User_Guide/AVR2025_User_Guide.pdf. This is a dense guide chock full of stuff you need to know. Start with Chapter 9, which explains the sample applications in great detail.
- The Star_Nobeacon example code. I recommend putting in “printf” debugging statements everywhere so you can keep track of what’s going on.
A better solution would be a library that’s easier to use for mainstream Arduino users (i.e. beginners) that presents a higher-level layer to the user. Currently the app is expected to handle much of the details of scanning and association. This could all be pulled into the higher-level library.
This hypothetical library should enable all the functionality covered in Robert Faludi’s excellent Wireless Sensor Networks book.
A more usable MAC will be a good first step to bringing Zigduino to all Arduino users, although there will be more needed before it’s a full Zigbee implementation. The MAC layer is just the first part of the stack, the underpinnings of Zigbee. The real work is done by BitCloud.
“BitCloud is a full-featured, professional grade embedded software ZigBee stack fromAtmel. The stack provides a software development platform for reliable, scalable,and secure wireless applications running on Atmel microcontrollers and radiotransceivers. BitCloud is designed to support a broad ecosystem of user-designedapplications addressing diverse requirements while enabling a full spectrum ofsoftware customization.
“BitCloud stack is fully compliant with ZigBee PRO and ZigBee standards for wirelesssensing and control. It provides an augmented set of APIs which, while maintainingfull compliance with the standard, offer extended functionality designed withdeveloper’s convenience and ease-of-use in mind.”
Sadly, BitCloud is only available as libraries, which means it will not work in the Arduino IDE. In order to build ZigBee apps on Zigduino, you’ll be usign Avr Studio or a command-line make tool.
Here’s what I’d like to see from Zigduino in the future
- Low Power
Specifically, I am thinking about a ‘Zigduino mote’, small form factor device to use in large-scale sensor networks.
- Cost-reduced — drive out any expensive parts
- Runs on 2x AA batteries
- Port for adding sensors (2×5-pin?)
- Small number of LED’s and switches for status and configuration