2017년 2월 17일 금요일

Zigbee Networking with XBee Series 2 and Seeed's Products



Zigbee Networking with XBee Series 2 and Seeed's Products

Introduction

  1. This step-by-step tutorial is created to help users learn to use XBee ZB modules with Seeeduino / Arduino, XBee® ShieldUartSBeeGrove - XBee CarrierSeeeduino Stalker v2.0. These products makes life easier for working with XBee ZB modules.
  2. XBee ZB modules can be used in many different ways. They also provide lots of configuration parameters. In this tutorial, we have tried to showcase the essential configurations in simple steps.
  3. Please read through the complete tutorial at-least once, before deciding which configuration to use for your application.
  4. This tutorial makes use of XBee Series 2 modules and does not use the old Series 1 modules. We sell Series 2 modules in our Bazaar.

Zigbee Modules and Network

Zigbee is a standard for low-power, short range wireless devices based on an IEEE 802 standard for personal area networks(PAN). Zigbee modules work in unlicensed ISM(Industrial Scientific Medical) band. Zigbee devices are capable of peer-to-peer, point-to-multipoint and mesh communication. They offer convenient low power wireless solutions for embedded systems where power consumption is a critical factor. A Zigbee network consist of three different types of ZigBee devices: coordinatorrouterend-device. Each network has a 16bit PAN ID. All devices in a Zigbee network is assigned a single PAN ID.

Device Types

  • ZigBee coordinator (ZC): The most capable device, the coordinator forms the root of the network tree and might bridge to other networks. There must be one ZigBee coordinator in each network since it is the device that starts the network originally. The coordinator initiates a Personal Area Network(PAN) by selecting a RF channel and PAN ID. ZC also allows routers and end-devices to join the PAN. It is able to store information about the network, including acting as the Trust Center & repository for security keys.
  • ZigBee Router (ZR): As well as running an application function, a router can act as an intermediate router, passing on data from other devices. A router can start operation only when it has establishes connection with ZC
  • ZigBee End Device (ZED): Contains just enough functionality to talk to the parent node (either the coordinator or a router); it cannot relay data from other devices. This relationship allows the node to be asleep a significant amount of the time thereby giving long battery life. A ZED must join PAN like a router before sending any senor data. A ZED requires the least amount of memory, and therefore can be less expensive to manufacture than a ZR or ZC.

Device Addressing

  • When a device connects to a Zigbee network it gets a 16-bit Network address.
  • Each device(node) has a 64-Bit Device address. In XBee ZB modules, this 64-bit address is a unique permanent number assigned by the manufacturer. This is also the serial number of the device.
Any data sent from one Zigbee device to another is sent by specifying the 16-bit Network Address and the 64-bit Device Address.

Getting Zigbee modules

Seeedstudio Bazaar currently sells two types of Zigbee modules from digi :
XBee® RF Modules ZNet 2.5 RF Module modules are Series 2 hardware which comes with ZNet 2.5 firmware.
In this tutorial we are going to use XBee ZB firmware on a XBee Znet 2.5 ModuleXBee ZNet 2.5 Module modules can be upgraded to XBee ZB firmware by following the procedure listed at Converting a XBee/XBee-PRO ZNet 2.5 Module to a ZB Module. This procedure is also illustrated in the next section.

XBee ZB Hardware and Pin Layout

  • XBee ZB module is available with a chip antenna.
  • Pins of XBee ZB module are shown below.

Upgrading XBee firmware with UartSBee or Grove - XBee Carrier

The XBee modules have to be configured with a 3.3V logic UART. Both UartSBee and Grove - XBee Carrier comes with FT232RL based USB to Serial Port and a XBee compatible socket.

Installing drivers for USB-to-Serial Port

Windows

  • In Windows OS, the first time you plug in the device (UartSBee or Grove -XBee Carrier), you might be asked for the driver.
Download and install the Virtual COM port driver from FTDI website :
  • A wizard opens for installing the driver. Choose “Install from a list or specific location”
  • Choose the downloaded driver path
  • If you have downloaded unsigned driver, the following Window appears. Just click “Continue Anyway”
  • UartSBee driver is successfully installed. Windows assigns a COM port name to FT232RL like COM10COM11 etc… Please check the exact name in Device Manager. In this case “COM16” is assigned for UartSBee
