XBP24BZ7PIT-004

XBee expensive expenses

Preamble

I got hold of the excellent ebook, Building Wireless Sensor Networks – A Practical Guide to the ZigBee Mesh Networking Protocol, by Robert Faludi, published by O’Reilly. download it here or here. (Useful links: errata and; code).

Building Wireless Sensor Networks Cover
Building Wireless Sensor Networks Cover

I read a good part of it on Valentine’s day 2015 in Viva8, a kicking bar in Chatuchak market (the [in]famous big one in BKK, where you can buy snakes, dog meat, dinosaurs and old sets of false teeth).

I was hooked, they looked great, and the book was full of interesting projects. I soon figured out what was what, and what was required, or rather what I required.

Which XBee is right for you?

I was really after the 900MHz Pro, with the soldered on RPSMA connector, so that I could have a range of 40 miles. Not that I have any particular application in mind you understand… I just wanted the power, and the range that comes with that power (and still do).

The XBee Pro S2B with RPSMA connector (XBP24BZ7SIT-004)
The XBee Pro S2B with RPSMA connector
(XBP24BZ7SIT-004)

I had been looking on eBay for 4 or 5 months, but they were so damn expensive. Over £60 for the 900MHz Pro with RPSMA, and even the standard Series 2 with whip antennas were £20-30. Too much for my pocket. Don’t forget that you need two of them, as only getting one would be like buying just an M5 steering wheel, no actual car, just the steering wheel – a right wind up. Maybe not a blinding analogy, but the best I can think of at the moment.

I refused to even look at Series 1, although cheap and popular with the DIY crowd, they just seem to be designed for less serious applications. The book also warns people away from them, in chapter one.

My lucky day

So, the other week, I was idling searching eBay for this, that and the other, when I thought I would, for curiosity’s sake, have a look for a bargain. To my surprise I found a couple of items which were a Pro 2B listed for £11.95. I clicked on the listing, to have a closer look at the description, and to my surprise the (UK based) seller is saying “I must be mad, buy one, get one free!” I thought that I was dreaming.

These were the two models that he had:

  • XBP24 Z7PIT 001
  • XBP24 Z7PIT 005

I sent the seller a message, and awaited a reply. In the message I asked a bunch of queries, questioning the reliability of the modules and their authenticity. Especially as the model numbers that he had quoted threw up different, or conflicting, models on the Digi International website. for the 001 and the 005.

The specs quoted by the seller, in the item’s description, were:

Module Applications: RF Communications
Wireless Connectivity-ZigBee
Wireless Protocol: Zigbee Pro Featureset
Data Rate: 250Kbps
Module Interface: UART
Supply Voltage Min: 2.7V
Supply Voltage Max: 3.6V

I had a good old root about for some insight as to what was what, as there was conflicting information all over the web, indicating that many other people were also confused.

The Sparkfun Buying Guide was the most confused, or confusing

  • XBee Znet 2.5 (Formerly Series 2) Retired – These are the fun ones. Series 2 modules must be configured before they can be used. They can run in a transparent mode or work with API commands, but this all depends on what firmware you configure these with. These also can run in a mesh network making them highly configurable and awesome modules. It also makes them harder to use modules. These modules are in no way compatible with the Series 1 modules so stop thinking about trying! These modules are no longer sold but are being replaced with the mostly compatible ZB modules. Datasheet
  • ZB (the current Series2ish module) – Basically the Znet2.5 hardware with new firmware. Meaning they can also run in a transparent mode or work with API commands. They can also run in a mesh network making them highly configurable and awesome modules. You can grab the new firmware and upgrade them yourself. The firmware between the two is not compatible (but is easily interchangeable) so you will have to pick which firmware you want to use on your network and stick with it. Download the conversion kit here. These are often call Series 2 modules, so if you hear someone talking about Series 2, they might be talking about these. It may not be the correct term, but it does distinguish these from the Series 1 modules which is usually all people want to know. These modules will not work in any way shape or form with the Series 1 so stop thinking about it. Stop it! Datasheet
  • 2B(the even more current Series2ish module) – These new modules improve on the hardware of the Series 2 modules improving things like power usage. They run the ZB firmware but because the hardware has been changed they can no longer run the Znet2.5 firmware. So if you are looking to add this to an existing 2.5Znet network beware. Currently some of our boards are 2B and others are ZB

