2

I would love to be able to update my NodeMCU ESP8266-01 OTA, since they're located in awkward spots. I'm by no means an expert regarding the ESP or NodeMCU, but I haven't been able to find anything recent about OTA updates. I found some discussions about it going back to 2015, but it never seems to have been implemented.

I use my ESP with NodeMCU to control a PWM dimmer. I upload a precompiled version of NodeMCU with the NodeMCU Firmware FLasher, and then use ESPlorer to upload a custom lua file called 'init.lua'. I'm not even sure if this is the proper way to do stuff, but it works.

So the main question: Has OTA updating been implemented, or is it possible in some way?


Just to clarify, I don't think I want to update the firmware. As I understand it, firmware is what you build yourself, or on a website like https://nodemcu-build.com. I want to update the lua files that run on the ESP, that you normally upload through a program like ESPlorer.

Timmiej93
  • 1,328
  • 1
  • 16
  • 35

3 Answers3

2

I found some discussions about it going back to 2015, but it never seems to have been implemented.

Indeed, firmware OTA is not available yet. However, as you probably know, the need for firmware OTA is much lower with the NodeMCU firmware than e.g. with the Arduino platform. I'd argue that you're much less likely in need to replace/upgrade/extend the firmware with its built-in modules than the application code that runs on top of it.

Fortunately, it's quite simple to replace one or several Lua scripts (compiled or uncompiled) on the device and reboot it. All the web and cloud IDEs listed at https://frightanic.com/iot/tools-ides-nodemcu/ offer this. There's even a pending PR that'll bring FTP support to NodeMCU.

For a complete Lua provisioning system take a look at what @TerryE provided at https://github.com/nodemcu/nodemcu-firmware/tree/master/lua_examples/luaOTA

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • Thank you for sharing all this information Marcel. I guess I may be using the NodeMCU 'incorrectly' in that case. I'm just building on top of what somebody else has created. To clarify, the init.lua file I upload to the ESP module is the only code I put on there, init.lua holds the code that handles the PWM dimming. I guess it would be better to have init.lua be some kind of outer shell, and have another script that handles the dimming, which can then be updated? – Timmiej93 May 18 '18 at 08:52
  • 1
    Yes, see https://nodemcu.readthedocs.io/en/latest/en/upload/#initlua for one possible way of structuring your `init.lua`. – Marcel Stör May 18 '18 at 15:15
  • Thank you, I probably need to take the time to read through the entire documentation some time. – Timmiej93 May 18 '18 at 19:45
  • Anything else you need or can this be "closed" i.e. accepted so that it doesn't show up as unanswered anymore? – Marcel Stör Jun 04 '18 at 06:58
  • The “Stehlik IDE” listed at frightanic.com was exactly what I was looking for (apparently :P). Thanks again – Timmiej93 Jun 04 '18 at 20:49
0

I've attempted to use the two Web IDEs listed in the link provided in Marcel Stör's answer, but I honestly failed to understand how to use either IDE. they also seemed like they weren't exactly what I was looking for, and required a server to connect to, or an extra program, which I wanted to avoid.

Edit: Apparently, I did end up using one of the two Web IDEs in the list. Since it's been a while since I did all this, it's a bit fuzzy in my head.

I eventually stumbled upon this GitHub page, which seemed to provide exactly what I was looking for: The ability to access the Lua files on the ESP through a webbrowser. I have personally changed the ide.lua file around completely, since I needed to call functions from it in the init.lua script. However, I think you can just upload the ide.lua script to the ESP, and add a line containing dofile("ide.lua") to your init.lua file.

If anyone is interested in my changes to, or my implementation of the ide.lua script, you can take a look at my repo Timmiej93 / QuinLED / Program code.

Timmiej93
  • 1,328
  • 1
  • 16
  • 35
  • Now I'm confused...Petr's is one of the only two Web IDEs listed in my overview. You're saying "...attempted to use the two Web IDEs" and "...eventually stumbled upon this GitHub page" whereby the latter is one of the two? – Marcel Stör Jun 04 '18 at 19:24
  • Hm, maybe I did find that page through your link, I'm not sure now. I know I looked at that overview list dozens of times, trying to figure out what it was they all did, and what I needed. It's been a while since I did this, so I might be my head mixing all kinds of stories together. – Timmiej93 Jun 04 '18 at 20:48
-1

In fact there's a class for that to implement OTA i the NodeMCU its called the ESPhttpUpdate you can refer to ESPhttpUpdate for further details.

JAXPAROW95
  • 17
  • 6