Zigbee
From charlesreid1
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
Getting Zigbee Working
Here's the rundown of the steps:
- find the device
- figure out how to connect to the device
- determine parameters necessary
- ...
- profit?
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
Finding 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.
Connecting to the device
Connecting using screen
I used the instructions on this page to connect at 9600 baud to the Zigbee using the screen program: http://www.cyberciti.biz/faq/unix-linux-apple-osx-bsd-screen-set-baud-rate/
I ran:
$ screen /dev/tty.usbserial-A601FA3K 9600,cs8
and I got a "/dev/tty.usbserial' for R/W: resource busy" error message. What that means is, there's already a connection between screen and the zigbee. Use lsof to look for the current session that has a connection with the Zigbee:
$ lsof | grep usbserial screen 837 charles 5u CHR 17,8 0t3 645 /dev/tty.usbserial-A601FA3K
Then you can attach to that session using:
$ screen -x 837
This works like any ordinary session of screen: to detach, run Control+A D to detach, Control+A K to kill, screen -ls to list running sessions, etc.
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 · Mnemonics/General Class License 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 |