ModularSensors > Modules > Supported Modems and Communication Modules > Sodaq UBee's and other u-blox modules > Sodaq UBee 2G, 3G, and other u-blox 2G and 3G Modules

Sodaq UBee 2G, 3G, and other u-blox 2G and 3G Modules module

Introduction

There are a several of boards available that feature a variant of the u-blox 2G and 3G modules, including a Sodaq UBee based on the SARA U201 and another based on the SARA G3.

The default baud rate for the SARA U201 is 9600.

Power draw for most 2G and 3G modules is up to 2A. The Sodaq UBee's provide extra battery sockets to supply the additional power. These MUST be used.

Manufacturer Documentation

The module datasheet and AT commands for the SARA U2 series are available here: https://www.u-blox.com/en/product/sara-u2-series The schematics for the UBee are available here: https://support.sodaq.com/Shields_and_Bees/ubee/

Modem Constructor

SodaqUBeeU201(Stream* modemStream, int8_t powerPin, int8_t statusPin, int8_t modemResetPin, int8_t modemSleepRqPin, const char* apn)

Construct a new Sodaq UBee U201 object.

Parameters
modemStream The Arduino stream instance for serial communication.
powerPin The digital pin number of the mcu pin controlling power to the modem (active HIGH). Should be set to a negative number if the modem should be continuously powered or the power cannot be controlled by the MCU. For the Sodaq UBee, this is the pin labeled ON/OFF; pin 9 on the bee socket. The fact that this pin controls the power to the u-blox module is not clear in the Sodaq documentation.
statusPin The digital pin number of the mcu pin connected to the modem status output pin. Should be set to a negative number if the modem status pin cannot be read. This is the pin labeled V_INT in the u-blox integration guide. It is (misleadingly) called CTS in some of the Sodaq UBee documentation because Sodaq wired the V_INT from the u-blox to the pin usually reserved for CTS on the bee socket.
modemResetPin The digital pin number of the pin on the mcu attached the the hard or panic reset pin of the modem. Should be set to a negative number if the modem reset pin is not connected to the MCU. This is the pin labeled RESET_N in both u-blox and Sodaq documentation.
modemSleepRqPin The digital pin number of a pin on the mcu used to request the modem enter its lowest possible power state. Should be set to a negative number if there is no pin usable for deep sleep modes or it is not accessible to the MCU. This is the pin labeled PWR_ON in both u-blox and Sodaq documentation.
apn The Access Point Name (APN) for the SIM card.

The constuctor initializes all of the provided member variables, constructs a loggerModem parent class with the appropriate timing for the module, calls the constructor for a TinyGSM modem on the provided modemStream, and creates a TinyGSM Client linked to the modem.



Example Code

The SARA U201 based UBee is used in the menu a la carte example.

// For the Sodaq UBee based on the 3G u-blox SARA U201
#include <modems/SodaqUBeeU201.h>

// NOTE: Extra hardware and software serial ports are created in the "Settings
// for Additional Serial Ports" section
const int32_t modemBaud =
    9600;  //  SARA U2xx module does auto-bauding by default

// Modem Pins - Describe the physical pin connection of your modem to your board
// NOTE:  Use -1 for pins that do not apply
// Example pins are for a Sodaq uBee U201 with a Mayfly
const int8_t modemVccPin     = 23;  // MCU pin controlling modem power
const int8_t modemStatusPin  = 19;  // MCU pin used to read modem status
const int8_t modemResetPin   = -1;  // MCU pin connected to modem reset pin
const int8_t modemSleepRqPin = 20;  // MCU pin for modem sleep/wake request
const int8_t modemLEDPin = redLED;  // MCU pin connected an LED to show modem
                                    // status

// Network connection information
const char* apn = "xxxxx";  // APN for GPRS connection

// Create the modem object
SodaqUBeeU201 modemU201(&modemSerial, modemVccPin, modemStatusPin,
                        modemResetPin, modemSleepRqPin, apn);
// Create an extra reference to the modem by a generic name
SodaqUBeeU201 modem = modemU201;

Classes

class SodaqUBeeU201
The loggerModem subclass for the 2G/3G Sodaq UBee based on the u-blox SARA U201 2G/3G cellular module.

Defines

#define TINY_GSM_MODEM_UBLOX
The modem type for the underlying TinyGSM library.
#define U201_STATUS_LEVEL = HIGH
The loggerModem::_statusLevel.

Status of the U201 should be monitored on the V_INT pin. The time after end of wake pulse until V_INT becomes active is unspecified in documentation; we use the value from the Lisa U2, which is 100ms.

#define U201_STATUS_TIME_MS = 100
The loggerModem::_statusTime_ms.

Status of the U201 should be monitored on the V_INT pin. The time after end of wake pulse until V_INT becomes active is unspecified in documentation; we use the value from the Lisa U2, which is 100ms.

#define U201_RESET_LEVEL = LOW
The loggerModem::_resetLevel.

U201 is reset with a >50ms low pulse on the RESET_N pin

#define U201_RESET_PULSE_MS = 75
The loggerModem::_resetPulse_ms.

U201 is reset with a >50ms low pulse on the RESET_N pin

#define U201_WAKE_LEVEL = LOW
The loggerModem::_wakeLevel.

The SARA U201 is switched on by a 50-80 MICRO second LOW pulse on the PWR_ON pin.

#define U201_WAKE_PULSE_MS = 1
The loggerModem::_wakePulse_ms.

The SARA U201 is switched on by a 50-80 MICRO second LOW pulse on the PWR_ON pin.

#define U201_WAKE_DELAY_MS = 0
The loggerModem::_wakeDelayTime_ms.

The SARA U201 turns on when power is applied - the level of PWR_ON then is irrelevant. No separate pulse or other wake is needed.

#define U201_ATRESPONSE_TIME_MS = 6000L
The loggerModem::_max_atresponse_time_ms.

Time until system and digital pins are operational is 6 sec typical for SARA U201.

#define U201_DISCONNECT_TIME_MS = 15000L
The loggerModem::_disconnetTime_ms.

Power down time for u-blox modules _"can largely vary depending on the application / network settings and the concurrent module activities."_ The V_INT pin should be monitored and power not withdrawn until that pin reads low. We allow up to 15 seconds for shutdown in case it is not monitored.