Go Down

Topic: Is My Device Connected Create IoT Cloud? (Read 235 times) previous topic - next topic

jomoengineer

Mar 19, 2019, 08:37 am Last Edit: Mar 19, 2019, 08:53 am by jomoengineer
So, i was able to get a MKR1000 configured in Device Manager, create a new Thing that sets LED_BUILTIN (6) on and off and all was well yesterday. However, today the MKR1000 can not connect to my WiFi router.  The router is fine since other devices are working with it, but not the MKR1000. I've tried deleting the device and readding it but still not luck with the connection.  In Create IoT Cloud, outside of having the device physically connected via a USB cable and verifying the status in Arduino Editor, how can I tell if Create IoT Cloud has connected to the device?
I am not seeing anywhere that gives me a status of the connected device.

This is what I see from the Serial monitor
[ 677500 ] Connection to "MyWiFI" lost.

[ 677500 ] Attempting reconnection

[ 678501 ] Connecting to "MyWiFI"

[ 681146 ] Connected to "MyWiFI"

espiriki

You can try to increase the debug level to see a more detailed log
Just pass 4 (highest level) to the setDebugMessageLevel function on the setup() method:

setDebugMessageLevel(4)

But probably your router is blocking the connection. If you edit the ArduinoIoTCloud lib you can put a print on the code to show the port being used.

Just put a print on the ArduinoIoTCloud.cpp file inside the begin methods (there are two of them).

In my case the port being used was 8883. I'm trying to use it on my company and I'm waiting for the IT guys to open this port for me

Hope it helps

jomoengineer

Thanks.  I'll have to see if and why the router is blocking this device now and not the other day.

This is what is seen with setDebugMessageLevel(4)

..........................
[ 24310 ] WiFi.status(): 3

[ 24310 ] Connection to "MyWiFi" lost.

[ 24310 ] Attempting reconnection

[ 25311 ] Connecting to "MyWiFi"

[ 27458 ] WiFi.status(): 3

[ 27458 ] Connected to "MyWiFi"

[ 27458 ] Acquiring Time from Network
...............................

From Arduino Create Agent Debug Console


