Starting up with IoT using MKR NB 1500

I have the following:

  • MKR NB 1500 with antenna and some shield cards
  • I have SIM cards
  • I have found the CIMI and CGSN numbers og the card
  • I have downloaded software, reading data from the shield cards
  • I have downloaded the main test code sending dummy temp, humidity, latlng to MIC
  • I have made an account for manageing the MIC and have made a Thing Type under a Domain
    Now I need a detailed tutorial to connect the signals from MKR to the MIC and see the data comming in to a Dashboard.

I have visited this web page:

and found a fairly good description of how to connect the MKR NB 1500 to the MIC,
however, Login to the MIC I do not recognise the MIC setup with the tutorial description.

Can anybody give me a helping hand?

Kind regards
Nils Kr.

Hi @nils.rossing - welcome to the forum and absolutely we can help you out :slight_smile:

With regards to the linked tutorial, which workshops have you completed? From your post it sounds like Workshop 1 & 2; have you been able to create a Thing? (Create Thing - Managed IoT Cloud Workshops)

Cheers
Rob

(P.S I moved this to our Arduino category)

Hi Robert and thanks for answering so fast

I have done workshop 1 and 2 and I have deklared a ThingType. Now I am going to define a Thing.

The problem is that I see another outline when I am trying to define a Thing, than what is shown in the workshop. When I am loging on it seems that I am joining the Domain that is defined by Marintek NTNU (which is OK, since my project is a connected to this Domain). I have defined a ThingType I call Sensornode-T1. When I shall declare a Thing. This is what I am seeing:


As you probably can see there is no way to put in the CIMI and CGSN numbers,
so what have I do to get the correct form?

Nils Kr.

Hi @nils.rossing

Which MIC environment are you using? (If you’d rather keep that private please DM me)

and confirming your intention is to use CoAP (not MQTT)?

Cheers

Hi Robert

My intention was probably to use CaAP since I have installed the library arduino-dev-kit-coap-master. For some weeks ago I started on a tutorial describing the use of MKR NB 1500 waiting for the SIM-cards to come, but when I continued the work in February I was not able to get back to that tutorial. So the answer is Yes, I am trying to use CaAP. However I’m not at all sure if this is a smart choice for my application.

Nils Kr.

@nils.rossing ahh! You were looking for an old tutorial? Well the good news is they are still there and we can point you to the right place, but also I am currently rewriting them :slight_smile: (hence they are hidden!)

Are you using one of our demo instances? https://demonorway.mic.telenorconnexion.com for example? I ask as each instance can be configured differently and that might explain the issues you have (It will also allow me to look for any other issues)

Regarding if CoAP is the best for your use case, please feel free to explain your needs and I’ll do my best to explain the pro’s and con’s of each solution to help you make the decision

Cheers
Rob

Many thanks Robert

Yes, thats correct I probably have used an old tutorial

Yes, I am using this portal: Telenor Connexion

It is Marintek at NTNU in Trondheim who has challenged me to create a teaching plan for students in upper secondary school. I work at the Department of Physics, NTNU and have worked with Arduino for several years, but IoT using MKR NB 1500 MIC is new to me (I have used ESP32 and WiFi). Marintek wants to let high school students make electronics and sensors for installation in homemade sea buoys and drop them near the coastline. The idea is that they will collect and analyze data as part of the teaching. The first step is to study the concept that is my job, then hold a teacher training course and then the teacher hopfully will implement the teaching plan in their own classes. The current subject is Technology and research theory (Teknologi og forskningslære). So that’s the background.
Our need is therefor primarily to collect sensor data and transfer them to the database for further analysis.

For this reason I am now making a teacher guide for a future teacher course. So I am very interested to get an robust tutorial. I also have to have a good understanding of what is happening.

I hope this gives you an idea of the project.

Kind regards
Nils Kr.

Hi @nils.rossing

That’s really awesome! We run start IoT specifically to educate and inspire others and this is an initiative I can really get behind and am super happy to support! Please keep us updated with progress - your students are always welcome to join the forum here and any feedback you have for our content (or anything you’d like to see) we’d love to hear how to make it better.

Having said that I dropped you a DM with some specific tutorials for your situation. For the greater audience who may see this post we are rewriting our entire documents and tutorials - due to the legacy version being out of of date in some places and focused on Norway rather than the Nordics. If you have a need to view those tutorials please reach out, but bare in mind the limitations I mentioned here and also that they will be replaced!