GNU/Linux
All modern GNU/Linux OS comes with FT232RL drivers. To check if UartSBee or Grove -XBee Carrier is detected, Issue a lsusb command. An output similar to below should appear.
GNU/Linux assigns /dev/ttyUSB0/dev/ttyUSB1 etc… as device name.

Using Digi’s X-CTU (XCTU) Software

X-CTU is XBee Configuration and Test Utility. It is primarily used for configuring XBee Modules from Digi and also to upgrade the onboard MCU firmware. It comes with a Serial-Terminal to interact with XBee modem using AT commands. X-CTU is a Windows application. But, it is known to work under GNU/Linux using Wine .
  • Download X-CTU from Digi’s X-CTU Page
  • Install X-CTU.
  • Open X-CTU –> PC Settings Tab.
  • Select USB Serial Port (which is connected to UartSBee / Grove - XBee Carrier).
  • Click Test / Query Button
  • A dialog box shows the Modem TypeModem firmware Version and Serial Number.
  • In this case, XBee ZNet 2.5 modem is displayed as XB24-B. This has to be upgraded to XB24-ZB firmware.
  • Open Modem Configuration Tab.
  • Click Download New Versions button.
  • This opens the following dialog box :
  • Click Web button. This downloads all devices firmware from digi’s server.
  • Once, latest firmwares are downloaded an update summary is displayed. This indicates that update happened without any issue. If you do not get this dialog box, repeat the above steps.
  • Open Modem Configuration Tab.
  • Click Modem Parameters and Firmware –> Read button.
  • XBee ZNet 2.5 firmware XB24-B is detected and all its configured parameters are shown.
  • It also shows the firmware Function Set as ZIGBEE ROUTER/END DEVICE AT and version as 1220.
  • Function Set decides which firmware is already programmed / to be programmed to XBee Module. Series 2 devices can be used in many different modes(ZC or ZR, ZED). We have to choose the appropriate firmware function set.
  • Now, Update the firmware to XB24-ZB. (Please note, we are not using XB24-B firmware, we are using a different firmware set compatible with XBee ZNet 2.5 Module Hardware)
  • Select Modem:XBEE as XB24-ZB
  • Select Function Set as ZIGBEE COORDINATOR AT.
    • Note: ZIGBEE COORDINATOR AT is one function set that we will use in the next section. You can choose any function set which is suitable for you application.
  • Select the latest version of firmware. At the time of writing this guide, it is 208C
  • Click Write button. This permanently writes the firmware to XBee module.

Wireless UART demo using XBee ZB modules and PC

This demo configures two XBee modules to connect to each other automatically upon power-up and continuously trans-receive data. This setup can be used as a Wireless UART to connect any two PCs or two MCUs with serial ports.
  • Use two UartSBee or two Grove - XBee Carrier with two XBee ZB modules.
  • Connect these modules to PCs Serial port and make sure the drivers are installed.
  • Open X-CTU, select the USB-Serial Ports of the device as shown below :
  • Program one module with COORDINATOR AT function-set firmware and another module with ROUTER AT function-set firmware. Always use the latest version of firmware. See the above section on how-to program firmware.
  • Now, Open Modem Configuration Tab and configure the destination addresses of both the modules as follows:
    • Set the destination address high of COORDINATOR to serial number high of ROUTER.
      • Set the destination address low of COORDINATOR to serial number low of ROUTER.
      • Set the destination address high of ROUTER to serial number high of COORDINATOR.
        • Set the destination address low of ROUTER to serial number low of COORDINATOR.
      • Write these parameters to the modules.
  • PAN ID was not modified during parameters configuration. It was left to 0, as there is only one Zigbee network in the vicinity. You might want to change these PAN IDs (of both the modules) to a 16bit number.
  • Open the Terminal Tabs for both the modules and click the Show Hex buttons.
  • Type a message in COORDINATOR terminal and it will be sent to ROUTER via wireless. Similarly, any text typed in ROUTER terminal is sent to COORDINATOR terminal.

Wireless UART demo using XBee ZB modules and Arduinos

Wireless Sensor Networks(WSN) demo with XBee ZB modules

Configuring a standalone sensor nodes using XBee ZB module and Grove - XBee Carrier

Configuring a Zigbee Coordinator using XBee ZB module, Seeeduino and XBee® Shield

Using Seeeduino as Internet Gateway using XBee ZB module,Wifi Bee and Bees Shield

References

If you want to make some awesome projects by XBee, here’s some projects for reference.

Hummingbird