The best explanation of the series was from XBee modules – too many variations

The XBee product line, as it relates to Parallax, currently consists of 2 major divisions. The XBee and XBee-Pro 802.15.4 (formerly officially referred to as “Series 1”) and the XBee and XBee-Pro ZB (formerly officially referred to as “Series 2”). There are three variants within the Series 2 line however – ZNet 2.5, ZB, and S2B.

ZNet 2.5 is the initial ZigBee solution offered by Digi, based upon ZigBee 2006 and is now considered legacy and is not recommended for new designs. The hardware is the same as ZB radios and can be updated to the ZB firmware.

ZB is the current shipping version of the ZigBee protocol based upon the ZigBee Pro feature set. These can be loaded on the ZNet 2.5, ZB and S2B hardware platforms.

S2B is only applicable to the XBee-Pro ZB platform. Hardware upgrade to the original XBee Series 2 radios. Digi migrated to an improved Power Amplifier saving space on the board and increasing performance slightly.

The best explanation of the serial numbers was, yet again, from the thread XBee modules – too many variations

Numbers beginning with XB24 or XBP24 are the Series 1 or Series 2 XBees. The P, if present, indicates that the module is a Pro version.

This is followed by a hyphen, and then a firmware indicator. The firmware indicator shows the firmware type originally shipped on the module:
A : 802.15.4 (and therefore this is a series 1 module)
DM : Digimesh (and therefore this is a series 1 module)
B followed by something other than Z7 : ZNet2.5 (and therefore this is a series 2 module)
Z7 : Zigbee (and therefore this is a series 2 module)
BZ7 : Zigbee, on a series 2B module.

Next comes the antenna type:
SI : RPSMA connector
WI : wire whip
UI : U.FL connector
CI : on board ceramic chip

This is followed by -001 for series 1 modules, and by T-004 for series 2 modules.

There may also be a final J. That, if present, indicates that the chip has a restricted transmission power, which is a requirement in some countries such as Japan (and hence the choice of J, I believe). This is also known as the “international variant”.

In addition, the seller provided this information:

The difference between 001 and 005 is firmware load. 001 is configured as Co-Ordinator while 005 is Configured in API mode

A list of the firmware codes, from PRODUCT NOTICE # 110726: XBee & XBee-PRO ZB Firmware Update,

Part Number       Description       New     Revision

  • XB24-Z7CIT-001 XBee ZB TH Chip Coor,API D
  • XB24-Z7CIT-002 XBee ZB TH Chip Coor,AT D
  • XB24-Z7CIT-003 XBee ZB TH Chip Router,API D
  • XB24-Z7CIT-004 XBee ZB TH Chip Router,AT H
  • XB24-Z7CIT-005 XBee ZB TH Chip End Device, D
  • XB24-Z7CIT-006 XBee ZB TH Chip End Device,AT H
  • XB24-Z7CIT-I057 XBee ZB Rabbit RF Board D
  • XB24-Z7CIT-I058 XBee ZB Rabbit XBee E
  • XB24-Z7CIT-I059 XBee ZB Rabbit USB D
  • XB24-Z7SIT-001 XBee ZB TH RPSMA Coor,A

One issue that I did have with these XBee modules was that they have PCB trace antennas, and not the RPSMA antenna, nor a U.FL connector. The PCB type antenna was my least favourite type, as it has the least range and as they have a “cardioid” radiation pattern, the signal can suffer attenuation in many directions.A few days later I received a reply from the seller. He assumed me that they were genuine and furthered the following information

Essentially the ZB is the replacement for the 2B but the product still retains the same markings on the top of the PCB. See below for an extract from the digi site on key differences between 2B and ZB.

The S2/S2B used the Ember EM250 microprocessor to control the ZigBee Protocol. The XBee/XBee-PRO ZB (S2C) module uses the Ember EM357; this new microprocessor contains much more memory allowing for more flexibility. The footprint of the XBee/XBee-PRO ZB (S2C) Though – Hole is identical to the XBee/XBee-PRO ZB (S2/S2B) and is fully over – the – air (OTA) compatible.
A key change with the XBee/XBee – PRO ZB (S2C) is that six firmware images (Coordinator AT, Coordinator API, Router AT, Router API, End Device AT, and End Device API) are combined into a single firmware load.

