Zigduino and ZMAC

Zigduino pair

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.

More Reading

For more, see 802.15.4 vs ZigBee on sensor-networks.org. Also, this Presentation from Atmel goes into their perspective on the whole stack.

Wish List

Here’s what I’d like to see from Zigduino in the future

  • Smaller
  • Cheaper
  • 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


Filed under Arduino, RF Radio, Zigduino

5 responses to “Zigduino and ZMAC

  1. I just ran across your site and it looks like we are working towards the same goals. I agree the Zigduino boards look interesting. But @ $70, the price is pretty steep.

    I actually developed my own atmega128rfa1 boards. One of my latest boards sounds exactly like what you propose for the “Zigduino mote”. I’ve kinda documented my progress over @: http://yzf600.dns2go.com/blog. My big hurdle now is making more than a couple of boards at a time. The other hurdle is I’m moving ~2k miles for a new job.

    Have you considered how much extra ram and flash the Arduino libs take up when paired with Contiki, espcially if you turn on RPL? I know when I compiled the webserver app for my board, there was not much ram left.

    • Yeah, I saw your stuff while searching for Contiki+128rfa1. Good luck with your move! I agree, $70 is way too much. Pierce is working on a ‘mote’-style version which hopefully will come in less than that. You could compare against the Red Bee Econotag at $55. A much cheaper zd-mote could be the most cost-effective Contiki platform to date.

      That’s a good point about memory. I’ve seen free memory get down under 2k without RPL and without even webserver. That said, I haven’t looked into details at all. I know that there are people on the contiki-developers list trying to solve the memory problem for webserver+RPL, optimized for tmote sky which has only 10k RAM. If they can get it to work on the sky, we should be able to get it to work on 128rfa1.

      BTW, I’ve put up a contiki platform for Zigduino at https://github.com/maniacbug/contiki-avr-zigduino/wiki

  2. Greg

    Wish list :
    I can get a 720mhz Beagleboard for $125

  3. Many thanks for posting “Zigduino and ZMAC | maniacbug”.
    I personallymay absolutely end up being back for alot more reading and commenting
    here soon. Thanks, Carla

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 )

Connecting to %s