ubee

Overview

Passthrough

With the passthrough sketch you can send AT commands (NB-IoT) to the ublox module on the ubee.

Follow the steps on the Mbili or Autonomo support pages to install the required board files.

This example doesn’t require any additional libraries. Simply plug the bee into your Mbili or Autonomo and upload the example code.

/*
 * SODAQ UBEE - Serial Passthrough
 * 
 * This sketch is tested with the UBEE with the N2 and the R4 module in combination with a SODAQ Autonomo and SODAQ Mbili
 * The UBEE will work on every board with a (x)bee pinout.
 * The Mbili does not wok with the R4 module, it can't handle the fast baudrate.
 * 
 * If you have questions about this sketch you can ask them on forum.sodaq.com
 */
#include <Arduino.h>

// #define R4XX // Uncomment when you use the ublox R4XX module

#if defined(ARDUINO_SODAQ_AUTONOMO)
/* SODAQ AUTONOMO + SODAQ (uBlox SARA) UBee */
#define DEBUG_STREAM SerialUSB
#define MODEM_STREAM Serial1
#define powerPin BEE_VCC
#define enablePin BEEDTR
#define powerTogglePin BEERTS

#elif defined(ARDUINO_AVR_SODAQ_MBILI)
/* SODAQ MBILI + SODAQ (uBlox SARA) UBee */
#define DEBUG_STREAM Serial
#define MODEM_STREAM Serial1
#define powerPin 20
#define enablePin BEEDTR
#define powerTogglePin BEERTS

#else
#error "Please use one of the listed boards or add your board."
#endif

#ifdef R4XX
unsigned long baud = 115200;  //start at 115200 allow the USB port to change the Baudrate
#else 
unsigned long baud = 9600;  //start at 9600 allow the USB port to change the Baudrate
#endif

void setup() 
{
#ifdef powerPin
  // Turn the nb-iot module on
  pinMode(powerPin, OUTPUT); 
  digitalWrite(powerPin, HIGH);
#endif

#ifdef enablePin
  // Set state to active
  pinMode(enablePin, OUTPUT);
  digitalWrite(enablePin, HIGH);
#endif // enablePin

#ifdef R4XX
    // The R4XX module has an on/off pin. 
    // You can toggle this pin or keep it low to switch on the module.
    pinMode(powerTogglePin, OUTPUT);
    digitalWrite(powerTogglePin, LOW);
#endif

  delay(100);

  // Start communication
  DEBUG_STREAM.begin(baud);
  MODEM_STREAM.begin(baud);

  delay(1000);
}

// Forward every message to the other serial
void loop() 
{
  while (DEBUG_STREAM.available())
  {
    MODEM_STREAM.write(DEBUG_STREAM.read());
  }

  while (MODEM_STREAM.available())
  {     
    DEBUG_STREAM.write(MODEM_STREAM.read());
  }
}

*For the R412, U201 a battery is required.

Library

Click on Sketch > Include Libraries > Manage Libraries…

Search for Sodaq_nbIOT or Sodaq_3Gbee(2G/GPRS and 3G) depending on your module.
Click on the bar to show the install button and install the library.

Click on File > Examples > [library name] to see more example codes.

Schematics

Revision 1

sodaq_ubee