Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By brutzler
#33378
penatenjoe wrote:BTW: when opening the serial monitor in the IDE it asks for a password? I guess that's another mystery for us to explore.

Look at github
I asked igrr:
... When I change the port to the esp8266-ota, and starting the serial console, there is a (never bevor seen) window, which asks me for a password of the board to call the console??? I searched the sketch, but didn't find any password. Trying the WiFi-Password of my router was not the solution. ...

and his answer:
@brutzler When you select network port, Arduino IDE thinks that you are working with Arduino Yun. So when you open serial console, it actually tries to connect to "Yun" over ssh, hence the password request. It will not be able to connect no matter what password you type, because we don't have ssh on the esp8266.
Bonjour is not necessary for OTA, because Arduino comes with its own mDNS discovery library. However if you want to use mDNS in other apps (i.e. if you want to type http://esp8266-ota.local in your browser), you need to install bonjour.
User avatar
By krzychb
#33610 This is a quick summary on several previous posts that provided me with a wealth of valuable input

@igrr – pull request with write-up on IDE OTA process is on esp8266/Arduino github for your review

@observing – I believe I have incorporated your #2 comment. I will go ahead adding your #1 comment if my current writing cuts the mustard. Thanks for valuable comments!

@ Venkatesh – you have another valuable input to include in wiki and I have added it to my to do list :D

I must stand corrected regarding my initial resistance to use release esp8266-1.6.5-1160-gef26c5f :oops: In fact except freaking 'struct tm' warning during compilation it worked very well in all my tests. I see this is already documented as #824 or #740 issues on esp8266/Arduino and a workaround is available.

@ brutzler – special thanks for your great guidance how to add OTA option for boards other than “Generic ESP8266 Module”. This helped me to understand what is behind IDE menu entries and how to change them. This was instrumental make the “NodeMCU 1.0 (ESP-12E Module)“ and “OTA” options playing together :D
User avatar
By penatenjoe
#33638 After uploading the sketch the Arduino IDE would sometimes not show the board, even after long wait times. I could not figure out a pattern. The communication between telnet and serial terminal worked.
I also noticed that the sketch would properly download OTA even when the board was not showing in the port menu. The IDE had to just show the IP address in the status line...

I also added a simple webserver to the code and requested the page every second while initiating the sketch download OTA. This caused an upload error. I tried to add a WifiClient::stopall() next to the WifiUDP::stopall() but this did not help.

To me this entire setup appears to be not yet reliable enough to use it as standard update method, particularly when putting the board in locations which are hard to get to. So far the WebUpdate sketch worked better, but of course it is not as simple to use.
Any ideas what it takes to make this more robust or what I could be doing wrong?
Thanks, Bernd
User avatar
By brutzler
#33652
penatenjoe wrote:After uploading the sketch the Arduino IDE would sometimes not show the board, even after long wait times. I could not figure out a pattern. The communication between telnet and serial terminal worked.
I also noticed that the sketch would properly download OTA even when the board was not showing in the port menu. The IDE had to just show the IP address in the status line...

to that "issue" some collection from gitter-chat:
brutzler: Looking at the DNS_SD_Arduino_OTA Example: Is there any correlation between the telnet-stuff and the appearance of the ethernet-port in the Arduino-IDE/network-ports?
me-non-dev: @brutzler yes
igrr: recent versions of the IDE attempt to connect to the port advertised by the board, over TCP. if the connection fails, the board is not listed

brutzler: When I first upload the complete sketch, and second upload the sketch without the telnet-stuff, then I am still able to upload a third time. Even if I do not see the board in the network ports. It is stored in the IDE. Only if I change from ota to serial and back I loose the IP-address. If I could input the IP manually (because the ESP has a static one, and I know it) then i wouldn't need the Telnet-Stuff. Any possibility for this?
igrr: @brutzler no possibility for this in the IDE but you can always run espota.py manually if you happen to know IP address

brutzler: OK, I have seen, that a change of the IP-address needs a restart of the Arduino IDE, to see the board with its new IP under network-ports. Helpful to know this....
me-non-dev: no need to restart if you do not notice for 10 minutes, then it should generally refresh the mDNS