OTA ESP with Arduino or Tasmota

I am enamored with ESP devices because they have built in WiFi, are powerful and cheap. More often than not, the Arduino IDE suits my requirements because it is linear programming. Tasmota, on the other hand is more like a state machine and seems to be bullet proof.

What if you're device is running Tasmota and you decide that coding your project in the Arduino IDE would be more advantageous. Or vice-versa?

This question was addressed five years ago and I found the answer unsatisfying and complicated. (OK, my solution is complicated, too.)

Whether Arduino or Tasmota, more often than not, the existing program takes up more space than would allow for an OTA upload of the new program. So a minimal program must be used as an intermediary step.

I took some time to see how compatible the OTA upgrading is. I found that it's surprisingly compatible!

Tasmota to Arduino
In the case of a Tasmota programmed device, one would connect to the device's web page and select [Firmware Upgrade]. In [Upgrade by file upload], select a binary.

The binary could be a minimal gzipped Arduino binary. I use the BasicOTA example under Examples for the generic ESP8266 module. Be sure to modify the program with the appropriate SSID and passphrase. The program can be made smaller by removing all the Serial lines of code. Use Sketch-->Export Compiled Binary Alt+Ctl+S to create the binary.

In my case, the binary did not end up in the sketch folder. I had to Show verbose output during compile (found in preferences) and wade through reams of code to find the location of the binary ... which I copied to the sketch folder.

Next the binary needs to be gzipped. I used 7-zip as WinZip does not perform gzip.

This is the binary that would be selected by a Tasmota programmed device. Once the update is successfully completed, the device should be found by the mDNS and used as a port for downloading the actual Arduino program desired.

Arduino to Tasmota
This is easier because once the binary tasmota-minimal.bin.gz is downloaded, it's two simple command.

set NAME=YourUserName
"C:\Users\%NAME%\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3" -I "C:\Users\%NAME%\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2/tools/espota.py" -i "192.168.1.23" -p "8266" "--auth=admin" -f "C:\Users\%NAME%\Documents\Tasmota\tasmota-minimal.bin.gz"

Some notes here:
This code is for windows installation of the Arduino IDE
YourUserName is your windows login name
192.168.1.23 is the IP address of the ESP device
admin is the password used to update the ESP device
*C:\Users%NAME%\Documents\Tasmota* is the path to the folder that contains the Tasmota binary.

If the update was successful, the now Tasmotized device can updated to the desired binary from its webpage 192.168.1.23

update is not successful
Sometimes the update is not successfully completed. Try again. It may be the case that the device may no longer be accessed from a web page (Tasmota) or appear as mDNS port (Arduino). It can be reprogrammed via the serial port, but if the devices is fully embedded ... :frowning: ... Well, that's why I make my ESP devices either removeable or programmable in situ.

My experience with ESPHome is minimal, but I suspect that a similar process can be employed.

Again, my experience with the Arduino on linux OS is limited, but I am confident that those that have more experience can quickly discerned the right incantations.

-OSD

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.