The Mesh Network

XBee and Arduino

The heart of my playground is an mesh network powered by XBee Series 2 radios from Digi International. The Series 2 modules feature the XBee ZB Zigbee mesh firmware. A picture of an XBee Series 2 radio is featured in the banner of this site.

Each of my XBees is "fed" data by a dedicated Arduino module. I don't have any XBee direct interfaces. The reason is simple. The basic XBee Series 2 radio doesn't include any onboard "logic". No standalone operations can be performed besides transmitting data or changing the state of digital pins. I made a design decision to distribute data processing to each XBee site and only transmit results. But, I needed computing power.

So, an Arduino accompanies each XBee to provide the computing power. My door sensor data signals are "debounced" using an Arduino. My light sensor data signals are converted from analog voltages to "on" or "off" states by an Arduino. My temp sensor data signals are converted from analog voltages into degrees Fahrenheit by an Arduino. Data signals from the soil moisture sensors are converted from analog voltages into "wet" or "dry" signals. And so on... The processed data is then what each XBee transmits.


Sensors and the Sensor Assemblies

Detailed information about the sensors deployed and their incorporation into sensor assemblies is found on the pages describing specific projects. For example, information about my light sensor assemblies can be found here.

All of the sensor assemblies with their companion Arduinos are installed at the author's home in New Hope, MN. All of the installations are "fixed." And all of the installations are powered with wall warts. I have not (yet) built a portable sensor assembly nor dabbled with battery power.

Displaying Results -
  iMac & Processing

One XBee is connected to my iMac. It happens to be the coordinator for the mesh network, but that is coincidence. The XBee is seated in an XBee Explorer board (Sparkfun) and the connection between the board and my iMac is made via a USB cable. There is a a FTDI chip on the Sparkfun board that manages the serial to USB conversion. On my iMac, it appears that I'm connected to the XBee via a serial port.

I have written software on my iMac in a language called Processing. This software reads the serial data coming from the XBee and displays it on a Sensor Dashboard. A picture of the Processing output is below.

My original vision was for my iMac (on the lower level of the house) and my MacBook Air laptop (on the upper level) to have independent XBees connected to them and to have them both running the same Processing sketch. Thus I could see the "status" of my sensors on my iMac downtstairs and where-ever I might wander around the house with my laptop... even to the patio. The only requirement would be to stay in range of ONE XBee. This vision has been abandoned.

For reasons known only to Apple, the Sparkfun XBee Explorer and USB cable that works just fine with my iMac REFUSES to work with my MacBook Air. From what I've read there is just something funky with the USB-C ports on the newer Mac laptops.


Displaying Results - The Internet

My new vision is to have another XBee join the mesh network and, through the magic of Arduino and an ESP8266, to put sensor status "on the internet." This project is just starting. See the Sensor Dashboard page here to understand where I want to go.

A Picture

I am a visual learner. I have to draw pictures to explain what I have in my mind. "A visual learner will utilize graphs, charts, maps, diagrams and other forms of visual stimulation to effectively interpret and convey information." (Wikipedia) Consequently, presented below is a "picture" of my mesh network. The large circled letters refer to notes on the side and at the end.

(A)   This represents the "typical" sensor installation. Multiple sensors are connected to one Arduino. The Arduino is wired to one XBee. The XBee radio is configured as a "router" and is set to broadcast on the network (as opposed to transmit point-to-point). Consequently, the XBee at site (A) theoretically talks to every other XBee on the network.

(B)   This just emphasizes that every XBee talks to every other XBee. There are six XBees so every one has five network connections to manage. Every message received by an XBee is rebroadcast three times. Each Arduino is programmed to sample its sensors every five seconds and every sampling results in a broadcast. You can see how quickly there are many radio messages bouncing around this network.

(C)   One of the XBees must be configured as a "coordinator" and I have chosen that honor for the XBee connected to my iMac. There is no particular reason. The "coordinator" XBee manages the mesh network.

(D)   This part of the network is envisioned, but not yet constructed. This corner will consist of an XBee, an Arduino and an ESP8266 Huzzah (Adafruit). Note that the Soil Moisture Sensors are also still in the planning phase. And the temperature sensors are not yet installed in their final home. These "future plans" illustrate a key concept. Adding an XBee to the network is as simple as giving the new XBee the appropriate network code. Nothing has to be done with the "old" XBees already on the network.