He also said that he was going on holiday and would not be available for a couple of weeks. This last fact spurred me into action, and even though I had my reservations, I made the purchase, buying a pair of the 001 modules.

The day of reckoning

The very next day they arrived, I was surprised by the promptness. Beautifully packed:

XBee Pro 2B Box
XBee Pro 2B Box

And the box opened up to reveal, in all their glory, the two XBee Pro 2B modules

Two XBee Pro 2B
Two XBee Pro 2B

However, I have not had chance to test them as I am still waiting for the breakout boards, £1.92, to arrive from China.

XBee Breakout
XBee Breakout

and the explorer board, which doubles as a breakout board, for £1.28, as well.

XBee Explorer Regulated
XBee Explorer Regulated

I have another month or so, of waiting, for those. I will update the blog as, and when, the pieces arrive.

Other Bargains

XBee USB explorer, £2.12 (free p+p)

XBee Explorer with USB
XBee Explorer with USB

XBee Pro Series 2, £11.21 + £10.40 (p+p)

Lot of 4 XBEE PRO Series 2 Module, for £38.43 + £11.13 (p+p), running XBee(-Pro) ZB Firmware 26/Jul/2011 and
Release of XCTU 6.2 16/Jun/2015

4 x XBee Pro Series 2
4 x XBee Pro Series 2

XBee 2mW RPSMA Series 2 (ZigBee Mesh), for £24.99 + 1.92 (p+p)

XBee S2 RPSMA
XBee S2 RPSMA

XBee Wire Antenna – S2 Series 2 – ZB ZigBee – Arduino Wireless Module Wifi Mesh, for £14.24

Series 2 whip antenna
Series 2 whip antenna

A pair of cheaper breakout boards, 2PCS XBee Adapter Shield Breakout Board For XBee Module, for £3.42.

RP-SMA antennas, as standard Wi-Fi (SMA) antennas will not fit (the male pin is in the antenna not the socket, see 900MHz XBee), High Gain 2.4G 3dbi Wifi & WLAN& XBEE RP-SMA Antenna for £0.99 each.

An adapter for the Raspberry Pi, Wireless PiCobber(Shield)|RasPi A+&B+|XBee|NRF24L01|Geekroo|Ship from China for £8.92

Common XBee Mistakes

Your XBee project isn’t working? Here’s some common mistakes that both beginners and experts make:

  • Not using the latest firmware (especially if ATD0 or ATIR is giving an error)*
  • No reference voltage to VREF pin on the 802.15.4 radios (analog and digital reads give wrong values)
  • Forgetting that AT commands use hexadecimals
  • Hitting return after +++ (or otherwise not respecting 1 second default guard time)
  • Conversely, _not_ hitting return after an AT command
  • Letting the XBee time out of command mode before issuing an AT command (you’ll know because you get no response)
  • Forgetting to write the configuration to firmware with ATWR (unless your application configures the radio interactively)
  • Not using ATRE (restore factory defaults) before re-configuring a previously used radio (previous settings lurk unless you manually reset them all)
  • Looking for analog output on the analog input pins instead of pins 6 and 7 (P0, P1)
  • Using a voltage regulator without decoupling capacitors (10uF on input, 1uF on output is good)
  • Mixing up TX and RX pins (fastest way to check this is switch the wires and see if it starts working)
  • Using ZigBee version (ZB Pro or ZNet 2.5) when 802.15.4 version would do just fine (if you don’t need to make a mesh network)
  • Trying to read more than 1.2 Volts on the ZB Pro and ZNet 2.5 analog inputs (that’s the limit)
  • Buying Pro radios when you don’t need them. (Cost more, bigger, use a lot more battery)
  • Deciding the XBees are flaky. (You may not be using them correctly, but they are very reliable)
  • Deciding an XBee is burned out when it’s set to a different baud rate (check ON and ASSC lights)
  • Deciding an XBee is burned out when it is just sleeping (Check ON light to see if it blinks occasionally)
  • Forgetting to supply power or ground (ON light may go on and ASSC light may blink but both will be significantly dimmer)
  • Not contacting Digi sooner for support, especially if your radio seems dead or you keep getting an error you don’t understand.

XBee Arduino Mistakes

  • Sending continuously without any delay (try 10ms delay)
  • Not removing RX and TX connections before uploading code (Arduino will give an error)
  • Not removing RX connection when reseting, if you are continuously receiving data. (Arduino will never reset)