Regarding your issue creating a thing, I’ll take a closer look when I’m back at my desk later tonight, I have enough info to debug now.

As to the use case, and CoAP vs MQTT etc, as always “it depends” :sweat_smile: - mostly it depends on what your end goal is. If your focus is on the system engineering, and you don’t want the IoT details to get in the way, CoAP, especially on thr NB 1500, is your best bet. MQTT is possible, but it has many downsides - higher overheads, higher power consumption and most off all much more complex (on the NB 1500 you will offload the MQTT work to the modem itself and that brings a whole world of work!) - of course MQTT has its benefits as well but reading between the lines on your description CoAP will give you the best bang-for-buck and time invested. Students who have the interest can of course go further and dive down the MQTT rabbit hole!

On that note, as you have already selected the NB1500, we have seen some issues getting stock lately so a heads up to ensure you have enough hardware! Also the SARA R4 on the NB 1500 is mostly not supported by UBlox now so please bare that in mind for the longevity of the program (Arduino have released the Portenta as an almost-replacement!)

Hi @nils.rossing

am tracing the issue you have but can’t replicate your screenshot i’m afraid; im trying a few different things and will keep looking, but generally the process is

  1. login with your user to https://demonorway.mic.telenorconnexion.com
  2. in the left column choose “Sensornode-T1”
    image
  3. in the top right, choose “+ THINGS”
  4. Deselect “Create Batch”


    you should now have the ability to fill in the details - the last screenshot seems to disagree with what you see (i have the “Network integration” drop down, which when selecting NB-IoT allows you to fill in the IMSI/IMEI)

I have created a standalone user in your domain, but still have not been able to replicate the issue

whilst i continue to debug can you

  1. confirm the MIC instance you are using is demonorway.mic.telenorconnexion.com
  2. I saw that there are a few thing types in the account, does this issue happen for all thing types or just this one?

Hi

Thanks for your advise Robert

I am a littlebit busy this evening, but give me some time and I will work my way through your description and give you feedback. Perhaps the problem is so simple that the interface have been changed from the old description I used for a couple of weeks ago.

Nils Kr.

@nils.rossing no worries, report back when you can; there hasn’t been a change that I know about in that UI recently. We use that interface in that instance fairly regularly along with a LOT of other users and we have not heard of anyone else reporting that issue unfortunately

It’s very possible you’ve stumbled upon a corner case bug, so it would be great to see if it can be reproduced and the steps required

Hi Robert

I have now followed your description, and all seems to work OK. I get the screen shot I sent you earlier when I turn off the Batch switch. The key is to choose “Network integration” than I can choose between MQTT/TLS and Telenor IoT Gateway.

As a teacher I had to document and substantiate every choice I do. So if there is a internet page that explain every choice alond this path, I would be happy to know.

Here is the answer to your questions:

  1. Yes I am using demonorway.mic.telenorconnexion.com
  2. Tuva gave me this account and as you can see there are defined some other Thing types. As far as I can see this is Thing typs defined by other teachers using this account (Domain) earlier. As you can see the Domain is ntnumarinteknikk, which probably also was defined when this project was started up. When Tuva gave me the account I told her that what I am doing is a part of the same project here at NTNU. KVT is a upper secondary school near Trondheim (Norway). I hope this was clear.

The next step now is to connect the circuits, upload the program and see if I get a response in MIC. First of all, I will use the program main.ino that I have downloaded from github. I have also changed a parameter in the header file so that it should be adapted to the use of NB IoT.

More questions will probably follow later.

Kind regards
Nils Kr.

Hi

I have followed the description in this tutorial:

I have done the workshop WS1 – 3
I have loaded up the suggested program (WS4) and specified the uplink Transform (WS5).
I have also the old main()-program and the old uplink transform available, from the earlier tutorial
So this is what happens:

  • New program and new uplink transform:
    The MKR NB 1500 connects, but there are no signals coming to MIC

  • Old program (main()) and new uplink transform:
    The MKR NB 1500 connects, signals are coming to MIC, but the presentation in MIC is not as expected:

  • New program and old uplink transform:
    The MKR NB 1500 connects, but there are no signals coming to MIC

Question: Is there anything I can do to get the new program and the new uplink transform up and run?

A couple of more questions:

  • Is there any tutorial explaining how to set up the widgets in the panel?
  • Is there a description how to write the uplink transform when I am changing the signals from the measurement?

Kind regards
Nils Kr. Rossing

