BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Example code or tutorials for Arduino MKRNB 1500

I am attempting to learn how to use the Arduino MKR NB 1500 board using a
hologram SIM and the example code provided in the Blynk library for arduino v0.6.1
found on Arduino IDE v 1.8.13 at File>examples>Blynk>oardsGSM>Arduino_MKRNB
This code was only changed to add my Blynk token in place of the placeholder
before uploaded to the MKRNB 1500
The serial output is below.

20:52:50.254 -> [7360] Connecting to …
20:52:51.789 -> [8884] Connected to GPRS
20:52:51.789 -> [8884] Connecting to blynk-cloud.com:80
20:52:53.589 -> [10701] Redirecting to 45.55.96.146:80

pasting 45.55.96.146:80 into browser takes you to Blynk homepage
So I suppose this is a success since the code doesn’t really as for any action/response,
nor can I find anywhere what response to expect from this example.

It seems example code for this board is still scarce, or am I just looking in the wrong place?

When I try to use;
https://examples.blynk.cc/?board=Arduino%20MKR1000&shield=Arduino
%20WiFi%20Shield%20101&example=GettingStarted%2FBlynkBlink
The boards drop down doesn’t list the MKR NB 1500 as an option,
only the MKR1000,
and the Connection drop down doesn’t
mention Ublox, the NB IoT/CatM1 module on the MKR NB 1500.

My project goal is to use MKR NB1500 and Blynk to send a few characters from an arduino
in the landscape via NBIoT or CatM1 to Blynk and onward to the Blynk phone app as an alarm
and also send a few characters from the phone or use a switch widget to trigger a state change on the arduino.

Any suggestions or comments gratefully received, thank you.
Cheers
Vere

The “redirecting” message is happening because initially the SIM’s ISP is resolving a different Blynk cloud server to the one which contains your project. It’s not an issue, but you could specify the correct IP in your Blynk connection command if you wish.

That’s normal behaviour, as the Blynk cloud servers don’t have a web interface to display any data via a browser.

The differences between the various Blynk examples for different boards are really only about the included libraries, connection process and pins available. As you have a working example for your board it’s simply a case of leaving that code in place then adding-in the additional functionality that you require.

Pete.

Thank you very much for your response. I will put some more detail in a reply to my own post.

After posting last night I can the sketch on more time and got the following serial output.
"22:04:30.082 -> [7159] Connecting to …
22:04:31.572 -> [8683] Connected to GPRS
22:04:31.572 -> [8684] Connecting to blynk-cloud.com:80
22:04:33.398 -> [10505] Redirecting to 45.55.96.146:80
22:04:35.054 -> [12131] Connecting to 45.55.96.146:80
22:04:36.970 -> [14077] Ready (ping: 1154ms). "

presumably this is a more complete response, unfortunately this has only occurred randomly once out of 6-7 attempts. Also I only get one response after uploading the code. I have tried resetting the arduino or closing and opening the serial window and don’t get a response. This may be normal but I can’t understand why uploading seems to be required before getting anything via serial.
Again any suggestions for nest steps / further testing would be most welcome.
Cheers
Vere

I’d suggest that you change this line of your sketch…

  Blynk.begin(auth, nbAccess, gprs, client , pin);

to this…

  Blynk.begin(auth, nbAccess, gprs, client , pin, IPAddress(45,55,96,146), 8080);

This will force the connection to use Blynk’s New York server (IP address 45.55.96.146) which is where your project lives.
It will also force the use of port 8080 instead of port 80, which is less likely to be blocked by your GPRS ISP.

Depending on which version of the Arduino IDE you are using, the serial monitor may need top be closed then re-opened when you restart the board. by the time you’ve done this you may be missing some of the serial output.
If you look at the title bar of the app you should be able to see the online status of your device. If it’s connected successfully it will be online.

Pete.

Got this error message;
Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: “Arduino MKR NB 1500”

C:\Users\61419\Documents\Arduino\Arduino_MKRNBVN\Arduino_MKRNBVN.ino: In function ‘void setup()’:

Arduino_MKRNBVN:43:50: error: invalid user-defined conversion from ‘IPAddress’ to ‘const char*’ [-fpermissive]

Blynk.begin(auth, nbAccess, gprs, client , pin, IPAddress(45,55,96,146), 8080);

                                              ^~~~~~~~~~~~~~~~~~~~~~~

In file included from C:\Users\61419\Documents\Arduino\libraries\MKRNB\src/GPRS.h:23:0,

             from C:\Users\61419\Documents\Arduino\libraries\MKRNB\src/MKRNB.h:25,

             from C:\Users\61419\Documents\Arduino\Arduino_MKRNBVN\Arduino_MKRNBVN.ino:25:

C:\Users\61419\Documents\ArduinoData\packages\arduino\hardware\samd\1.8.8\cores\arduino/IPAddress.h:54:5: note: candidate is: IPAddress::operator uint32_t() const

 operator uint32_t() const { return _address.dword; };

 ^~~~~~~~

C:\Users\61419\Documents\ArduinoData\packages\arduino\hardware\samd\1.8.8\cores\arduino/IPAddress.h:54:5: note: no known conversion from ‘uint32_t {aka long unsigned int}’ to ‘const char*’

In file included from C:\Users\61419\Documents\Arduino\libraries\Blynk\src/BlynkSimpleMKRNB.h:18:0,

             from C:\Users\61419\Documents\Arduino\Arduino_MKRNBVN\Arduino_MKRNBVN.ino:26:

C:\Users\61419\Documents\Arduino\libraries\Blynk\src/Adapters/BlynkArduinoNB.h:74:10: note: initializing argument 6 of ‘void BlynkSIM::begin(const char*, NB&, GPRS&, NBClient&, const char*, const char*, uint16_t)’

 void begin(const char* auth,

      ^~~~~

exit status 1

invalid user-defined conversion from ‘IPAddress’ to ‘const char*’ [-fpermissive]

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

Okay, what happens if you try this instead…

Blynk.begin(auth, nbAccess, gprs, client , pin, "45.55.96.146", 8080);

Pete.

Serial output says;
"21:41:55.094 -> [7460] Connecting to …
21:41:56.641 -> [8984] Connected to GPRS
21:41:56.641 -> [8984] Connecting to 45.55.96.146:8080
21:41:58.800 -> [11179] Ready (ping: 1201ms). "

I am going to run it a couple of times to see what the reliability is like

just got the ping line 3 times out of 3 attempts.

I can’t see where this code requests that so should I be reading the MKRNB library to try and understand where these functions are coming from?
Thank you very much for your help this evening, I am going to have to finish now.
Cheers
Vere

It’s part of the normal Blynk library connection process, to tell you that it’s connected and what your ping time to the server is.
You times of >1 second aren’t great and may cause you issues in future, but that down to your GRPS signal strength and ISP’s service quality.

Pete.