Difference between revisions of "Sim7020"

From RevSpace
Jump to navigation Jump to search
(References)
(What)
(12 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
== What ==
 
== What ==
This page is about the SIM7020 NB-IOT module.
+
This page is about the SIM7020 module and using it to send data through the NB-IOT network
  
I plan to experiment with this kind of network connectivity for perhaps a bat activity monitor or air quality monitoring.
+
I want to experiment with this kind of network connectivity for either a bat activity monitor or air quality monitoring (particulate matter).
 +
Use the [https://portal.iotcreators.com/ iotcreators] portal.
  
Update: this escalated quickly ... the NB-IOT stuff at t-mobile already seems dead:
+
Status:
Chromium complained about an expired certificate for the https website, otherwise seems down (error 503).
+
* I can send data from the SIM7020 to the network
 +
* I can receive the data from the network in my Java application, using the webhook
  
wget says:
+
Next steps:
<pre>
+
* find an Arduino library for this
bertrik@zenbook:~$ wget http://portal.iot.t-mobile.nl/
+
** what things need to be configured? put these in EEPROM?
--2021-01-23 19:01:06--  http://portal.iot.t-mobile.nl/
+
* think about encoding data
Resolving portal.iot.t-mobile.nl (portal.iot.t-mobile.nl)... 52.57.78.255
+
* start sending data!
Connecting to portal.iot.t-mobile.nl (portal.iot.t-mobile.nl)|52.57.78.255|:80... connected.
 
HTTP request sent, awaiting response... 503 Service Unavailable: Back-end server is at capacity
 
2021-01-23 19:01:06 ERROR 503: Service Unavailable: Back-end server is at capacity.
 
 
 
bertrik@zenbook:~$ wget https://portal.iot.t-mobile.nl/
 
--2021-01-23 19:02:35--  https://portal.iot.t-mobile.nl/
 
Resolving portal.iot.t-mobile.nl (portal.iot.t-mobile.nl)... 52.57.78.255
 
Connecting to portal.iot.t-mobile.nl (portal.iot.t-mobile.nl)|52.57.78.255|:443... connected.
 
ERROR: The certificate of ‘portal.iot.t-mobile.nl’ is not trusted.
 
ERROR: The certificate of ‘portal.iot.t-mobile.nl’ has expired.
 
The certificate has expired
 
</pre>
 
  
 
== Hardware ==
 
== Hardware ==
Line 74: Line 64:
  
 
== Software ==
 
== Software ==
 +
 +
=== Network setup ===
 +
See:
 +
* https://docs.iotcreators.com/docs/general-settings for general network settings
 +
* https://docs.iotcreators.com/docs/_-2-attach-to-nb-iot-network for specific AT-commands
 +
 +
Things that need to be configured for the network and the backend:
 +
* network: band (8), operator (20416), APN (cdp.iot.t-mobile.nl)
 +
* backend: UDP server ip (172.27.131.100) and port (15683)
  
 
=== Receiving data from the device ===
 
=== Receiving data from the device ===
First of all, a comparison to how things work with TheThingsNetwork:
+
I'm using the so-called 'custom integration', which is based on a [https://en.wikipedia.org/wiki/Webhook web-hook]
 +
This means that I have configured an URL in the iotcreators dashboard.
 +
 
 +
When a message from my node comes in, the CDP sends a HTTP POST containing a JSON message to that specific URL and port.
 +
The URL is a server under my control that has an HTTP REST-JSON service running and can process it further.
 +
 
 +
This is a bit different from how (for example) TheThingsNetwork works:
 
* TTN publishes incoming data using MQTT
 
* 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.
 
* 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.
 
* 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.
 
* 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:
+
Incoming data received by HTTP POST looks like this:
* You configure an "endpoint" and t-mobile pushes data towards that
+
<pre>
* 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.
+
  "reports": [
 +
    {
 +
      "serialNumber": "IMEI:868333030676163",
 +
      "timestamp": 1615660679246,
 +
      "subscriptionId": "06f872fc-02b3-4b20-8394-3f19a7006ca9",
 +
      "resourcePath": "uplinkMsg/0/data",
 +
      "value": "01a3021c"
 +
    }
 +
  ],
 +
  "registrations": [],
 +
  "deregistrations": [],
 +
  "updates": [],
 +
  "expirations": [],
 +
  "responses": []
 +
}
 +
</pre>
 +
 
 +
Data messages always have one report, with resourcepath set to "uplinkMsg/0/data".
 +
 
 +
=== 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 ==
 
== References ==
Line 92: Line 117:
  
 
* Ordered a SIM7020 and a starter kit, see https://www.hackster.io/voske65/arduino-nb-iot-with-sim7020-and-t-mobile-027f8f
 
* Ordered a SIM7020 and a starter kit, see https://www.hackster.io/voske65/arduino-nb-iot-with-sim7020-and-t-mobile-027f8f
 +
* Regional settings for the network: https://docs.iotcreators.com/docs/general-settings
 
* t-mobile IOT configuration page: https://portal.iotcreators.com/ ?
 
* t-mobile IOT configuration page: https://portal.iotcreators.com/ ?

Revision as of 14:47, 2 May 2021

Project Sim7020
Sim7020.png
SIM7020 NB-IOT modem
Status In progress
Contact bertrik
Last Update 2021-05-02

What

This page is about the SIM7020 module and using it to send data through the NB-IOT network

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

Status:

  • I can send data from the SIM7020 to the network
  • I can receive the data from the network in my Java application, using the webhook

Next steps:

  • find an Arduino library for this
    • what things need to be configured? put these in EEPROM?
  • think about encoding data
  • start sending data!

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

Network setup

See:

Things that need to be configured for the network and the backend:

  • network: band (8), operator (20416), APN (cdp.iot.t-mobile.nl)
  • backend: UDP server ip (172.27.131.100) and port (15683)

Receiving data from the device

I'm using the so-called 'custom integration', which is based on a web-hook This means that I have configured an URL in the iotcreators dashboard.

When a message from my node comes in, the CDP sends a HTTP POST containing a JSON message to that specific URL and port. The URL is a server under my control that has an HTTP REST-JSON service running and can process it further.

This is a bit different from how (for example) TheThingsNetwork works:

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

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": []
}

Data messages always have one report, with resourcepath set to "uplinkMsg/0/data".

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: