First trial of LTE-M communication carrier type LPWA

LTE-M

It is popular for mobile radio communication LPWA (low power wide area) that can be purchased easily even by individuals, and can connect digital data of a relatively small capacity (for example, several hundred bytes) to a long distance by connecting to a personal computer or the like.

If you prepare multiple LPWA wireless communication devices so that they can communicate with each other, even an environmental measurement system that does not charge monthly fee can be constructed. By having one base station take over by communication carrier and paying monthly fee to this communication carrier, you can also have internet connection function and data graphing function provided. The latter LPWA has LTE-M standardized by modifying the base stations of France’s Sigfox, LoRaWAN, and recently the 4th generation mobile phone system LTE (long term evolution).

Wio LTE M1/NB1

In mid-October 2018, Solacom launched LTE-M general service, so I bought it immediately. The communication carrier is KDDI. In addition to the wireless communication board Wio LTE M1/NB1, a SIM card for LTE-M is required.

LTE-M

This wireless communication board was manufactured by Seeed Studio of Chinese enterprise, and the communication module there was BG96 of Quectel. This communication module has acquired by the Japan’s technical standard compliance system.

LTE-M

The SIM card slot and SD card slot of this wireless communication board are stacked and space saving.

LTE-M

Even when seen from the side this slot is compact. There is a Glove connector so that its own sensor can be connected.

LTE-M

The main body has an STM32F4 microcomputer, and it is possible to develop a device that transmits sensor information connected to Glove connector by LTE-M using Arduino IDE. The library necessary for development seems to be updated day by day and it is very active. When power is applied to this board, initialization will start. On my board, it took about 30 seconds to actually start communication. Since the RGB LED is mounted on this board, I tried to display the radio field strength here. I connected the portable battery and ran in Hiroshima prefecture by car, but I was surprised that we can use it with enough radio field intensity even in the mountains.

LTE-M

The program created by referring to the sample is as follows.

#include <WioCellLibforArduino.h>
#include <math.h>

#define L_EQUIP  100
#define L_MSG    100
#define T_SEND   1800
#define APN               "soracom.io"
#define USERNAME          "sora"
#define PASSWORD          "sora"
#define WEBHOOK_URL "http://beam.soracom.io:8888/lte-m/"

WioCellular Wio;

void ColorScale(double value, int *rr, int *gg, int *bb)
{ // https://qiita.com/krsak/items/94fad1d3fffa997cb651
    int r, g, b;
    double  tmp_val = cos( 4 * 3.14159 * value );
    int     col_val = (int)( ( -tmp_val / 2 + 0.5 ) * 255 );
         if ( value >= ( 4.0 / 4.0 ) ) { r = 255;     g = 0;       b = 0;       }
    else if ( value >= ( 3.0 / 4.0 ) ) { r = 255;     g = col_val; b = 0;       }
    else if ( value >= ( 2.0 / 4.0 ) ) { r = col_val; g = 255;     b = 0;       }
    else if ( value >= ( 1.0 / 4.0 ) ) { r = 0;       g = 255;     b = col_val; }
    else if ( value >= ( 0.0 / 4.0 ) ) { r = 0;       g = col_val; b = 255;     }
    else {                               r = 0;       g = 0;       b = 255;     }
    *rr = r; *gg = g; *bb = b;
    return;
}

void setup() {
  delay(200);

  SerialUSB.begin(115200);
  SerialUSB.println("Initialize.");
  Wio.Init();

  SerialUSB.println("Cellular ON.");
  Wio.PowerSupplyCellular(true);
  delay(500);

  SerialUSB.println("LED ON.");
  Wio.PowerSupplyLed(true);
  delay(500);
  Wio.LedSetRGB(1, 1, 1);

  SerialUSB.println("Turn on or reset.");
  if (!Wio.TurnOnOrReset()) {
    Wio.LedSetRGB(1, 0, 0);
    SerialUSB.println("failed.");
  }
  delay(500);
  
  SerialUSB.println("Connecting to \"" APN "\".");
  Wio.SetSelectNetwork(WioCellular::SELECT_NETWORK_MODE_MANUAL_IMSI);
  if (!Wio.Activate(APN, USERNAME, PASSWORD)) {
    Wio.LedSetRGB(1, 0, 0);
    SerialUSB.println("failed.");
  }

  char imei[L_EQUIP]; 
  SerialUSB.print("IMEI: ");
  if (Wio.GetIMEI(imei, L_EQUIP)) SerialUSB.println(imei);
  else                            SerialUSB.println("IMEI read error");

  char imsi[L_EQUIP];
  SerialUSB.print("IMSI: ");
  if (Wio.GetIMSI(imsi, L_EQUIP)) SerialUSB.println(imsi);
  else                            SerialUSB.println("IMSI read error");
}

void loop() {
  static int count=T_SEND;
  int rssi = Wio.GetReceivedSignalStrength();
  char msg[L_MSG];
  sprintf(msg, "Time left: %4d  RSSI: %d dBm", count, rssi);
  SerialUSB.println(msg);
  if (rssi == -999) Wio.LedSetRGB(0, 0, 1);
  else {
    int rr, gg, bb;
    ColorScale((rssi+109)/(109.-53.), &rr, &gg, &bb);
    int r = int (rr/25.5+0.5);
    int g = int (gg/25.5+0.5);
    int b = int (bb/25.5+0.5);
    Wio.LedSetRGB(r, g, b);
  }
  count --;
  if (count == 0) {
    Wio.LedSetRGB(0, 0, 0);
    SerialUSB.println(WEBHOOK_URL);
    char data[150];
    sprintf(data, "{\"rssi\":\"%d\",\"uptime\":\"%lu\"}", rssi, millis() / 1000);
    SerialUSB.print("Post: "); SerialUSB.print(data); SerialUSB.println("");
    int status=0;
    if (!Wio.HttpPost(WEBHOOK_URL, data, &status)) {
      SerialUSB.println("Post failed.");
    } else {
      SerialUSB.print("Status:"); SerialUSB.println(status);
    }
    count = T_SEND;
  }
  delay(2000);
}

In addition, this board also comes with a LiPo battery management IC, it is also convenient to charge.

LTE-M

LTE-M Button

Later, LTE-M Button was released. It distinguishes three types of information, button pressed information, long pressed information, and double clicked information, and uploads it to the cloud together with the remaining battery power. My Wio LTE M1 / NB1 takes about 30 seconds to connect, but this LTE-M completes data transmission in around 5 seconds.

LTE-M

Following the explanation, I tried the method to show the way to push the three kinds of buttons on slack and it went well. For the first time, I used Amazon AWS properly.

LTE-M

I compared using Wio LTE M1/NB1 and LTE-M Button compared, but I felt that Wio LTE M1/NB1 is more fun to do various things.

Published on 27th November 2018