Please check my recent blog post for a step-by-step explanation how the RAK8212 can be used for prototyping IoT use cases - using the "Digital Twin" representation in AWS IoT Core
Unfortunately, this article is too big to fit into this forum conversation, so you can start reading here, but have to go to my wordpress blog article to read the full story.
You need a fast, simple and inexpensive way to prototype your IoT use cases?
This article describes how you can achieve this using
The RAK8212 device with its built-in Quectel BG96 communication module
Espruino: A JavaScript interpreter for microcontrollers
Narrowband IoT (NB-IoT): A Low Power Wide Area Network (LPWAN) radio technology standard
AWS IoT Core and Device Shadow Service ("Digital Twin")
In this example, the RAK8212 device is used as a sensor that periodically sends temperature values to its digital twin in AWS IoT Core. For communication with AWS it uses the MQTT protocol over Narrowband IoT (NB-Iot). The state of a LED on the RAK8212 can be controlled by setting it on the digital twin in AWS IoT.
##Setting up the "thing" in AWS Iot Core
Get yourself an account on AWS, navigate to “AWS IoT” and “Create a single thing”. Describing all the steps would go too far in this article, and AWS has good online documentation. So please follow the steps given in the AWS documentation.
In the end, you should have an IoT object (=thing), identified by a name, and a certificate for this object (e.g. 133c075337.cert.pem), a public key (e.g. 133c075337.public.key) and a private key (e.g. 133c075337.private.key). You need to download these three files and activate the certificate.
In the navigation menu of the AWS console, go to “Manage -> Things” and you will see all your things. Select the thing of your choice and, in the navigation menu of the thing, go to “interact”. Note the server address displayed as “Update your Thing Shadow using this Rest API Endpoint”. We will use this as the address of the MQTT server later.
Example Address:a136ivuau4uklv-ats.iot.eu-central-1.amazonaws.com
Also notice the MQTT topics below. They all contain the name of your thing:
Example MQTT Topic:$aws/things/klenk-iot-device/shadow/update
This shows that the name of my thing is “klenk-iot-device”.
##Setting up the example code for RAK8212
The example code is hosted at github:
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
Tips:
Create headers by underlining text with ==== or ----
To *italicise* text put one asterisk each side of the word
To **bold** text put two asterisks each side of the word
Embed images by entering: ![](https://www.google.co.uk/images/srpr/logo4w.png) That's the hard one: exclamation, square brackets and then the URL to the image in brackets.
* Create lists by starting lines with asterisks
1. Create numbered lists by starting lines with a number and a dot
> Quote text by starting lines with >
Mention another user by @username
For syntax highlighting, surround the code block with three backticks:
```
Your code goes here
```
Just like Github, a blank line must precede a code block.
If you upload more than 5 files we will display all attachments as thumbnails.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Please check my recent blog post for a step-by-step explanation how the RAK8212 can be used for prototyping IoT use cases - using the "Digital Twin" representation in AWS IoT Core
https://wolfgangklenk.wordpress.com/2019/04/06/espruino-on-rak8212-create-a-digital-twin-in-aws-iot/
Unfortunately, this article is too big to fit into this forum conversation, so you can start reading here, but have to go to my wordpress blog article to read the full story.
You need a fast, simple and inexpensive way to prototype your IoT use cases?
This article describes how you can achieve this using
In this example, the RAK8212 device is used as a sensor that periodically sends temperature values to its digital twin in AWS IoT Core. For communication with AWS it uses the MQTT protocol over Narrowband IoT (NB-Iot). The state of a LED on the RAK8212 can be controlled by setting it on the digital twin in AWS IoT.
##Setting up the "thing" in AWS Iot Core
Get yourself an account on AWS, navigate to “AWS IoT” and “Create a single thing”. Describing all the steps would go too far in this article, and AWS has good online documentation. So please follow the steps given in the AWS documentation.
In the end, you should have an IoT object (=thing), identified by a name, and a certificate for this object (e.g. 133c075337.cert.pem), a public key (e.g. 133c075337.public.key) and a private key (e.g. 133c075337.private.key). You need to download these three files and activate the certificate.
In the navigation menu of the AWS console, go to “Manage -> Things” and you will see all your things. Select the thing of your choice and, in the navigation menu of the thing, go to “interact”. Note the server address displayed as “Update your Thing Shadow using this Rest API Endpoint”. We will use this as the address of the MQTT server later.
Example Address: a136ivuau4uklv-ats.iot.eu-central-1.amazonaws.com
Also notice the MQTT topics below. They all contain the name of your thing:
Example MQTT Topic: $aws/things/klenk-iot-device/shadow/update
This shows that the name of my thing is “klenk-iot-device”.
##Setting up the example code for RAK8212
The example code is hosted at github:
https://github.com/wklenk/rak8212-espruino-nb-iot/blob/master/data-logger-bg96-mqtt.js
Find the JavaScript object that holds the configuration for the NB-IoT radio network connection, e.g.
Adapt this to fit to your NB-IoT network of choice.
Find the JavaScript object that holds the configuration for the MQTT connection to AWS IoT:
Adapt the MQTT server (same as address of API endpoint noted down above) and client_id (name of the thing).
Please go on reading at https://wolfgangklenk.wordpress.com/2019/04/06/espruino-on-rak8212-create-a-digital-twin-in-aws-iot/