Chat freely about anything...

User avatar
By danbicks
#45577 Guys,

Does anyone know how to change the default port setting for OTA in the IDE?
There is an option in the library ArduinoOta but I can't seem to find one for the IDE. Is this a board manager file hack?

Default port is 8266, how can the IDE be set for lets say 1500 ?

Cheers

Dans
User avatar
By krzychb
#45581 Hi danbicks,

You need to edit platform.txt file and change OTA port in this line.


Krzysztof

EDIT: Actually this change is not required. The port is advertised by mDNS - please refer to detailed description in my next post below.
Last edited by krzychb on Mon Apr 25, 2016 12:53 pm, edited 1 time in total.
User avatar
By danbicks
#45582 Hi @ Krzysztof,

Got to say amazing work you have done with the guys on this mate, well done you.
I am loving this OTA incredible stuff.

Thanks for this I will tweak this line.

I have so far got an OLED connected displaying all progress, When OTA starts it displays upload progress etc and then network details once connected, I want to add more functionality but have a few questions before I start.

Questions:

1. Has the password issue been fixed yet? I.E when setting a password the IDE does not seem to validate the correct password.

2. I have embedded a telnet server in my app, all working great with password authentication and command control etc. Is there a way to turn OTA on and OFF? this would be really useful.

And lastly are there any major know issues with existing library's and OTA that you are aware of?

Krzysztof superb work, cheers mate.

Dans
User avatar
By krzychb
#45652 Hi @danbicks,

To provide complete answer I have verified OTA from Arduino IDE using the following:
• esp8266/Arduino core 2.1.0
• Arduino IDE 1.6.8 on Windows 7 x64 PC
• BasicOTA.ino sketch available in File > Examples > ArduinoOTA.

Default port is 8266, how can the IDE be set for lets say 1500 ?

1. In BasicOTA.ino sketch add the following line to redefine the default port:
Code: Select all  ArduinoOTA.setPort(1500);

2. Restart Arduino IDE. This is to reload platform.txt as IDE seems to store it in cache.

3. Enable “upload” option in File > Preferences under “Show verbose output during:”. This is to see what port is passed (after -p) by Arduino IDE to upload script.

4. When doing the upload to module with IP = 192.168.1.112 you should see output similar to the following:
Code: Select allpython.exe C:\Users\Krzysztof\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0/tools/espota.py -i 192.168.1.112 -p 1500 --auth= -f C:\Users\KRZYSZ~1\AppData\Local\Temp\buildc6c13c389f0ec080a85c51444b8b7ed6.tmp/BasicOTA.ino.bin Uploading...........................................................................................................................................................................

Has the password issue been fixed yet? I.E when setting a password the IDE does not seem to validate the correct password.

I remember a post reporting such issue. I believe IDE is storing platform.txt in cache and not reloading it if input parameters are changed. Restarting IDE (just once) if password is added or changed should resolve this issue.

To protect OTA upload with a password please check this specific instruction. A summary is below.

1. In BasicOTA.ino sketch add the following line to enable password protection (I assume you will invent a better password later on :D ):
Code: Select allArduinoOTA.setPassword((const char *)"123");

2. Enable “upload” option in File > Preferences under “Show verbose output during:”. This is to see what password is passed by Arduino IDE to upload script.

3. Restart Arduino IDE. This is to reload platform.txt as IDE seems to store it in cache.

4. When doing the upload to module with example IP = 192.168.1.112 you should see output similar to the following:
Code: Select allpython.exe C:\Users\Krzysztof\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0/tools/espota.py -i 192.168.1.112 -p 1500 --auth=123 -f C:\Users\KRZYSZ~1\AppData\Local\Temp\buildc6c13c389f0ec080a85c51444b8b7ed6.tmp/BasicOTA.ino.bin
Authenticating...OK
Uploading...........................................................................................................................................................................

I have embedded a telnet server in my app, all working great with password authentication and command control etc. Is there a way to turn OTA on and OFF? this would be really useful.

This is cool and you are a step ahead from adding even more functionality. Module is listening to OTA uploads if function below is periodically called inside the loop():
Code: Select allArduinoOTA.handle();

To turn OTA on or off I would call this function conditionally – something like below:
Code: Select allvoid loop()
 {
  if (enableOTA == true)
  {
    ArduinoOTA.handle();
  }
  (…)
}

And lastly are there any major know issues with existing library's and OTA that you are aware of?

Nothing I am aware of. I am using OTA with Arduino IDE for several months now and it works very stable for me.

Got to say amazing work you have done with the guys on this mate, well done you.

Thank you on behalf of @igrr and the team! I do not know the whole history but briefly checking the GitHub I believe that @mangelajo and @me-no-dev did most of programming of ArduinoOTA library including modification of Arduino IDE.

I am loving this OTA incredible stuff.

Me too and hence such lengthy post :D

Krzysztof
Last edited by krzychb on Mon Apr 25, 2016 12:54 pm, edited 1 time in total.