Digi XBee's topic

Introduction

All of the various cellular XBee's and XBee3's are supported by this library. The wifi S6B is also supported.

Mayfly and Digi XBee Connections

Pin Numbers for connecting Digi XBee's Directly to a Mayfly v1.x

This applies to all Digi XBees and XBee3's when attached directly to the Mayfly's bee slot.

1const int8_t modemVccPin = 18; // MCU pin controlling modem power
2const bool useCTSforStatus = true; // Flag to use the XBee `CTS` pin for status
3const int8_t modemStatusPin = 19; // MCU pin used to read modem status
4const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin
5const int8_t modemSleepRqPin = 23; // MCU pin used for modem sleep/wake request
6const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem status

Pin Numbers for connecting Digi XBee's Directly to a Mayfly v0.3-v0.5c

This applies to all Digi XBees and XBee3's when attached directly to the Mayfly's bee slot.

1const int8_t modemVccPin = -1; // MCU pin controlling modem power
2const bool useCTSforStatus = true; // Flag to use the XBee `CTS` pin for status
3const int8_t modemStatusPin = 19; // MCU pin used to read modem status
4const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin
5const int8_t modemSleepRqPin = 23; // MCU pin used for modem sleep/wake request
6const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem status
  • The Digi XBee gets power from pin 1; on a Mayfly this pin is always powered - the XBee cannot be powered down.
    • NOTE: If using a cellular XBee or XBee3 directly with the Mayfly your Mayfly must be at least v0.5b, you must use SJ13 to connect the Bee directly to the LiPo, and you must always have a battery connected to provide enough power for the XBee to make a cellular connection.
    • NOTE 2: If you turn off the Mayfly via its switch but leave the XBee connected as above, it will drain your battery very quickly. Disconnect the battery if you turn off the Mayfly.
  • The Digi XBee reports ON/SLEEP_N on pin 13, but this is not connected to a Mayfly pin. Instead, use the XBee's CTS pin (pin 12) which is connected to Mayfly pin 19.
  • XBee pin 5 is RESET_N but this is not connected to any pin on the Mayfly.
  • XBee pin 9 is SLEEP_RQ which is connected to Mayfly pin 23.
  • I like to use the red LED to show the bee wake/sleep since the Digi XBee's have no LEDs of their own.

Pin Numbers for connecting Digi LTE XBee3's to a Mayfly v0.3-v0.5c via the LTE adapter board

1const int8_t modemVccPin = -1; // MCU pin controlling modem power
2const bool useCTSforStatus = false; // Flag to use the XBee `CTS` pin for status
3const int8_t modemStatusPin = 19; // MCU pin used to read modem status
4const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin
5const int8_t modemSleepRqPin = 23; // MCU pin used for modem sleep/wake request
6const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem status
  • The power is still not controllable unless you use both SJ7 on the Mayfly and SJ1 on the adapter. Doing so, you could use pin A5 for modem Vcc.
  • The LTE adapter connects ON/SLEEP_N on bee pin 13 to Mayfly pin 19 (unless you change this with adapter SJ2).
  • XBee pin 5 is RESET_N which the adapter connects to Mayfly pin 20.
  • XBee pin 9 is SLEEP_RQ which is connected still to Mayfly pin 23.
  • I still like to use the red LED to show the bee wake/sleep in addition to the lights on the adapter.

Topics

topic Digi XBee® Cellular 3G
topic XBee Cellular
topic Digi XBee® Cellular LTE-M/NB-IoT
topic XBee Wifi S6B

Classes

class DigiXBee
The parent class for all Digi XBee and XBee3 wifi and cellular modules.

Modem Pin Settings and Timing

The timing and pin level settings for a Digi XBee

#define XBEE_STATUS_TIME_MS = 15
The loggerModem::_statusTime_ms.
#define XBEE_RESET_LEVEL = LOW
The loggerModem::_resetLevel.
#define XBEE_RESET_PULSE_MS = 5
The loggerModem::_resetPulse_ms.
#define XBEE_WAKE_LEVEL = LOW
The loggerModem::_wakeLevel.
#define XBEE_WAKE_PULSE_MS = 0
The loggerModem::_wakePulse_ms.
#define XBEE_WAKE_DELAY_MS = 100
The loggerModem::_wakeDelayTime_ms.
#define XBEE_ATRESPONSE_TIME_MS = 15000L
The loggerModem::_max_atresponse_time_ms.
#define XBEE_DISCONNECT_TIME_MS = 15000L
The loggerModem::_disconnetTime_ms.

Define documentation

#define XBEE_STATUS_TIME_MS = 15

The loggerModem::_statusTime_ms.

XBee status can either be measured directly with ON/SLEEP_N/DIO9 or indirectly with CTS_N/DIO7. The status level will depend on which is being used:

  • the ON/SLEEP_N/DIO9 will be HIGH when the XBee is awake (ie, yes, I am not sleeping)
  • but the CTS_N/DIO7 will be LOW when the board is awake (ie, no it's not not clear to send).

To use the CTS_N/DIO7 as the status indicator, set useCTSStatus to true in the constructor.

The time from wake until the status pin is active is not documented.


#define XBEE_RESET_LEVEL = LOW

The loggerModem::_resetLevel.

All Digi XBee/XBee3's are reset via a LOW pulse on the RESET_N pin.


#define XBEE_RESET_PULSE_MS = 5

The loggerModem::_resetPulse_ms.

All Digi XBee/XBee3's are reset via a LOW pulse on the RESET_N pin.


#define XBEE_WAKE_LEVEL = LOW

The loggerModem::_wakeLevel.

All XBee/XBee3 modules are woken by holding DTR_N/SLEEP_RQ/DIO8 LOW (not pulsed).


#define XBEE_WAKE_PULSE_MS = 0

The loggerModem::_wakePulse_ms.

All XBee/XBee3 modules are woken by holding DTR_N/SLEEP_RQ/DIO8 LOW (not pulsed).


#define XBEE_ATRESPONSE_TIME_MS = 15000L

The loggerModem::_max_atresponse_time_ms.

The serial response time is not documented for the XBee so we allow a long (15s) buffer. It is probably much less than this, except possibly in bypass mode.


#define XBEE_DISCONNECT_TIME_MS = 15000L

The loggerModem::_disconnetTime_ms.

Power down time for the XBee is dependent on the underlying cellular or wifi component. We allow 15 seconds in case it is not monitored. The u-blox SARA R4 on the LTE-M model takes nearly that long to shut down.