hi @nils.rossing - great questions, lets see how I can help!

regarding the workshops you link to, I have not reviewed them and they are old now. After a quick skim over them, i see some things that don’t quite look right (though, to be clear here, I would need to test). Those workshops are 3 years old now, so I would not advise using them.

I know you have used the “Arduino MKR NB1500 - CoAP” tutorial, this is really the best resource right now

I suspect the issue you are having is that the payload coming from the arduino doesn’t match the uplink transform. Devices connecting to IoT GW typically have a protocol they speak to send data to the cloud, and these can often be proprietary and specific to that device vendor; on the other hand IoT Cloud (formerly called MIC), uses JSON and so we need a way to convert the incoming protocol to JSON data, and that’s what the Uplink transform does. The uplink transform is built on the JS library binary-parser - in the “Arduino MKR NB1500 - CoAP” tutorial, the Arduino is sending JSON already, so the uplink transform just passes it on the MIC which can process it. If you were not sending JSON already from the device you would need to do some work to unpack the incoming data and rebuild it a JSON Object.

if you are using the “Arduino MKR NB1500 - CoAP” tutorial and having issues, then we can look specifically into those issues (please see DM for more details :slight_smile: )

There is a tutorial coming, unfortunately I don’t have a timeline just now, however in the meantime you can read more about transforms here: Device Communication IoTGW - Managed IoT Cloud and also the binary-parser library here: GitHub - keichi/binary-parser: A blazing-fast declarative parser builder for binary data and we can continue the discussion here.

Uplink (and downlink) transforms are some of the more complex parts to work with I’m afraid.

regarding setting up widgets in the AppBoard, yes we will build a tutorial for that (I have a lot of work to do with tutorial) - again, there is some documentation here: User Guide MIC App Board - Managed IoT Cloud and again, if you have questions we can continue them here

any questions you ask here will probably find their way to a tutorial!

Hi

Here are some experiences and questions from testing:

  1. Referring to the main.ino file. I have included one more signal to the send package, like this:
float pres = 980.00 + random(0, 19); // Declaring a variables holding the air pressure value
…

uint32_t buf_size = snprintf(buffer, 100, "{\"tmp\":%.2f,\"hum\":%.2f,\"pres\":%.2f,\"latlng\":\"59.898812,10.827212\"}", tmp, hum, pres);

…

I expect to find one more parameter in the Resource list when defining a new widget, butt hat does not happen. The buf_size is still below 100 (70). Are there anything I have forgotten to do?

  1. How can I specify colour intervals in the widgets when displaying Gauge?
    image

When specifying intervals like this, the scale of the Gauge display disappear.
What is the correct way of specifying the intervals?

  1. What is the correct way of specifying the latitude and the longitude variables in the buffer string, like the one shown above?

Kind regards
Nils Kr.

Hi @nils.rossing

  1. I can see Pres as a resource for SensorNodeT1 and have created a widget for you in the default view
    image

  2. I have added a gauge widget with colors - have a look at the configuration, hopefully that makes sens; it is important after you modify a dashboard or widget, that you press “save”, otherwise the config will be lost
    image
    image

  3. sorry! didn’t quite understand the question :confused:

/Rob

Hi

  1. Lucky you:-) I can not se the resourse “Pres”. This is what I see:

  2. I have two float variables latitude and longitude, both are needed to make a position on the map. So how is the syntax in the Arduino program. Is it like this:
    uint32_t buf_size = snprintf(buffer, 100, “{“tmp”:%.2f,“hum”:%.2f,“pres”:%.2f,“latlng”:%.2f, %.2f}”, tmp, hum, pres, latitude, longitude);

I am using Chrome should I use an other browser?

Nils Kr.

And her is comments on questions no. 2

  1. Her I am specifying this:
    image

And this is what I am seeing, and I am saving:

Nils Kr.

This is strange,

is it possible “Pres” is just off screen? if i resize my browser window, then I have to scroll down to find the “Pres” resource
image

if you go to settings → thing types → sensornode-t1 → resources, you should see the Pres resource is there

ahh! MIC wants to see a resource called “latlng” in the root of the JSON which has a comma-separated latitude and longitude (which it will then recognize as a “geopoint” as you can see in the screen shot above) - so it the way you are doing it now should be ok; you can always combine the latitude and longitude values to a single before building the payload if that makes it clearer - but looking at MIC, it appears to be working as is

i use chrome as well, so no worries there