Analyzing sensor readings with an XBee wireless connection


XBee modules let you take multiple sensors and build relatively uncomplicated wireless networks that a Raspberry Pi can then connect together.

Wireless sensors have been used in home automation setups for a long time. However, the process of extracting useful information from a multitude of sensors all operating on one frequency can be challenging. The XBee modules from Digi International [1] utilize integrated protocols that can span large wireless networks and control communication among all of the components. Additionally, the modules can read sensor values from numerous ports and transmit the measurement data via the network to other XBee modules. As a result, they offer the ideal foundation for evaluating data from a sensor network with a Raspberry Pi.

The XBee Family

XBee modules have been around for more than 10 years, and during that time, the product family has grown considerably in size. The protocol for the modules was originally based on IEEE 802.15.4-2003 and was intended for setting up simple connections between two partners or among networks that each had a central hub. The advanced ZigBee protocol [2] is built on top of this original framework and can handle mesh networks with complex message relays. XBee manufacturer Digi International also has added a robust and energy-efficient protocol, DigiMesh [3], to its product line.

The XBee with its relatively small 1mW power capacity is fundamentally different from the more powerful Pro modules that, depending on applicable national and regional regulations, use up to 100mW for transmission. The Pro module has a wider transmission range and proves to be more robust for professional applications. Additionally, the modules have a variety of antennae. Printed circuit board (PCB) modules feature a flat antenna that has been soldered to the module. There is also a module with a short wire antenna (Figure 1) and a connector for an external antenna that can be used to improve transmission capacity or to direct the module antenna from inside the module cover to the outside.

Figure 1: The XBee Series 2 Pro has significantly more transmission power and a wire antenna.

Practical Uses for the XBee Module

The XBee module has 20 connections arranged at intervals of 2mm. These measurements are not compatible with traditional circuit boards, which typically have a grid of holes spaced 2.54mm (0.1 inches) apart. Therefore, you will need an adapter to perform the first experiments with the modules. Simple boards, like that shown in Figure 2, cost about $10 [4].

Figure 2: You need an adapter board to connect to traditional circuit boards because the XBee modules use non-standard grids.

The module is configured directly with the serial connectors, pin 2, and pin 3. This means that the only thing you still need is a serial connection to the computer. Even though PCs with serial ports are threatened with extinction, the USB TTL adapter can provide a good and economical substitute for less than $10 [5]. It is important to remember that a maximum 3.3V are permitted by the serial connectors; otherwise, the XBee could be damaged.

To be on the safe side, it is a good idea to use the somewhat more expensive adapter board that has a USB connector (Figure 3). Depending on the manufacturer, these boards can cost between $15 [6] and $25 [7]. Professional developer board prices start at $150 [8], but they are used primarily in the development of industrial applications.

Figure 3: A USB adapter board makes it possible to convert the serial connector of the XBee to USB.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content