Arduino MKR WiFi 1010 Upload sketch remotely by upload bin file to web server

Hi

I worked with NodeMCU esp8266 boards and i have option to upload sketch remotely by upload bin file to web server that run on the NodeMCU (My MCU projects are on the internet and i have connection to the mcu only by IP Address)

with libraries:
<WiFiClient.h>
<ESP8266WebServer.h>
<ESP8266HTTPUpdateServer.h>

Now i have Arduino MKR WiFi 1010 (Better MCU than NodeMCU and more expensive) that work with WiFiNINA library and i didn't found any solution for doing the same thing
"Upload sketch remotely by web server uploading"

Does anyone know a solution and can help ?

Thanks

1 Like

the WiFi101OTA or my ArduinoOTA library.
but upload is from IDE or command line. no web page

Hi Juraj

First of all thanks for your quick responseץ

Can you send me the information how to do it with command line ?

upload from IDE is not an option for me because the mcu is not on the same network subnet like my pc with IDE, and i know that IDE OTA is only works on the same network subnet and not by manual IP or maybe i`m wrong ?

my upload from IDE (Eclipse) right know was

/home/duro/eclipse//arduinoPlugin/packages/arduino/tools/arduinoOTA/1.3.0/bin/arduinoOTA -address 192.168.1.6 -port 65280 -username arduino -password password -sketch /home/duro/git/Regulator/Regulator/Release/Regulator.bin -upload /sketch -b

I tried to run the command and this is the results

Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done
Error flashing the sketch:

How can i know why i get the Error ?
is there any log file ?

I used WiFi101_OTA.ino from the examples and change the WiFi101 library with the WiFiNINA library (i think this is the recommended library for MKR WiFi 1010)

RapidL:
I tried to run the command and this is the results

Connecting to board ... done
Uploading sketch ... done
Flashing sketch ... done
Error flashing the sketch:

How can i know why i get the Error ?
is there any log file ?

I used WiFi101_OTA.ino from the examples and change the WiFi101 library with the WiFiNINA library (i think this is the recommended library for MKR WiFi 1010)

it happens. What version of the upload tool do you have?
add some timestamp or versioning in the sketch to see if it was updated

The new sketch that i'm trying to upload include led blink in loop so if the upload will success i will know.

The version of the package i use is 1.2.1 under Arduino15\packages\arduino\tools\arduinoOTA\1.2.1\bin

I downloaded version 1.3 and get the same result

arduinoOTA.exe version: 1.3.0+e40e85b+2018-12-12:12:32:10

any suggestions ?

do you have Serial Monitor connected for debug output?
you could add in library in WiFiOTA.cpp in sendHttpResponse Serial.println(status);

Yes i can use serial for debug outputs

Where exactly to add sendHttpResponse Serial.println(status) in WiFiOTA.cpp ?

Thanks

RapidL:
Yes i can use serial for debug outputs

Where exactly to add sendHttpResponse Serial.println(status) in WiFiOTA.cpp ?

Thanks

in sendHttpResponse function

RapidL:
Yes i can use serial for debug outputs

Where exactly to add sendHttpResponse Serial.println(status) in WiFiOTA.cpp ?

Thanks

did you find the function?
does it work?

Hi

Yes i tried it now and i get "Unauthorized"

I tried to change the user and password to "admin admin" without success

i looked at the code and this what i found but i didn't understand Why am I getting this error ?

if (_expectedAuthorization != authorization) {
flushRequestBody(client, contentLength);
sendHttpResponse(client, 401, "Unauthorized");
return;
}

Can you help with this

Thanks

Juraj

Thank you very much for your help

You are a genius !!!

I found the problem in the user name in WiFiOTA.cpp and now i can upload the bin file successfully

Thanks again :slight_smile:

user name should be arduino

-username arduino