Sim7020

From RevSpace
Revision as of 16:51, 18 March 2021 by Bertrik Sikken (talk | contribs) (Receiving data from the device)
Jump to navigation Jump to search
Project Sim7020
Sim7020.png
SIM7020 NB-IOT modem
Status In progress
Contact bertrik
Last Update 2021-03-18

What

This page is about the SIM7020 NB-IOT module.

I want to experiment with this kind of network connectivity for either a bat activity monitor or air quality monitoring (particulate matter).

The t-mobile portal at http://portal.iot.t-mobile.nl is dead. Use the iotcreators portal.

Hardware

I wired it up like this:

Connections
SIM7020 USB serial Remark
G nc looped to SIM7020-K
R TXD
T RXD
K nc looped to SIM7020-G
V 3V3
G GND
S DTR

Software

Receiving data from the device

First of all, a comparison to how things work with TheThingsNetwork:

  • TTN publishes incoming data using MQTT
  • MQTT is a light-weight publish-subscribe framework that decouples producers of data from consumers of data. So for example you can easily have one producer (the node) and several consumers, for example a logger, a data handler, or even a 3rd party that does its own thing with the data.
  • TTN runs its own MQTT server, so you don't have to. There's no need for setting up your own server, with a public facing ip address, a firewall, security policies, etc.
  • MQTT distinguishes different types of message by different "topics", you can only access topics you are authorised to (your own). So for example, you can easily authorise someone to see device messages, but not allow device registration access.

In my opinion, a very good match to the nature of the messages in such a network.

NB-IOT uses a different approach, I think this is called a web-hook:

  • In the t-mobile dashboard you configure an "endpoint". When data comes in, t-mobile pushes data towards that using a HTTP POST.
  • The endpoint is your own server that has to be ready to ready to receive incoming data. You have to manage this server yourself w.r.t. security. If you want other parties to use the data, you'll also have to come up with your own solution to that.

So, not as smart as TTN does it, but still very powerful.

How I'm making this work:

  • I have a service running on a specific port on a VPS, with a Java REST API behind it (based on jersey)
  • I enter the URL of the service, including the port, into the iotcreators dashboard.

If the service is not actively running at that time, this will trigger an error message in the dashboard, but the URL is still accepted.

Incoming data received by HTTP POST looks like this:

{
  "reports": [
    {
      "serialNumber": "IMEI:868333030676163",
      "timestamp": 1615660679246,
      "subscriptionId": "06f872fc-02b3-4b20-8394-3f19a7006ca9",
      "resourcePath": "uplinkMsg/0/data",
      "value": "01a3021c"
    }
  ],
  "registrations": [],
  "deregistrations": [],
  "updates": [],
  "expirations": [],
  "responses": []
}

Support in my LoraLuftdatenForwarder

I've added preliminary support for this, see: https://github.com/bertrik/LoraLuftdatenForwarder/tree/nbiot/LoraLuftdatenForwarder/src/main/java/nl/bertriksikken/nbiot

References

I followed roughly this guide: