Zigbee
From charlesreid1
Contents
Background
Two-Station Zigbee Configuration
Zigbee Breakout Board
The first board I was using was a Zigbee breakout board. This had a mini USB plug on it, which allowed me to communicate and control the Zigbee directly from the computer using XCTU (which was provided by Digi Interational, the makers of the Zigbee chip I was using).
In this configuration, there are no "brains" on board the Zigbee that tell it what to transmit, so without the direct connection to a computer, the Zigbee will not talk with anyone. This is our first Zigbee "station."
Zigbee Shield
The next configuration I used was an Arduino Uno with a Zigbee shield. This enables the Arduino to utilize the Zigbee for communication, independently of the computer. Now we have a way of setting up a Zigbee "station" that can transmit messages.
We will set up the Arduino Zigbee as the transmitting station, and the laptop Zigbee as the listening station.
How Zigbee Works
From this page: https://learn.sparkfun.com/tutorials/xbee-shield-hookup-guide
They explained it pretty clearly. What makes Zigbee such a popular format is that it is simple. There is no extensive coding that needs to be done, no IDE, no microcontroller instructions. It is a serial interface. This means you can think of a Zigbee as a very dumb wireless serial terminal.
This page, on using the screen
command in Linux to communicate with serial devices, is handy: www.cyberciti.biz/faq/unix-linux-apple-osx-bsd-screen-set-baud-rate/
On your computer, when you plug in a Zigbee device (e.g., with a mini USB cable like the one pictured above), it will be added as a device in /dev/*
. Using that device file, you can interact with the serial device using the screen command.
How Serial Communication Works
What is serial communication, you wonder? Glad you asked. Serial communication is a way of sending data, one bit at a time, over a single channel. That means it is slow and simple. It used to be called RS-232. Computers used to come with RS-232 serial ports on the back, but now it's more common to have an RS-232 to USB converter, and communicate with the device in a different way.
In terms of actually interfacing with the devices, serial doesn't define much beyond the bit level. Various communication protocols can be implemented over serial, so the way you program or interact with a device depends on the firmware and microchips onboard the device. For example, a printer with a serial cable expects a certain protocol of bits that describe how to print the document. The arrangement of those bits, how they compose the dark and light areas of the page, are entirely up to the manufacturer of the printer.
Likewise with the Zigbee radio - the protocol to interact with a Zigbee radio, and translate human-level concepts like "transmit the message HELLO WORLD" into the bit-by-bit instructions that are communicated over serial, depend on the manufacturer of the radio.
The manufacturer in this case is Digi International, and their technology for interfacing with the radios over a serial connection is to use XCTU, their (presumably proprietary) software. If XCTU uses an open protocol, you can re-implement some of that functionality using a programming language like Python (with the pyserial library) to send similar instructions over the wire.
Wikipedia page: https://en.wikipedia.org/wiki/Serial_communication
Steps
Before You Start
First you have to find the device
To find the device file that shows up when I plug the Zigbee mini USB into the Mac, I'm looking for a device file that's added to /dev/*
when I plug in the Zigbee. Here's how I did that:
Before I plug in the Zigbee, I list all the devices in /dev
. Then, I plug in the Zigbee. Then I list all the devices in /dev/
again. I compare the two lists, and I have my Zigbee.
Bingo: I can see two new devices corresponding to the Zigbee,
/dev/cu.usbserial-A601FA3K /dev/tty.usbserial-A601FA3K
Next you have to find the Baud Rate
From the SparkFun XBee Shield Hookup Guide, it looks like the connection rate to the zigbee is 9600 baud. https://learn.sparkfun.com/tutorials/xbee-shield-hookup-guide
We need to make a 9600 baud serial connection from the Mac to the Zigbee.
First Steps with XCTU
The first thing you'll have to get set up to deal with the Zigbees is the XCTU software, provided by Digi International, the maker of the Zigbee board we are using (Xbee).
The XCTU software provides a nice GUI interface and buttons and widgets and things.
Add the breakout board Zigbee to XCTU
If you have the Zigbee breakout board, as shown below, this circuitboard has a direct USB-to-serial converter onboard, so that you can send and receive serial commands over the serial connection made, via the board, to the Zigbee radio chip.
Start by adding a device, and pick the USB port where the Zigbee is plugged in.
Once the Zigbee breakout board is plugged in via the micro USB cable, you'll be able to communicate with the Zigbee radio device via serial using the XCTU program. That will translate GUI options and text fields into the proper hex code to send over the serial connection.
Again - the details of this program are dependent on the manufacturer. You are dependent on Digi International to provide documentation of their serial schema for interfacing with their chips, or to provide a well-designed program (luckily, XCTU isn't too shabby), or you must reverse engineer the proper inputs.
Edit configuration of breakout board Zigbee
You can edit the configuration of the onboard radio on the Zigbee, which has many, many settings.
These allow you to set, at a high level, functionality like node-to-node communication patterns (star, mesh, or point-to-point networks) and other things.
First, set the PAN ID - a hex number that defines the network all these Zigbees will use to talk to each other.
Next, set the MY ID - that can start at 0 for the first Zigbee, 1 for the second, and so on.
Finally, set the DL (destination low) to the MY ID of the Zigbee you want to talk to. If you've only got two Zigbees, the radio with a MY ID 0 will have a DL of 1, and the radio with MY ID of 1 will have a DL of 0.
Transmitting
When you open the console in the XCTU window (below), anything that you type in will be converted into a serial signal and sent to the Zigbee radio, and that bit will be broadcast by the radio.
Receiving with another Zigbee
If you want to check whether you can receive signals that are being sent by your Zigbee, you can use another mini USB cable to connect to another zigbee and add it to XCTU and check its console tab and see if any characters show up (they should show up as they are received).
Unfortunately, I only had one micro USB cable. Deal with it.
Arduino Zigbee Shield
Next step was to hook up a Zigbee to an Arduino shield, and use the Arduino to send and receive messages via the Zigbee radio.
Before doing this, we need to carefully check the settings of the Zigbee radio and make a note of the identifiers of the network and node for this Zigbee.
Checking Zigbee Settings
For this step, you'll find your radio in the XCTU app by clicking the big plus sign. I had some trouble programming the radio through the Arduino - if that's the case, you can use the USB-to-serial chip to change the radio's settings, rather than reprogramming the radio through the Arduino. This is a good method for programming radios en masse.
Radio 0 will be the Zigbee radio on the USB-to-serial chip.
Radio 1 will be the Zigbee radio on the Arduino shield.
Here are the settings I used to have two radios talking to each other:
Radio 0 settings:
- PAN ID - 3332 (random)
- DH - 0 (leave alone)
- DL - 1 (communicate with radio 1)
- MY - 0 (my id is Radio 0)
Radio 1 settings:
- PAN ID - 3332
- DH - 0
- DL - 0
- MY - 1
Arduino Zigbee Shield Problems
The issue now is that the Arduino is sending output to the Zigbee's radio, and it is being transmitted, and it is received by a second Zigbee, but everything is gibberish.
Next Steps
The next step here to debug this zigbee shield is:
- run a hello world/blink program to verify Arduino is properly receiving instructions
- have already tried TX with arduino shield, RX with mini usb radio breakout board
- now try RX with arduino shield, TX with mini usb radio breakout board
- if still garbled, some problem with how we're modulating or demodulating
Projects
HackRF and Zigbee
Main page: HackRF/Zigbee
As of June 2016, I am working on a project to transmit information with a Zigbee, receive the signal with a HackRF, and demodulate the signal with Gnuradio.
References
tutorial on arduino + zigbee: http://cs.smith.edu/dftwiki/index.php/Tutorial:_Arduino_and_XBee_Communication
more on the 802.15 protocol used by zigbee, and how to set up a demodulator in gnuradio: http://wiesel.ece.utah.edu/media/documents/pdf/2010/03/25/thomas_project_report.pdf
download X-CTU, the software used to control and interact with the Zigbee devices: http://www.digi.com/products/xbee-rf-solutions/xctu-software/xctu#productsupport-utilities
Flags
radio all things radio.
Ham Radio: Notes on General class license: General Digital modes: Radio/Digital Modes
Ham Radio Hardware (Radios): Kenwood TS 440S: Radio/Kenwood/TS440S Kenwood TS 570S: Radio/Kenwood/TS570S Yaesu VX-6: Radio/Yaesu/VX-6 Digital Modes on Raspberry Pi: RaspberryPi/Digital Modes Digital Modes on Arduino: Arduino/Digital Modes DVB-T USB SDR Dongle: DVB-T USB SDR
Ham Radio Software: Software defined radio: SDR Comprehensive list of ham software: Andys Ham Radio Linux Direwolf (soundcard TNC/APRS modem): Direwolf Echolink (internet repeater system): Echolink Qsstv (Slow scan television): Qsstv Fldigi (fast light digital modes): Fldigi Xastir (APRS/AX25/TNC): Xastir RadioHead (packet library for microcontrollers): RadioHead
Category:Radio · Category:Kenwood · Category:Yaesu Flags · Template:RadioFlag · e |
Arduino all the arduino things
Arduino/Micro · Arduino/Leonardo · Arduino/Esplora
Arduino/Micro/Hello World · Arduino/Leonardo/Hello World · Arduino RGB LED
Arduino/Micro/Blink · Arduino/Leonardo/Blink
Arduino/Morse Code Libraries · Arduino/Morse Code Circuit · Arduino/Micro/Blink Morse Code
|