This is an interesting demo made by XBee and Grove.
This project uses a zigbee mesh and GPRS SIM900 card to communicate to a server. The server conducts an analysis on the data and provides the user with real time information as well as forecasting.

Hot Water Solar Boiler Project

This is an IoT demo made by XBee and Grove.
A solar boiler is great because it gives you hot water using free-sun-energy, but what if there is not enough sun or someone already used all the hot water ? This project helps you take the right decision. It warns you when you run out of hot water and allows you to turn on the electric heating. It also let you know when you can take a bath or shower !

Share Your Awesome Projects with Us

Born with the spirit of making and sharing, that is what we believe makes a maker.
And only because of this , the open source community can be as prosperous as it is today.
It does not matter what you are and what you have made, hacker, maker, artist and engineers,
as long as you start sharing your works with others,
you are being part of the open source community and you are making your contributions .
Now share you awesome projects on with us on Recipe, and win a chance to become the Core User of Seeed.
  • Core Users, are those who showing high interests and significant contributions in Seeed products.
  • We cooperate with our Core Users in the development of our new product, this, in another word, the Core Users will have the chance to experience any new products of Seeed before its official launch, and in return we expect valuable feedback from them to help us improving the product performance and user experience. And for most of cases if our Core Users have any good ideas for making things, we’ll offer hardware pieces, PCBA services as well as technical support. Besides, further commercial cooperation with the Core Users is highly possible.
Get more information about Core User please email to: recipe@seeed.cc

Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:
  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.
An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.
Happy hacking

Xadow IO pin mapping



Xadow IO pin mapping

Introduction

Single reference page for all pin information including:-
  • How to use each pin in your Arduino code
  • Xadow FFC to Atmega32u4 pin mapping
  • pins that have interrupts and timers
  • the 2 serial ports, IIc and ISP
  • additional on board IO, that might be hacked
The tables provide different views of the data and are especially useful when you are planning which modules to use and which IO pins for direct use!

Xadow FFC IO bus and matching Arduino and Atmega information and example Arduino code.

**Xadow FFC pins****Arduino****Atmega32u4 pins**
**Name****IO function****Alternate use****#****IO Pin****code example(s)****Name (**interrupts in red**)****#****Notes**
P1Digital PinISP SCK1**15**PinMode(15, OUTPUT); digitalWrite(15, HIGH);PB1**(PCINT1**/SCLK)9ISP SMD header pads also on rear of Xado Main board
P2Digital PinISP MOSI2**16**PinMode(16, OUTPUT); digitalWrite(16, HIGH);PB2(PDI/**PCINT2**/MOSI)10
P3Digital PinISP MISO3**14**PinMode(14, OUTPUT); digitalWrite(14, HIGH);PB3(PDO/**PCINT3**/MISO)11
P4Analogue PinDigital pin!4**A5**analogWrite(A5, 128); pinMode(A5, OUTPUT); digitalWrite(A5, HIGH);PF0(ADC0)41Arduino analogue pins can also be used as digital pins!
P5Digital PinIIC SCL9**3**PinMode(3, OUTPUT); digitalWrite(3, HIGH);PD0(OC0B/SCL/**INT0**)18
P6Digital PinIIC SDA10**2**PinMode(2, OUTPUT); digitalWrite(2, HIGH);PD1 (SDA/**INT1**)19
P7Digital PinSerial Rxd11**0**PinMode(0, OUTPUT); digitalWrite(0, HIGH);PD2(RXD/**INT2**)20See Xadow BLE/GPS examples for these serial pin usage info. NOT same serial port uploading code–see Red/Green LED below.
P8Digital PinSerial Txd12**1**PinMode(1, OUTPUT); digitalWrite(1, HIGH);PD3(TXD/**INT3**)21

Some MORE Xadow IO pins - only on the Main module, NOT on the FFC bus!

**Xadow pins****Arduino****Atmega32u4 pins**
**Name****IO function****Alternate use****#****IO Pin****code example(s)****Name (**interrupts in red**)****#****Notes**
Red LEDRx-**17**PinMode(17, OUTPUT); digitalWrite(17, HIGH);PB0(SS/**PCINT0**)8Serial port uploading code
Green LEDTx-**11**PinMode(11, OUTPUT); digitalWrite(11, HIGH);PB7(**PCINT7**/OC0A/OC1C/!RTS)12
Wake-**10**Have not yet connected and validated this!PB^/A10/D1030On board switch – you need super soldering skills to access this!
Note: Reset switch is connected to Atmega32u4 Reset pin 13 via a diode – so no access to the 32u4 IO pin AT THE RESET SWITCH!

