(Now a bi-weekly program)
April 9, 2013
Join the "CWTD Yahoo Group" for email discussion in between our bi-weekly sessions by clicking here.
Our episode this time again focuses on two subjects ...
1) XBee RF Data Link for Ham Station Mesh Networking, Part 1 -- This is the start of an interesting group project that will lead in several episodes to the creation of a functional, useful and indeed valuable "mesh network" for data and control within our ham stations. We begin in this episode of CWTD by using a couple of "Series 1" XBee modules in default, out-of-the-box configuration to set up a remote terminal modem capability ... typing on the remote XBee node's serial port terminal is sent wirelessly to an Arduino connected serially to the other node. Then we reconfigure the standalone remote node to independently make periodic A/D readings of an LM34 temperature sensor and send the readings over the RF link to the XBee receiver on the base Arduino, which converts the raw ADC readings to accurate temperature values for display in the Arduino's serial console.
2) Synchronizing & 7-segment Display for the Precision Arduino Clock -- This installment of the Clock project deals with the addition of a 7-segment, 4-digit multiplexed LED module to provide time and temperature readouts (soon).
And we're pleased to have Frank N3PUU with us this time as guest co-host! Frank brings some prior experience with the XBee radios that we've already been tapping into locally as we've been developing the show material. (Joe N2CX was feeling under the weather this time and was not present, so it was very helpful to have Frank lined up to be co-host ... Thanks Frank!)
73, George N2APB, Joe N2CX & Frank N3PUU
Podcast ... Either click on this MP3 podcast recording to play the podcast live on your computer, or right-click to save the mp3 file for local archive or later enjoyment.
Online Text Comments
Captured from listener posting in the text chat window during the program (comments relate to the live discussion at a given moment of the program) ...
<20:11:53> "Lee KM4YY": the code What does the #include *.h for.
<20:12:23> "Lee KM4YY": i.e., <Wire.h>
<20:14:51> "Ray K2ULR": I just discovered the other day that there is a Mac version of software to program the Arduino.
<20:35:18> "Ray K2ULR": $30 for an XBee on Amazon... so it pays to shop.
<20:35:26> "Charles WC5MC": anyone familiar with www.coloradomicrodevices.com/the-radio-block/ ? Like opensource 802.15.4 Xbee like device. I just browsed into the site. ~ 22 dollars
<20:39:48> "Frank N3PUU": Link to adapter board being talked about: http://www.adafruit.com/products/126
<20:40:24> "Frank N3PUU": USB XBee Adapter: http://www.adafruit.com/products/247
<20:45:58> "Bob - N2OJJ": xctu from http://www.digi.com/support/productdetail?pid=3352&osvid=57&type=utilities
<20:46:10> "Bob - N2OJJ": click diag and utilities
<20:46:38> "Frank N3PUU": Thanks Bob!
<20:53:59> "Charles WC5MC": I thought there were no carrier boards at first too but look closely the holes are semi circles
<21:00:25> "Joe N2CX": I'm here for at least a short while! - Had to update Teamspeak client to log on...
<21:00:54> "Charles WC5MC": Welcome back Joe :)
<21:06:12> "Joe N2CX": Sounds like it's going well. Gotta go now.
<21:12:36> "Russ KX5G": there are 10 i/o ports, all 10 can do digital I/O and four can be analog in
<21:13:15> "Russ KX5G": Power draw is about 35 mA in transmit 1uA when asleep
<21:21:48> "Mike WA8BXN": U2 has 2 pin 4's
<21:25:49> "Mike WA8BXN": link for LED mux sketch is wrong!
<21:37:09> "Mike WA8BXN": can you give the url for the related discussion group?
<21:37:12> "Charles WC5MC": https://i.chzbgr.com/maxW500/7255171328/hD42A22FA/ low battery use
<21:37:17> "Russ KX5G": George: If you need another brain to pick about API mode and remote sensing, you can contact me at russthom .at. fiivegulf .dot. com, I am working with the API almost daily.
Part 1: XBee RF Data Link for Ham Station Mesh Networking, Part 1
This is the start of an interesting group project that will lead in several episodes to the creation of a functional, useful and indeed valuable "mesh network" for data and control within our ham stations. We begin in this episode of CWTD by using a couple of "Series 1" XBee modules in default, out-of-the-box configuration to set up a remote terminal modem capability ... typing on the remote XBee node's serial port terminal is sent wirelessly to an Arduino connected serially to the other node. Then we reconfigure the standalone remote node to independently make periodic A/D readings of an LM34 temperature sensor and send the readings over the RF link to the XBee receiver on the base Arduino, which converts the raw ADC readings to accurate temperature values for display in the Arduino's serial console.
Want short range unlicensed communications within the shack
Many choices but dedicated modules the simplest idea
Already designed – almost “plug and play”
Defined connections, protocols and performance
Bluetooth a possibility but performance and expandability limited
Xbee (or its cousin Zigbee) better choice
Easy to interface
Inexpensive to purchase
Many existing projects using Arduino
Chosen manufacturer is Digi – www.digi.com/products/
Easiest to by modules from Adafruit, Digikey or Mouser
Several series of Digi modules available with different capabilities
All operate at 900 MHz or 2.3 GHz
What is XBee?
XBee Product Family
The XBee family of embedded RF modules provides OEMs with a common footprint shared by multiple platforms, including multipoint and ZigBee/Mesh topologies, and both 2.4 GHz and 900 MHz solutions. OEMs deploying the XBee can substitute one XBee for another, depending upon dynamic application needs, with minimal development, reduced risk and shorter time-to market.
Why XBee Multipoint RF Modules?
XBee multipoint RF modules are ideal for applications requiring low latency and predictable communication timing. Providing quick, robust communication in point-to-point, peer-to-peer, and multipoint/ star configurations, XBee multipoint products enable robust end-point connectivity with ease. Whether deployed as a pure cable replacement for simple serial communication, or as part of a more complex hub-and-spoke network of sensors, XBee multipoint RF modules maximize wireless performance and ease of development.
Drop-in Networking End-Point Connectivity
XBee OEM RF modules are part of Digi’s Drop-in Networking family of end-to-end connectivity solutions. By seamlessly interfacing with compatible gateways, device adapters and extenders, XBee embedded RF modules provide developers with true beyond-the-horizon connectivity.
What you get from Adafruit Technologies (http://www.ladyada.net/make/xbee/index.html)
The DTR, RTS, RESET and RX pins (going into the XBee) pass through a level converter chip that brings the levels to 3.3V.
You can use pretty much anywhere between 2.7 to 5.5V data to communicate with the XBee.
The breakout pins on the bottom of the board are not level shifted and you should try to keep data going directly into the XBee pins under 3.3V
Series 1 vs Series 2 modules range of up to 100 feet
Series 1 “point to multipoint” – basically one device talking directly to one or more others in pre- defined network
Series 2 “mesh network” - multiple devices which do not have a predefined network and any can talk to any other and can enter or leave network autonomously
Pro series modules
60 mW power vs 1 mW for range up to several miles (LOS)
For connection to Wifi networks or modules
Wire or chip antennas
Wire monopoles or on-board “patch” antenna
Wire is only ~ 1” long and cheapest
Here are the components that we'll be using in our XBee experiments. Bare minimum needs are two XBee Series 1 modules (item 1) and one each of the carrier boards (items 2 and 3.)
1) XBee Series 1 Radio Modules -- Series 1 modules are the easiest to use in setting up and learning about XBee capabilities ...
Adafruit product ID : 128 (http://www.adafruit.com/products/128)
2) Translator Carrier/Adapter -- Since the XBee natively works on 3.3V, we need a "level translator carrier board" in order for the Arduino's 5V I/O pins to connect to the XBee ...
Adafruit product ID : 126 (http://www.adafruit.com/products/126)
Digi-Key ... http://www.digikey.com/product-search/en/rf-if-and-rfid/rf-accessories/3539661?k=32401-nd
3) USB Carrier Board -- There's also a carrier board with an FTDI USB controller chip on it, for use as an easy connection to the computer's USB port ...
Adafruit product ID : 247 ... http://www.adafruit.com/products/247
And while you're at it, you might want to prepare for next episode's exercise of using three of the Series 2 modules below for "multi-point mesh networking" ...
4) XBee Series 2 Radio Modules -- We'll later evolve to using Series 2 XBee modules for enhanced operation (as a multipoint-connected "mesh" network) ...
Adafruit product ID : 968 (http://www.adafruit.com/products/968)
Digi-Key ... http://www.digikey.com/product-detail/en/XB24-Z7WIT-004/602-1098-ND/1942304
Two Series 1 modules are connected here in our test system breadboard(s).
The XBee in the left node is connected to a serial port of a PC using the XBee in a convenient USB carrier board (Adafruit p/n: 247, http://www.adafruit.com/products/247?gclid=CI3H56bP37YCFUFo4AodkiQAWA ). Keystrokes made in a dumb terminal program application (like TeraTerm or X-CTU) running on the PC gets sent over the RF link to the other XBee node.
The XBee node on the right is plugged into the "level translation" carrier board (Adafruit p/n: 126, http://www.adafruit.com/products/126?gclid=CMHgzpTP37YCFYPd4Aod_jwA9A), which in turn is plugged into the wire plugboard containing the Arduino.
The Arduino is running the sample sketch "NewSoftSerial_1" that acts as a modem: Keyboard data entered into the Arduino serial console (i.e., the "terminal" program in the Arduino environment running on the PC) is sent via a serial Rx/Tx digital signal stream to the XBee node, which get sent via the RF to the left node XBee.
Using this arrangement, one is able to type in either "terminal" window and see the data appear in the other!
See the diagram below for the schematic version of this modem exchange.
And finally, the terminal windows (below) showing the respective left XBee node and the right XBee node.
The process starts with the Arduino on the right node starting up and displaying "Goodnight moon!" in its own serial console, and then
sending "Hello, World?" to the left XBee node.
Then to illustrate the interactive nature of the bi-directional modem link, I typed into the text entry area of the right window "now is the time"
and hit <Send> to send that string over to the left XBee node ... resulting in that string being received and displayed in the window.
I then typed "for all good Homebrewers to build!" into the terminal of the left XBee node, and the characters were transmitted (as I typed)
to the right XBee node, resulting in that string being displayed in the Arduino's serial console on the right.
The first thing to do is to reconfigure the XBees to do something slightly different than the transparent pass-thru character mode done so far.
1) configure the standalone remote XBee node to periodically make A/D readings, send them to the base node, and then go to sleep in between readings; and
2) configure the receiving XBee node (at the Arduino) to be listening for this periodically incoming ADC reading
First, we need to connect each XBee, in turn, to the PC using the USB carrier and a program from the XBee people called: X-CTU. This program provides a convenient way to read and configure the many internal settings of the XBee. Just download and install the X-CTU program for Windows, connect to your XBee in the USB carrier, and make the following settings in each module, as shown in the chart below (transmitter XBee settings are in the left column, and the Receiver XBee settings are in the right column). If you have any problems, you can refer to the good X-CTU manual.)
TRANSMITTER XBEE NODE: RECEIVER XBEE NODE: Connected to PC via XBee USB Adapter
Modem is set to XB24
Function Set is XBEE 802.15.4
Version set to 10ED
Click Write (updates firmware)
Then Parameters are set to:
MY=1 - Address of module is "1"
SM=4 - Cyclic Sleep
ST=3 - return to sleep after 3 milliseconds of RF/Serial inactivity
SP=C8 - Sleep period of 2000 (200 x 10) milliseconds
D0=2 - Sets pin D0 to ADC Mode
IT=0B - 11 A/D samples per packet
IR=1 - milliseconds between A/D samples
Click Write (writes settings to XBee)
Connected to PC via XBEE USB Adapter
Modem is set to XB24
Function Set is XBEE 802.15.4
Version set to 10ED
Click Write (updates firmware)
Then Parameters are set to:
AP=2 - Enables API Mode w/ PPP
Click write (writes settings to XBee)
WIRING FOR REMOTE NODE (Transmitter) WIRING FOR ARDUINO BASE NODE ( Receiver) +Vs of LM34 to XBee Pin 1 (Vc / 3.3v)
Vout of LM34 to XBee Pin 20 (D0)
Ground of LM34 to GND Pin on XBee Adapter Board
XBee Pin 14 (Vref) to XBee Pin 1 (Vcc / 3.3v)
GND Pin of XBee Adapter to - of battery
+5V Pin of XBee Adapter to + of battery
XBee in XBee Adapter ("Carrier") Board
Arduino GND Pin to XBee Adapter GND Pin
Adruino 5V Pin to XBee Adapter GND Pin
Arduino Pin 7 to XBee Adapter RX Pin
Arduino Pin 8 to XBee Adapter TX Pin
Photo of the N3PUU remote temperature node (on right), with the Arduino "base" receiver node (on left).
Screen shot of the Arduino Serial Console displaying the temperature coming in from the remote node.
Here is the sketch (Series1_Read_Remote_TMP36_via_XBee.ino) to be loaded into the Arduino Base Controller to read the remote temperature sensing node and display it on the Arduino's Serial Console, as pictured above.
Series 2 Experiments for "Mesh Networking??
The sky is the limit: Remote control of rigs, ATUs, audio levels, wireless CAT control, Morse Code, lights, PTT, ... More coming soon on this!
1) Mesh networks ... http://en.wikipedia.org/wiki/Mesh_networking
2) Point-to-point protocol ... http://en.wikipedia.org/wiki/Point-to-point_protocol
3) Overview of XBee ... http://www.ladyada.net/make/xbee/
4) Which XBee module to use? ... http://www.ladyada.net/make/xbee/modules.html
5) Manufacturer of XBee Modules ... Digi.com ... http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/
6) Passing discrete signals (pin hi/lo) from module to module ... http://www.ladyada.net/make/xbee/ref.html
7) Other Arduino XBee project pages:
8) XBee Manual ... https://dl.dropbox.com/u/43021514/CWTD/xbee_1/XB_802.15.4%20Manual.pdf
Part 2: Synchronizing Software and 7-Segment Display for our CWTD Precision Arduino Clock
This time we present the software "sketch" used for ...
Precision Arduino Clock Breadboard Prototype
Notice that we've switched over to showing the N2APB breadboard for the Precision Arduino Clock
And we now have the two pushbuttons mounted on the plugboard, serving as the main User Interface for time synchronization.
Lastly, notice that we've added a 4-digit, 7-segment LED display (tipped sideways for mounting on the plugboard).
Once the sketch is fully implemented, the LEDs will also display the time.
The LED array may be purchased from Adafruit Technologies at ... http://www.adafruit.com/products/1268
The sample sketch for running the LED mux is https://dl.dropbox.com/u/43021514/CWTD/xbee_1/_7_seg_example.ino
Precision Arduino Clock Functional Flow Chart
Shield Schematic -- see below
Phase 0/1 Sketch -- Software for basic clock with manual register count-up (for software training purposes) and sync with tone decoder via CHU signal. Also handles external sync input.
Phase 2b Sketch -- Software now uses the RTC chip for date/time retention and timing. Current time set from computer when you first load the sketch onto the Arduino ... no more need for cumbersome serial console and "user time setting" menus!! Also no longer depend on "wait 1000ms" for timing ... we now let the RTC chip do it and we look for the transition of its output pin, clocking at 1 Hz interval. LED added to show RTC heartbeat. Software greatly simplified. Needs the RTClib (see next item).
RTClib library... unzip, rename folder to RTClib and place into your Arduino libraries folder.
LMC567 Data Sheet (Tone Decoder)
Arduino Uno R3 Data Sheet
Phase 0: Tone detection at top of minute from WWV or CHU
Phase 1: Addition of 1pps input signal from GPS for seconds sync
Phase 2: Addition of RTC chip to maintain date/time
Phase 3: Addition of NMEA input from GPS for date/time setting & sync
Phase 4: Addition of USB serial input from PC for sync via Internet
Phase 5: Addition of MC145442 modem chip to decode WWV digital data
"Official" info on I2C communications with the Arduino using the Wires : <http://www.arduino.cc/en/Reference/Wire>
Sample project using I2C expansion with Arduino: <http://www.neufeld.newton.ks.us/electronics/?p=241>
Sample I2C Arduino sketches: <http://digitalcave.ca/resources/avr/arduino-i2c.jsp>
Back to CWTD Home