XBee LilyPad Mistakes

  • Hooking up more than 4 Volts to the 3.3V pin
  • Using switches without pull-down resistors (but not if you use the internal pull-ups)
  • Not using a pull-up or pull-down resistor on pins 5 and 7 (these don’t have internal pull-ups at all)
  • Using sensors without voltage divider resistors (if your sensor needs that circuit)
  • Using too-resistive conductive thread for power and ground (try fabric or wires)
* Windows and X-CTU are required for firmware upgrades

This list isn’t exhaustive. Got a suggestion I should add? Let me know!

More common mistakes, from Ren-W Antenna Info.

Getting Everything working

So, finally, the XBees and the breakout boards had arrived, as had the XBee explorer board. Unfortunately, due to cheapness on my part, the XBee explorer board did not have a USB port. So, combining it with a CP2102 USB 2.0 to TTL UART Module (which obviously was not recognised by the Mac, so I had to resort to the HP NC4200 Windows 7 machine).

CP2102
CP2102 UART

Connection of the CP2102 to the XBee Explorer was simple:

CP2102   Explorer

3V3       Vcc

GND     GND

TXD      DOUT

RXD     DIN

As the XBee Explorer is regulated, it should be possible to connect the CP2102 UART’s 5V output to the Explorer’s Vcc, but to be on the safe side I used the 3V3 pin (as the XBees are designed for 3V3). The CP2102 UART’s DTR pin I left unconnected. it should be noted that the PC took a while to find the correct driver for my UART.

I then downloaded the X-CTU software on the PC, plugged in one of the XBee devices into the Explorer. It was already configured as a Configurator, with the latest Configurator AT firmware. All that was necessary was to set the PAN ID. The second XBee was then configured with the latest Router AT firmware, and the PAN ID was set.

After that it was a simple matter of wiring up the XBees, once they had been seated in their breakout boards, to test them. I put both of them on to one breadboard, using two Arduinos, one for each XBee.  I powered both XBees using the 3V3 from one Arduino, and grounded both Arduinos, via the breadboard. One Arduino (the transmitter) had a potentiometer connected to the A0 input (a button can also be connected to pin 2), the other Arduino (the receiver) employed only its onboard Pin 13 LED. Note that it really does not matter whether you use the Router for the Button and the Co-ordinator XBee for the bell, or visa versa. I had the Router on the Button ad the Co-ordinator on the bell.

Then loaded up the following code to the transmitting Arduino with the potentiometer (the “Button Arduino”):

const int BUTTON = 2;
const int PROBE_PIN A0

void setup() {
  pinMode(BUTTON,INPUT);
  Serial.begin(9600);
}

void loop() {
  // send a D over serial port if the button is pressed
  if (digitalRead(BUTTON) == HIGH) {
    Serial.print('D');
    delay(10);
  }

  // send a D over serial port if the potentiometer is turned up more than half way
  if (analogRead(PROBE_PIN) > 512) {
    Serial.print('D');
    delay(10);
  }
}

I loaded the following code up to the receiving Arduino.

const int BELL = 13;

void setup() {
  pinMode(BELL,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0)
  {
    if (Serial.read() == 'D')
    {
      //ring bell briefly
      digitalWrite(BELL,HIGH);
      delay (100);
      digitalWrite(BELL,LOW);
      delay (100);
    }
  }
}

So, when the potentiometer, which was connected to the Transmitting Arduino, was turned more than halfway then the Receiving Arduino would flash its onboard LED (on pin 13). Test completed.

The next step was to modify the code, so that the “button Arduino”, received some feedback from the doorbell Arduino.

The Button Arduino code:

const int BUTTON = 2;
const int PROBE_PIN A0

void setup() {
  pinMode(BUTTON,INPUT);
  Serial.begin(9600);
}

void loop() {
  // send a D over serial port if the button is pressed
  if (digitalRead(BUTTON) == HIGH) {
    Serial.print('D');
    delay(10);
  }

  // send a D over serial port if the potentiometer is turned up more than half way
  if (analogRead(PROBE_PIN) > 512) {
    Serial.print('D');
    delay(10);
  }
}

The Bell Arduino code:

const int BELL = 13;

