The Zigduino r2 is a shield-compatible Arduino variant with an onboard 802.15.4 radio that allows it to communicate wirelessly with a large range of different devices, including not only other Zigduinos and other Atmel-based devices1 but also a wide range of popular devices using the Zigbee protocol. A number of other protocols can also be used.2 It uses an onboard antenna, with the option to replace it with an MMCX connector for an external antenna. The Zigduino runs on 3.3V, but all standard Arduino I/O pins are 5V compatible. In order to withstand the electrical environments that may often be encountered in remote sensing applications, it is designed to be more electrically robust than a stock Arduino. The Zigduino is sold as a subassembly, not a complete product. As a result, it is not currently FCC or CE certified. Compliance with local radio regulations is the responsibility of the user.
|Input Voltage (recommended)||7-18V|
|Input Voltage (maximum)||6-30V (transients to -20V and +60V)|
|Digital I/O Pins||14 + 3 auxiliary|
|PWM Output Pins||6|
|Analog Input Pins||6 (0-1.8V)|
|I/O Protection||±30V transient|
|-2.5V to +5.8V continuous|
|DC Current per I/O Pin||20 mA|
|DC Current for 5V Pin||250 mA|
|DC Current for 3.3V Pin||200 mA3|
|Flash Memory||128 KB of which 2 KB is used by the bootloader|
|Clock Speed||16 MHz|
|RF transmit power||+3.5 dBm|
|Receiver sensitivity||-100 dB|
|Antenna gain||2 dBi|
|Current Draw||30 mA (transmitting, USB, no I/O connections)|
|15 mA (transmitting, no USB, no I/O connections)|
|6 mA (radio off, no USB, no I/O connections)|
|250 μA (sleep)4|
There are numerous changes that separate the Zigduino r2 from the r1. These changes were largely motivated by user comments and feature requests.
- Replacement of FT232RL with FT231X for USB interface. This is transparent to the user.
- Addition of UART0 connector
- D0/D1 moved to UART1. This allows the use of both D0/D1 for user IO while leaving the USB operational.
- Arduino Uno R3 pin layout
- I2C/Wire pins moved to 10 pin digital connector
- Power connector changed to 8 pin style; addition of IOref pin
- Addition of 2x7 2mm AUX connector to carry all additional I/O
- SMT 2.1mm barrel jack
- Battery subsystem
- JST LiPo battery connector (compatible with Sparkfun 1S battery packs
- LiPo charging circuit
- A7 monitors battery voltage (through a voltage divider)
- PWR LED driven through a shorted solder jumper. This jumper can be cut in order to depower this LED for extra low power operation
- USB interface powered only when a USB cable is attached.
- External antenna replaced with board-mounted antenna. Antenna is the small black block next to the microcontroller.
- Optional MMCX jack for external antenna
- Reset button relocated to side of the board in order to make it accessible with a shield installed
- Footprint & load capacitors for a 10 pF 32.768 KHz watch crystal. This enables the internal real time clock and associated sleep modes.
Your kit should contain the following items:
|1||Zigduino r2 PCB|
|1||1x10 female pin header (digital pins)|
|2||1x8 female pin headers (power & digital pins)|
|1||1x6 female pin header (analog pins)|
|1||1x3 female pin header (SPI connector)|
|1||1x2 female pin header (UART0 connector|
|1||2x3 0.1" male pin header (ICSP connector)|
|1||2x7 2mm male pin header (AUX connector)|
Assembling the Board
The Zigduino r2 is shipped with its through-hole connectors loose. The solder jumpers used to configure the board are likewise unsoldered. In order to use all of the functions of the board, you need to solder on the connectors and select the functions of the pins controlled by the solder jumpers. You will need a soldering iron, a supply of flux, and a supply of flux core solder intended for electronics use.
Next, solder the standard Arduino headers to the board. A shield is often useful for lining up the headers and keeping them straight while you solder them in. If you wish to install the AUX, UART0, ICSP, or SPI headers, insert them into the board and solder them down. Turning the board and laying it on the bench such that the bench holds the headers in to the board makes it easier to solder these connectors on. The AUX connector is too short for this trick, so hold it in from one end while soldering the first pin on the other end.
Configuring the Board
There is one solder jumpers on the back of the board. This jumpers is provided to maintain compatibility with existing shields. It selects the option for connection to digital pin 11. Neither option is selected on the board as shipped. In order to make one of the two connections, follow these steps:
- Apply a generous coating of flux over the jumper
- Lay your soldering iron over the two contacts you wish to join.
- Feed solder into the joint until you have a good puddle of solder wetted to both contacts.
- Slowly and carefully slide your iron out of the puddle sideways, leaving a solder jumper across two of the three contacts.
Digital pin 11 may be selected to be either an analog/PWM output or the MOSI line of the SPI bus. When configured as an SPI pin, it is referenced as pin 20. MOSI is always available on the SPI connector.
Installing the Environment
In order to use the Zigduino with the Arduino environment, you must perform the following steps:
- Upgrade your avr-gcc to version 4.3.3 or later and avr-libc to 1.6.7 or later. On Windows, you can do this by unzipping WinAVR-201001011 or later over the contents of your arduino-*/hardware/tools/avr directory. On OS X, upgrade to the most recent version of Crosspack. On Linux, update your installation of avr-gcc and avr-libc.
- Install the FTDI drivers.
- Download the Zigduino environment from Github.
- Copy the arduino/cores/zigduino directory from the download into your arduino-*/hardware/arduino/cores directory.
- Append the contents of zigduino-board.txt to your arduino-*/hardware/arduino/boards.txt file.
After you have completed these steps, you should have a ‘Zigduino r1’ and 'Zigduino r2' entries in your Tools > Boards pull-down. Choose the appropriate option for the board you wish to program.
Fetching and Installing RF Libraries
You currently have four different options for RF connectivity on the Zigduino:
IEEE 802.15.4 MAC
This is the only source-available library provided by Atmel, and therefore is the only one that can be compiled directly from the Arduino environment. It is designed to abstract the hardware of the
different supported Atmel platforms.
In order to install the MAC library, first download it from Atmel. Make sure you retrieve version 2.6.1 if you intend to use it with ZMAC. Use the provided installer to install it on your system. Then unpack the contents of MAC_v_2_4_2 into the directory generated by this installer; this places the appropriate Zigduino-specific header and configuration files in the tree.
Follow the package installation instructions. You will have to download and install gawk if it is not already present on your system.
BitCloud — ZigBee PRO
This library allows the Zigduino to interoperate with other ZigBee devices and networks. It is available only in a pre-compiled form. Therefore, you will need to use WinAVR, AVR Studio, or some related compiler in order to use it; it will not work with the standard Arduino IDE.5 Download the version for the megaRF zip file from Atmel, unpack it, and follow the instructions in the quick start guide.
You will need the BitCloud board configuration file as well.
Follow the instructions on the contiki-avr-zigduino wiki.
Download the ZigduinoRadio tarball from the ZigduinoRadio page. Unpack the tarball into your arduino-*/libraries directory. When you next (re)start Arduino environment, it will be available in the libraries and examples drop-down menus.
The layout of the Zigduino follows that of the stock Arduino Uno R3, particularly with respect to the location of the standard headers. This is to provide maximum compatibility with the existing array of shields on the market. The only significant difference among these connectors is that the Zigduino uses a mini USB instead of the standard USB connector on a standard Arduino.
There are three additional connectors as well:
- SPI – This connector carries the three pins of the SPI bus, MOSI, MISO, and SCK. While the MOSI pin on the ordinary digital connector (pin 11) may be configured to be a PWM output instead, the one on the SPI connector is always MOSI. See the Configuration section for more information. These pins are protected against excessive voltage.
- UART0 – This is allows you to tap into the serial connection between the USB interface and the Atmega128RFA1. It is connected to the UART0 port.
- AUX – This connector carries the additional I/O available on the Atmega128RFA1. Several of these pins have special functions.
Each of the 16 digital pins of the Zigduino r2 corresponding to the standard Arduino layout can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead(). Each pin operates at 3.3V and can source or sink 10 mA. Each also has an internal pullup, which is disabled by default. Each pin is protected against ±30V transients and can tolerate continuous 5V input.
Care must be taken not to exceed the power ratings of the 100 ohm protection resistors, which is 62.5 mW per element. This limits the continuous voltage that the pins can tolerate to between -2.5V and +5.8V.
There are 14 more pins available on the AUX connector, which have all of the same basic functions but have no protection against excessive voltage or current beyond what the Atmega128RFA1 can handle.
The standard digital pins include the following additional functions:
- Serial: 0 (RX) and 1 (TX) — Used to transmit and receive TTL serial data. They are attached to UART1 and, unlike traditional Arduinos, they are not connected to the USB interface.
- PWM: 3, 5, 6, 9, 10, and 11 — Provides 8-bit PWM output with the analogWrite() function. Pin 11 must be selected for PWM operation with the solder jumper on the back of the board.
- SPI: 11 (MOSI), 12 (MISO), 13 (SCK) — These pins support SPI communications using the SPI library. Pin 11 must be selected for SPI operation with the solder jumper on the back, or SPI must be accessed with the SPI connector.
- LED: 13 — This is the built-in LED on digital pin 13. When the pin is high, the LED is on.
- External Interrupts: 2, 3, 6, and 7 — These pins can be configured to trigger and interrupt on a low value, high value, or an edge. See the attachInterrupt() function for details. The two I2C pins can also be used as interrupts.
- I2C — The I2C pins are located on the left hand side of the 10-pin digital connector. This, as of the Uno R3, is the standard location for the I2C pins on all Arduino compatible boards.
The six analog input pins, labeled A0 - A5, are likewise protected against ±30V spikes and can tolerate continuous 5V input. Each provides 10 bits of resolution and measures 0 - 1.8V. It is possible to change to a lower top voltage through use of the AREF pin and the analogReference() function.
Additionally, there are two additional analog pins on the AUX header. As for all other pins on the AUX connectorA6 is on pin 11 of the AUX header. In addition, it is connected to the positive battery terminal via a resistor divider (R10 & R11) that divides the battery voltage by 2.2. This allows you to measure the full range of the battery voltage within the 1.8V range of the ADC. A7 is on pin 13 of the AUX header.
The AUX connector carries all of the I/O channels that are not brought out to other pins. The upper left pin of the connector is pin 1, and the pad for it is square rather than round. The pin map is as follows:
|Function||Digital #||AUX pin||AUX pin||Digital #||Function|
The special functions of these pins are as follows:
- RFRX & RFTX — These are the RF transmit & receive LEDs. They are typically driven by the particular radio library you are using, but they can be used as digital pins 24 and 25 instead.
- TOSC1 & TOSC2 — These two pins are connected to a footprint for the installation of a 32.768 kHz crystal. Installation of this crystal provides an alternate clock source for Timer/Counter 0 which can run during low power sleep modes. 22 pF load capacitors (appropriate for a 10 pF crystal) come installed, so all you need to do is acquire and install the crystal. More details can be found in the documentation for Timer/Counter 0, which starts on page 92 of the Atmega128RFA1 datasheet.
- A6/BATMON — This analog pin is connected to the battery input through a voltage divider that divides the voltage by 2.2. This allows the 1.8V range of the internal ADC to cover the complete range of the battery. If you want to use this as regular I/O pin, you need to remove R10 & R11.
Power & Ground
The Zigduino can be powered through the USB connection, with an external power supply, or through the battery. The power source with the highest voltage is selected automatically.
External power can be supplied via a wall wart or a battery. It can be connected with a 2.1mm center-positive plug inserted into the power jack. Alternately, external power can be connected through the GND and VIN pins of the POWER header.
A 1S LiPo battery with a JST connector can be plugged into the battery connector on the left edge of the board. When a battery is plugged in at the same time that USB or other external power is applied, the Zigduino will charge the battery.
The board will operate correctly on an input voltage between 6V and 30V. It will survive transients as large as -20V or +60V. However, higher supply voltages may cause excessive heat dissipation at higher current draws. The input voltage regulator has integral overtemperature protection, so you can't permanently damage the board this way. However, the board may not work correctly under these circumstances.
The power pins are as follows:
- VIN — The input voltage to the Arduino board when it is running from external power, i.e. not USB bus power.
- 5V — The regulated 5V used to power 5V components on the board and external 5V shields. It comes either from the USB or from the VIN via the 5V regulator. Maximum current draw is 250 mA. When the Zigduino is running off battery power, this will be at battery voltage.
- 3V3 — The regulated 3.3V supply that powers the microcontroller. It is derived from the 5V bus via a second regulator. Maximum current draw is 200 mA.
- IOREF — This provides a logic reference voltage for shields that use it. It is connected to the 3.3V bus.
- GND — Ground pins.
There are two distinct groups of wireless-related components on the board. The first group, consisting of the blocking capacitors, the balun, and the antenna, is located just below the Atmega128RFA1.
The second group is the wireless link lights and their resistors, located above and to the left of the ICSP connector. There are two of them, RFRX and RFTX. These two LEDs are controlled by digital pins 23 and 24, respectively. The Atmel MAC configuration files we provide map these LEDs appropriately.
The ICSP programming connector is located in the standard place for an Arduino board. This provides compatibility with certain shields that use it to access the SPI bus.
There is one solder jumper on the back of the board. This jumpers is provided to maintain pin compatibility with existing shields. It selects the connections to digital pin 11, and allows you to select between connecting it to digital pin 11 or to the MOSI line of the SPI bus.
All of the pins, and the two status LEDs, are all accessible as digital pins. Here is how they are arranged:
|Pin Name||Digital #||Alternate||Function||Location|
|0||0||UART1 Serial Receive||DIGITAL0|
|1||1||UART1 Serial Transmit||DIGITAL0|
|3||3||PWM, Interrupt 1||DIGITAL0|
|6||6||PWM, Interrupt 2||DIGITAL0|
unconnected by default
|PWM, SPI MOSI, or not connected
depending on jumper configuration
|SCK||12||SPI MISO||SPI connector|
|MISO||13||SPI SCK||SPI connector|
|MOSI||20||SPI MOSI||SPI connector|
|SDA||21||I2C SDA/Interrupt 5||DIGITAL1|
|SCL||22||I2C SCL/Interrupt 6||DIGITAL1|
|RFTX||23||Transmit status light for the radio||AUX|
|RFRX||24||Receive status light for the radio||AUX|
|TOSC2||29||Timer/Counter Oscillator Crystal||AUX|
|TOSC1||30||Timer/Counter Oscillator Crystal||AUX|
|A6/BATMON||35||Analog 6/Battery Monitory||AUX|
|USART0_RX||36||UART0 Serial Receive||UART0|
|USART0_TX||37||UART0 Serial Transmit||UART0|
The Arduino Environment
The current Zigduino environment is based on the arduino-0021 environment. It will be updated to Arduino 1.0 shortly after that baseline is released. In order to use the Zigduino with the standard Arduino environment, you must upgrade to a version of avr-gcc and avr-libc that support the Atmega128RFA1 chip. You must also add the Zigduino to your boards.txt file and the zigduino/ core files directory to your hardware/cores/ directory.
- Back up your arduino installation
- Download the Windows zipball
- Unzip the archive in your Arduino-1.0/hardware directory.
- Restart the Arduino IDE. There will be new entries for the Zigduino r1 and Zigduino r2 in the Tools>Boards drop-down
Mac OS X
Courtesy John Duksta (modified for Zigduino-1.0)
- Download the following:
- Arduino 1.0 from http://arduino.cc/en/Main/Software
- CrossPack-AVR-20100115.dmg from http://www.obdev.at/products/crosspack/download.html
- Zigduino Core from http://github.com/logos-electromechanical/Zigduino-1.0
- # Install the FTDI drivers.
- Install Arduino-1.0 (to /Applications/Arduino)
- Install Crosspack (It installs to /usr/local/CrossPack-AVR)
- Replace Arduino's build tools with Crosspack's
- cd /Applications/Arduino.app/Contents/Resources/Java/hardware/tools
- mv avr avr.Arduino-Dist
- ln -s /usr/local/CrossPack-AVR avr
- Default location for your Arduino user dir is ~/Documents/Arduino; place hardware support files there. These instructions are written in an attempt to not crush any other custom boards your developing for:
- mkdir -p ~/Documents/Arduino/hardware/arduino/cores
- mkdir -p ~/Documents/Arduino/hardware/arduino/bootloaders
- cd $ZIGDUINO_DIST_DIR (i.e. where you unzipped or git cloned the Zigduino core)
- mv arduino/cores/zigduino ~/Documents/Arduino/hardware/arduino/cores/
- mv arduino/variants/zigduino_r1 ~/Documents/Arduino/hardware/arduino/variants/
- mv arduino/variants/zigduino_r2 ~/Documents/Arduino/hardware/arduino/variants/
- mv arduino/bootloaders/atmega/ ~/Documents/Arduino/hardware/arduino/bootloaders/
- cat arduino/boards.txt » ~/Documents/Arduino/hardware/arduino/boards.txt
#Zigduino core may have compilation errors when running the example code, so comment out the PROGMEM in the code and prog_ to fix this.
For Linux, you don't need to unpack the tools/avr6 directory of the Zigduino Core. You will need to install avr-gcc-4.3.2 or later and avr-libc-1.6.7 or later in order to compile for the Atmega128RFA1. This should not negatively impact compilation for other chips.
The Arduino libraries are based on the core libraries, and therefore most of them should work correctly. However, they have not been completely tested with the Zigduino and therefore are not guaranteed to work.
Powering the Zigduino
There are four ways to power the Zigduino – through the DC power jack, through the USB port, or through the VIN/GND pins. The DC power jack accepts a 2.1mm barrel connector with the outer conductor grounded and the center pin attached to power. The board automatically draws its power from the highest voltage available source.
The digital pins on the Zigduino are set up to act as similarly to those on the stock Zigduino. Since the Atmega128RFA1 is a 3.3V part, these pins cannot supply the same voltage or current as the Atmega328 of the stock 5V Duemilanove or the Uno. Each digital pin is protected by a 100Ω resistor and a pair of diodes wired in series between the pin and the power rail. This limits the maximum output current to 33 mA or less. However, the pin can absorb transient spikes are large as ±30V, or between -2.5V and +5.8V continuous.
Only those pins corresponding to the pins of the Arduino Uno R3 are so protected; the pins on the AUX and UART0 connectors are NOT protected.
While most modern 5V logic will correctly interpret a 3.3V voltage as a logical true, this is NOT true of all logic, in particular CMOS of the C, AC, HC, and AHC series.7 If this is a problem, it may manifest in unpredictable and strange ways, because the response to a 3.3V input may be undefined. When in doubt, check the datasheets of the parts used in the particular shield in question.
The analog pins of the Zigduino located in the regular layout may be used as digital pins, and have the same protection described above. However, in analog mode, they can only measure voltages from 0-1.8V, or a little more than a third of the range measured by more conventional 3.3V Arduino boards. This is a hardware limitation and cannot be modified by supplying a higher voltage to the AREF pin.
A6 is located on the AUX connector (AUX pin 13) and is wired to the battery voltage in order to provide battery monitoring. It is connected through a 2.2:1 voltage divider consisting of R10 and R11. If you want to use this pin for other purposes, you need to remove R10 and R11. This pin is not protected.
A7 is also located on the AUX connector (AUX pin 11) and is open for use. It is not protected.
Wired communications on the Zigduino work much like they do on the standard Arduinos.
The Zigduino has two UARTs exposed. UART0 is connected to the USB interface, and its receive and transmit pins are exposed on the UART0 connector. Digital pins 0 and 1 are connected to UART1. In order to use either, you use the Serial library, described in the Arduino reference library at http://arduino.cc/en/Reference/Serial.
The SPI bus is brought out three different places:
- Through the ISP programming connector, as is typical for all Arduinos.
- Through the dedicated SPI connector set alongside the left hand bank of digital pins.
- Through digital pins 11, 12, and 13, if the jumpers are set correctly.
Note that the hardware CS pin is not brought out in the ZIgduino. This should only require a small amount of extra housekeeping, since a CS line must be chosen and operated from user code. This is expected to be rolled into future versions of the SPI library, and will not require further user attention. In order to use the SPI library, see the documentation for the SPI library at
The I2C bus, also known as Two Wire (TWI) or simply Wire, is a popular interface for networking Arduinos and a variety of commercial sensors and other peripheral chips together. Its SDA & SCL pins are located in the new Arduino Uno R3 permanent location, which is next to AREF on the 10 pin digital connector on the top left of the board. it can be accessed with the Arduino Wire library, http://arduino.cc/en/Reference/Wire.
This is the known problems with various revisions of the Zigduino r2 board. As of this writing (3 Feb 2012), only a single spin of Zigduino r2 boards has been made,
|Battery charging light illuminated when no battery is connected.||The battery monitor voltage divider passes enough current to spoof the charger.||Remove voltage divider (R10, R11)||Increase voltage divider total resistance to remove spoofing.||Spin 2|
|Programming through the ICSP does not work.||The ICSP reset pin is connected to the output rather than the input of U6, which overwhelms the reset signal.||Cut the jumper to the ICSP reset pin and attach a wire from that pin to the reset pin on the POWER connector||Same as workaround||Spin 2|
|Board LEDs are dim||Excessively high current setting resistors||None||Decrease resistance||Spin 2|
|Board draws an excess ~150 uA in deep sleep while on battery||The battery monitor voltage divider passes too much current.||Remove voltage divider (R10, R11) or replace with higher values. For example, 100K and 120K rather than 10K & 12K.||Increase total resistance to lower current.||Spin 2|
|USB activity lights are constantly on at low power||Improper LED orientation||None||Correct LED orientation||Spin 2|