The BIG Table of Xadow modules and the IO bus pin use for each module.

Why such a big complicated table? Well it brings together all of the IO information in one place, but more importantly it lets you see which IO pins are still available once you have selected several Xadow modules! Also the schematic has different FFC pin numbers to the rest of the wiki documentation!
Notes:-
  1. Remember that IIC devices are daisy chained – that is they can connect in parallel, so you can have more than one IIC device connected to the same pins!
  2. Need more IO pins? You may be able to use ONE pin for several different uses, the same way the vibration motor and buzzer are sharing one pin, or in some situations you can use the same pin for different purposes at DIFFERENT TIMES. For example you might set a pin as output to trigger an ultrasonic sensor, then change the pin to input to detect when the signal is received!
  3. Most IIC modules {except the Main Board module, LED, RTC}, ALSO have IIC breakout pins.
So items in purple in the IIC SCL & IIC SDA columns do NOT also have breakout pins!
  1. Additional details highlighted in yellow in center of table document the ADDITIONAL** breakout pins on each Xadow module!
  2. ? = Don’t know, or not yet verified!
SCK
MOSI
MISO
A5
3
2
1
0
**Arduino Pin name**
**Interrupts in red-------->**PB1**(PCINT1**/SCLK)PB2(PDI/**PCINT2**/MOSI)PB3(PDO/**PCINT3**/MISO)PF0(ADC0)PD0(OC0B/SCL/INT0)PD1(SDA/**INT1**)PD2(RXD/**INT2**)PD3(TXD/**INT3**)Atmega32u4 pin Name
**IIC = I2C**
910114118192021Atmega32u4 pin#
P1, 1P2, 2P3, 3P4, 4P5, 9P6, 10P7, 11P8,12FFC pin Name, #
**Xadow Modules ****Module Control Mode & Address**
Digital Pin
Digital Pin
Digital Pin
**Analog or **Digital Pin
**IIC SCL**
**IIC SDA**
**Serial Rxd**
**Serial Txd**
**Xadow Pin function**
3-Axis Accelerometer
IIC 0x53
SCKMOSIMISO
A5
SCL
SDA
RxdTxD
BaroMeter
IIC 0x77
SCKMOSIMISO
A5
SCL
SDA
RxdTxD
BLE Slave
Serial
RX/TX
Plus pads specific to BLE on rear
Breakout
None!
SCKMOSIMISO
A5
SCL
SDA
RxdTxD+ Grove I2C & Serial sockets
LED Controller
IIC 0x04
SCL
SDA
OLED
IIC 0x3C
SCL
SDA
Vibration Motor
Digital Signal
H
H
_**Disconnect module BEFORE using ISP**_
RTC
IIC 0x68
SCL
SDA
rear pad connect INTB – Int0???
Buzzer
Digital Signal
H
?
?
H
?
?
?
?
_**Disconnect module BEFORE using ISP**_
Digital Compass
IIC 0x1E
?
?
?
?
?
?
?
?
Motor
TBD
?
?
?
?
?
?
?
?
GPS
Serial
?
?
?
?
?
?
RX/TX
Storage
IIC 0x50 & 0x51
?
?
?
?
?
?
?
?
**Main Board**
?IIC master =0x00?
ISP – SCKISP MOSIISP MISO
SCL
SDA
All via SMD pads on rear.

Help us make it better

Thank you for choosing Seeed. A couple of months ago we initiated a project to improve our documentation system. What you are looking at now is the first edition of the new documentation system. Comparing to the old one, here is the progresses that we made:
  • Replaced the old documentation system with a new one that was developed from Mkdocs, a more widely used and cooler tool to develop documentation system.
  • Integrated the documentation system with our official website, now you can go to Bazaar and other section like Forum and Community more conveniently.
  • Reviewed and rewrote documents for hundreds of products for the system’s first edition, and will continue migrate documents from old wiki to the new one.
An easy-to-use instruction is as important as the product itself. We are expecting this new system will improve your experience when using Seeed’s products. However since this is the first edition, there are still many things need to improve, if you have any suggestions or findings, you are most welcome to submit the amended version as our contributor or give us suggestions in the survey below, Please don’t forget to leave your email address so that we can reply.
Happy hacking