{"Version" : "1.1.82"}
{"Commands" : ["list", "open [portName] [baud] [bufferAlgorithm (optional)]", "send [portName] [cmd]", "sendnobuf [portName] [cmd]", "close [portName]", "bufferalgorithms", "baudrates", "restart", "exit", "program [portName] [board:name] [$path/to/filename/without/extension]", "programfromurl [portName] [board:name] [urlToHexFile]"]}
{"Hostname" : "jomo-hp"}
{"OS" : "linux"}
{"D":"."}
{"D":"."}
{"D":"."}
list
{ "Ports": [], "Network": true }
{ "Ports": [ { "Name": "/dev/ttyACM0", "SerialNumber": "386A2F51514D464641202020FF10122A", "DeviceClass": "", "IsOpen": true, "IsPrimary": false, "Baud": 9600, "BufferAlgorithm": "timed", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x2341", "ProductID": "0x804e" }, { "Name": "/dev/ttyUSB0", "SerialNumber": "FTG96GEU", "DeviceClass": "", "IsOpen": false, "IsPrimary": false, "Baud": 0, "BufferAlgorithm": "", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x0403", "ProductID": "0x6001" } ], "Network": false }
{"D":".\n[ 192060 ] WiFi.status(): 3\r\n\n[ 192060 ] Connection to \"MyWiFi\" lost.\r\n\n[ 192060 ] Attempting reconnection\r\n"}
{"D":"\n[ 193061 ] Connecting to \"MyWiFi\"\r\n"}
list
{ "Ports": [], "Network": true }
{ "Ports": [ { "Name": "/dev/ttyACM0", "SerialNumber": "386A2F51514D464641202020FF10122A", "DeviceClass": "", "IsOpen": true, "IsPrimary": false, "Baud": 9600, "BufferAlgorithm": "timed", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x2341", "ProductID": "0x804e" }, { "Name": "/dev/ttyUSB0", "SerialNumber": "FTG96GEU", "DeviceClass": "", "IsOpen": false, "IsPrimary": false, "Baud": 0, "BufferAlgorithm": "", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x0403", "ProductID": "0x6001" } ], "Network": false }
list
{ "Ports": [], "Network": true }
{ "Ports": [ { "Name": "/dev/ttyACM0", "SerialNumber": "386A2F51514D464641202020FF10122A", "DeviceClass": "", "IsOpen": true, "IsPrimary": false, "Baud": 9600, "BufferAlgorithm": "timed", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x2341", "ProductID": "0x804e" }, { "Name": "/dev/ttyUSB0", "SerialNumber": "FTG96GEU", "DeviceClass": "", "IsOpen": false, "IsPrimary": false, "Baud": 0, "BufferAlgorithm": "", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x0403", "ProductID": "0x6001" } ], "Network": false }
{"D":"\n[ 199010 ] WiFi.status(): 3\r\n\n[ 199011 ] Connected to \"MyWiFi\"\r\n\n[ 199011 ] Acquiring Time from Network\r\n"}
{"D":"."}
{"D":"."}
list
{ "Ports": [ { "Name": "/dev/ttyACM0", "SerialNumber": "386A2F51514D464641202020FF10122A", "DeviceClass": "", "IsOpen": true, "IsPrimary": false, "Baud": 9600, "BufferAlgorithm": "timed", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x2341", "ProductID": "0x804e" }, { "Name": "/dev/ttyUSB0", "SerialNumber": "FTG96GEU", "DeviceClass": "", "IsOpen": false, "IsPrimary": false, "Baud": 0, "BufferAlgorithm": "", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x0403", "ProductID": "0x6001" } ], "Network": false }
{ "Ports": [], "Network": true }
{"D":"."}
{"D":"."}
{"D":"."}
{"D":"."}
list
{ "Ports": [], "Network": true }
{ "Ports": [ { "Name": "/dev/ttyACM0", "SerialNumber": "386A2F51514D464641202020FF10122A", "DeviceClass": "", "IsOpen": true, "IsPrimary": false, "Baud": 9600, "BufferAlgorithm": "timed", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x2341", "ProductID": "0x804e" }, { "Name": "/dev/ttyUSB0", "SerialNumber": "FTG96GEU", "DeviceClass": "", "IsOpen": false, "IsPrimary": false, "Baud": 0, "BufferAlgorithm": "", "Ver": "1.1.82", "NetworkPort": false, "VendorID": "0x0403", "ProductID": "0x6001" } ], "Network": false }
{"D":"."}
{"D":"."}


jomoengineer

Okay, I think I may have resolved the issue with the connection to the WiFi Router.

I thought I had gone through the Firmware up on the MKR1000 but I then realized I did not complete the second step where the actual Firmware Updater is run from the Arduino IDE.

Download the latest WiFi101 from GitHub:
https://github.com/arduino-libraries/WiFi101

Following the instructions from the following:
https://www.arduino.cc/en/Tutorial/FirmwareUpdater

1. I downloaded the latest version of the WiFi101 Libraries from:
https://github.com/arduino-libraries/WiFi101

2.  add the zip file via Add .Zip File... under Sketch -> Include Library
This updates the Wifi101 to 0.15.3

3. Under Examples->WiFi101, select, build and load the CheckWiFi101FirmwareVersion Sketch.
WiFi101 firmware check.

WiFi101 shield: DETECTED
Firmware version installed: 19.4.4
Latest firmware version available : 19.5.4

Check result: NOT PASSED
 - The firmware version on the shield do not match the
   version required by the library, you may experience
   issues or failures.

4. Under Examples->WiFi101, select, build and install the FirmwareUpdater sketch

5.  Under Tools, select Wifi1010 / WifiNINA Firmware Updater.

6.  Select the MKR1000 serial port connection and then Update Firmware version.
   I selected  19.5.4 to match the version shown in the FirmwareChecker but there was a newer version 19.6.1 shown.
 
7. Click the Update Firmware button to update the firmware.
 
8. If successful, go back to the Firmware Checker and see if the firmware was loaded.
// After Update

WiFi101 firmware check.

WiFi101 shield: DETECTED
Firmware version installed: 19.5.4
Latest firmware version available : 19.5.4

Check result: PASSED

9. Go back to Arduino Create IoT Cloud and load the test script again.
Monitor output with debug set back to 2

[ 10081 ] Connecting to Arduino IoT Cloud...
Compile time: 1553040000

[ 12186 ] Connected to Arduino IoT Cloud

Yippee!


After this, the Blink Thing I created was able to enable and disable the LED_BUILTIN (6) again.

I hope I do not need to to this each time though.

Now, Is there a option in Arduino Create IoT Cloud that will indicate when it has connected to a Device outside of using the Serial Monitor which requires a physical connection?  That if the device is powered by battery or powered in another location?


Go Up