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

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::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).
statusPin The digital pin number of the mcu pin connected to the modem status output pin.
modemResetPin The digital pin number of the pin on the mcu attached the the hard or panic reset pin of the modem.
modemSleepRqPin The digital pin number of a pin on the mcu used to request the modem enter its lowest possible power state.
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.

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. 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. 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. 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.



Example Code

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

1// For the Sodaq UBee based on the 3G u-blox SARA U201
2#include <modems/SodaqUBeeU201.h>
3
4// NOTE: Extra hardware and software serial ports are created in the "Settings
5// for Additional Serial Ports" section
6const int32_t modemBaud =
7 9600; // SARA U2xx module does auto-bauding by default
8
9// Modem Pins - Describe the physical pin connection of your modem to your board
10// NOTE: Use -1 for pins that do not apply
11// Example pins are for a Sodaq uBee U201 with a Mayfly 0.x
12const int8_t modemVccPin = 23; // MCU pin controlling modem power
13const int8_t modemStatusPin = 19; // MCU pin used to read modem status
14const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin
15const int8_t modemSleepRqPin = 20; // MCU pin for modem sleep/wake request
16const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem
17 // status
18
19// Network connection information
20const char* apn = "xxxxx"; // APN for GPRS connection
21
22// Create the modem object
23SodaqUBeeU201 modemU201(&modemSerial, modemVccPin, modemStatusPin,
24 modemResetPin, modemSleepRqPin, apn);
25// Create an extra reference to the modem by a generic name
26SodaqUBeeU201 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.

Modem Pin Settings and Timing

The timing and pin level settings for a Sodaq UBee U201

#define U201_STATUS_LEVEL = HIGH
The loggerModem::_statusLevel.
#define U201_STATUS_TIME_MS = 100
The loggerModem::_statusTime_ms.
#define U201_RESET_LEVEL = LOW
The loggerModem::_resetLevel.
#define U201_RESET_PULSE_MS = 75
The loggerModem::_resetPulse_ms.
#define U201_WAKE_LEVEL = LOW
The loggerModem::_wakeLevel.
#define U201_WAKE_PULSE_MS = 1
The loggerModem::_wakePulse_ms.
#define U201_WAKE_DELAY_MS = 0
The loggerModem::_wakeDelayTime_ms.
#define U201_ATRESPONSE_TIME_MS = 6000L
The loggerModem::_max_atresponse_time_ms.
#define U201_DISCONNECT_TIME_MS = 15000L
The loggerModem::_disconnetTime_ms.

Define documentation

#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.