Zigduino r1 Manual

The Zigduino r1 has been superseded by the Zigduino r2. This page remains for users of the r1 boards.

Introduction

The Zigduino 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 a reverse polarity SMA connector (RP-SMA) for an external antenna. This allows the user to use nearly any existing 2.4 GHz antenna with it. The Zigduino runs on 3.3V, but all 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 kit for experimenters, 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.

piercenichols-zigduinor1--1356433940-O.jpg?__SQUARESPACE_CACHEVERSION=1309316098247
Microcontroller Atmega128RFA1
Operating Voltage 3.3V
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
SRAM 16 KB
EEPROM 4 KB
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

Quick Start

Kit Contents

Your kit should contain the following items:

Quantity Item
1 Zigduino PCB
2 1x8 female pin headers (digital pins)
2 1x6 female pin headers (power & analog pins)
1 1x3 female pin header (SPI connector)
1 1x2 female pin header (I2C/Wire connector
1 2.1mm barrel jack (DC power connector
1 RP-SMA PCB edge connector

Assembling the Board

The Zigduino is shipped without its through-hole connectors or the RP-SMA connector soldered on. None of the three solder jumpers used to configure the board are completed either. 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 fluxcore solder intended for electronics use.

It is easiest to start by soldering on the RF connector. This connector needs to be soldered on to the edge of the board. If you hold the board such that the USB connector is on the left, the RF connector pads are on the right hand side of the board, aligned with the lower edge of the main processor. There are three pads on the front side of the board and two on the back. The connector should slip easily over the edge of the board, with three fingers on top and two on the bottom. Follow these steps to install it:

  1. Apply a generous coat of flux to the pads on both sides of the PCB and the connector fingers.
  2. Slide the connector into place and align it with its pads.
  3. Heat one of the connector fingers and its adjoining pad until the solder flows over both. Add enough solder to make a complete joint.
  4. Repeat step 3 for the rest of the connector fingers, making sure to get all five fingers.
  5. Inspect the connector to make sure there are no shorts between the center finger on the top side and the ground pads or other fingers. Use a continuity meter to confirm that there are no shorts.

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 I2C, 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. Lastly, solder on the power connector. You’ll need to hold it in with a finger or clamp while you solder on the first pin.

Configuring the Board

There are three solder jumpers on the back of the board. These jumpers are provided to maintain pin compatibility with all existing shields. They select the connections to digital pin 11 and to analog pins 4 and 5. Neither option is selected on the board as shipped. In order to make one of the two connections, follow these steps:

  1. Apply a generous coating of flux over the jumper
  2. Lay your soldering iron over the two contacts you wish to join.
  3. Feed solder into the joint until you have a good puddle of solder wetted to both contacts.
  4. 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.

Analog pin 4 may be selected to be either an analog input or the SDA line of the I2C (Wire) bus. When configured as SDA, it is referenced as pin 21. The SDA line is always available in the I2C connector.

Analog pin 5 may be selected to be either an analog input or the SCL line of the I2C (Wire) bus. When configured as SCL, it is references as pin 22. The SCL line is always available in the I2C connector.

Installing the Environment

In order to use the Zigduino with the Arduino environment, you must perform the following steps:

  1. 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.
  2. Download the Zigduino environment from Github.
  3. Copy the arduino/cores/zigduino directory from the download into your arduino-*/hardware/arduino/cores directory.
  4. 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’ entry in your Tools > Boards pull-down. Switch to this option to compile your sketches for the Zigduino.

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.

ZMAC

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.

contiki-avr-zigduino

Follow the instructions on the contiki-avr-zigduino wiki.

ZigduinoRadio

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.

Hardware Overview

zig-v5-top.png

Board Layout

The layout of the Zigduino follows that of the stock Arduino, 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.
  • RF – This is the antenna connector for the integrated 802.15.4 radio transceiver.
  • I2C – This connector carries the two pins of the I2C bus (accessed through the Wire library), SDA and SCL. Analog pins 4 and 5 may also be configured to carry these pins as well, but this connector always has them. See the Configuration section for more information.

Digital Pins

Each of the 14 digital pins of the Zigduino 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.

The digital pins include the following additional functions:

  • Serial: 0 (RX) and 1 (TX) — Used to transmit and receive TTL serial data. These pins are connected to the corresponding pins on the FTDI USB interface chip.
  • 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.

Analog Pins

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.

There are two jumper-selectable special function pins in the analog section:

  • I2C: A4 (SDA) and A5 (SCL) — These pins support I2C communications using the Wire library. They must be selected for I2C operation with the jumpers on the back or I2C must be accessed through the I2C connector. They can also be configured as interrupts.

Power & Ground

The Zigduino can be powered through the USB connection or with an external power supply. 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.

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.
  • 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.
  • GND — Ground pins.

Wireless

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 connector, is located just below the ICSP connector.

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.

ICSP

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.

Configuration

There are three solder jumpers on the back of the board. These jumpers are provided to maintain pin compatibility with all existing shields. They select the connections to digital pin 11 and to analog pins 4 and 5. All jumpers are open as shipped. Each is located as close as practicable to the pin they control.

Pin Arrangement

All of the pins, and the two status LEDs, are all accessible as digital pins. Here is how they are arranged:

Pin Name Digital Equivalent Alternate Function
0 0 Serial Receive
1 1 Serial Transmit
2 2 Interrupt 0
3 3 PWM, Interrupt 1
4 4 PWM
5 5
6 6 PWM, Interrupt 2
7 7 Interrupt 3
8 8 PWM
9 9 PWM
10 10 PWM
11 11/20 SPI MOSI, defaults to unconnected PWM, SPI MOSI, or not connected, depending on jumper configuration
12 12 SPI MISO
13 13 SPI SCK
A0 14 Analog 0
A1 15 Analog 1
A2 16 Analog 3
A3 17 Analog 4
A4 16/21 I2C SDA, defaults to unconnected Analog 3, I2C SDA/Interrupt 5, or not connected, depending on jumper configuration
A5 17/22 I2C SCL, defaults to unconnected Analog 4, I2C SCL/Interrupt 6, or not connected, depending on jumper configuration
SCK 12 SPI MISO
MISO 13 SPI SCK
MOSI 20 SPI MOSI
SDA 21 I2C SDA/Interrupt 5
SCL 22 I2C SCL/Interrupt 6
RFTX 23 Transmit status light for the radio
RFRX 24 Receive status light for the radio

Software Overview

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.

Windows

  1. Back up your arduino installation
  2. Download the zipball from http://www.github.com/logoselectromechanical/Zigduino-1.0/master/zipball.
  3. Unzip the archive in your arduino-00**/hardware directory.
  4. Restart the Arduino IDE. There will be a new entry for the Zigduino in the Tools>Boards drop-down

Mac OS X

Courtesy John Duksta

  1. Download the following:
  2. Install Arduino 0022 (to /Applications/Arduino)
  3. Install Crosspack (It installs to /usr/local/CrossPack-AVR)
  4. 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
  5. 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/cores/atmega/
    • /Documents/Arduino/hardware/arduino/bootloaders/
    • cat arduino/boards.txt » ~/Documents/Arduino/hardware/arduino/boards.txt

Linux

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.

Arduino Libraries

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 at this time.

Zigduino Usage

Powering the Zigduino

There are three 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.

Digital Pins

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.

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.

Analog Pins

The analog pins of the Zigduino 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.

Usage of the A4 and A5 analog inputs requires configuration of the solder jumpers on the back of the board, as discussed above

Wired Communication

Wired communications on the Zigduino work much like they do on the standard Arduinos.

USB/Serial

The Zigduino has a single UART exposed, which is connected to digital pins 0 and 1. These pins are connected to the corresponding pins on the FTDI serial interface. In order to use them, you use the Serial library, described in the Arduino reference library at http://arduino.cc/en/Reference/Serial.

SPI

The SPI bus is brought out three different places:

  1. Through the ISP programming connector, as is typical for all Arduinos.
  2. Through the dedicated SPI connector set alongside the left hand bank of digital pins.
  3. 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
http://arduino.cc/en/Reference/SPI.

I2C (Wire)

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. It is located on the permanent I2C connector, and can be taken through the A4 and A5 pins (as it is on other non-Mega Arduinos) by making the two jumpers on the back of the board, under the I2C connector. Wherever it is brought through, it can be accessed with the Arduino Wire library, http://arduino.cc/en/Reference/Wire.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License