void setup() {
  pinMode(BELL,OUTPUT);
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0)
  {
    if (Serial.read() == 'D')
    {
      //ring bell briefly
      digitalWrite(BELL,HIGH);
      delay (100);
      digitalWrite(BELL,LOW);
      delay (100);
    }
  }
}
Fault/Status Indicators

As an aid to diagnosis I connected a red LED between pin 6 (Received Signal Strength Indicator) and GND, a green LED between pin 13 (On/Sleep) and GND, and a yellow LED between pin 15 (Association) and GND on both XBee devices. The On/Sleep LED on both XBee devices should be permanently on, the Association LED, once connection between the two XBees has been established, on the Configurator XBee should flash slowly and on the Router, it should flash slightly faster. The RSSI LED will light for 10 seconds when the respective XBee has received data. See also XBee Shield Association LED

XBee shield
XBee shield
Gotchas

Now, I may be an idiot, or maybe I was terribly hungover ,but a few things that caught me out were:

  1. Type the code correctly – on the receiver I was waiting for a ‘O’, in lieu of a ‘D’. I blame that on poor eyesight.
  2. Make sure that you specify the destination address in the XBee configuration, so the Router’s address in the Destination Address of the Configurator, and the Configurator’s address in the Router’s Destination Address (ATDH, ATDL). By default, DH and DL were set to 0000 and FFFF on both my XBee devices, and I failed to change them, although they did sort of communicate, just not quite as I expected. I blame this on the hangover.
  3. I, erroneously, had the coordinator API firmware installed, not the Coordinator AT firmware, so it would receive fine, but not transmit, so the feedback version of the doorbell code would not work properly. The bell would ring as before, but the feedback to the door button would not be received, as the Coordinator was not able to transmit. This caused endless headaches, and was discovered by switching the XBees so that the Co-ordinator was on  the button side and the Router on the Bell, and then I could see that the bell was no longer ringing. I then installed the AT version of the coordinator. However, there after nothing worked..! I was coming to the end of my tether at this point. In the end, I decided to reinstall the firmware on BOTH of the XBees, but reversed the roles (so that the XBEe that had been the router was now the coordinator and visa versa) and ensured that the Force the XBee to maintain current configuration checkbox, in the X-CTU software, was UNTICKED. I then reconfigured both XBees (PANID, DH and DL) from scratch and hey presto! Everything worked..! I have no ida why it did not work, probably some left over setting from a previous configuration.

Other links

Here are a couple of links which document the modes and transparent commands

XBee AT Mode – Transmit and Command Mode Example

XBee API Mode – Read Remote ADC Example

Alternative Doorbell

Ian Lang has an alternative code example for the doorbell, transmitting BYTE codes in lieu of simple ASCII ‘D’ and ‘K’.

Digi Knowledge Base Links

Antenna Connection

The Major Differences in the XBee Series 1 vs. the XBee Series 2

Mixing Antennas

Is it possible to mix XBee devices with different antennas, for example could I use a XBee coordinator, with a chip antenna, in conjunction with a XBee router (or end node), with a RPSMA antenna?

Which XBee antenna type should I use?

Other books

Distributed Network Data

Another book is O’Reilly’s Distributed Network Data by Bradford and Allan, available at eBooks-itdownload link.

Distributed Network Data
Distributed Network Data

PDF: Distributed Network Data

Processing

Only Processing version 1.5.1 can be used with the code in the book, as the XBee object is not handled correctly in later versions. The following line gives a compile time error in Processing version 3.0.1:

xbee xbee = new xbee()

with an error code that says

NoClassDefFoundError:gnu/io/serialportevent listener
Advertisements

13 thoughts on “XBee expensive expenses”

  1. Pingback: XBee | gr33nonline
  2. I bought the two for one as well. I use X-CTU to program them but haven’t had too much time to play with them but they look good and the price is very good. Very well packed. I’ll use your page when I finish my current project. Really good web page, lots of info.

    Like

    1. Thanks for the comment, and I am glad that you like the blog. Yes, those XBees are excellent value for money, and I have actually purchased four more. Good luck with your XBees and using X-CTU… 🙂

      Like

  3. Have a nice time, I found a lot of information to your blog, Thanks for everything. I had order all modules as you describe in here before I read your post! Afrer that I was searching for more info and found yout blog! Is it luck or google knows what I wanted? Who knows!

    Thank again
    Stavros

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s