Hello,
I need to write a program, which is able to update the firmware of ESP32-S3 wirelessly, without having access to Internet.
I googled and found the example project about OTA:
- OTA: https://github.com/espressif/esp-idf/tr ... system/ota
But this project seems to use the ESP32 as an HTTP client, connecting to a server running on a computer, and both the ESP32 and the computer being connected to the same network created by a router acting as AP. For the firmware update, I won't have access to Internet via a router, hence I will need to set the ESP32 as AP and then connect with my PC to the ESP32-created network.
For using ESP32 as AP, I found the following example project:
- WiFI as AP: https://github.com/espressif/esp-idf/tr ... ted/softAP
and for using ESP32 as HTTP server I found the following example project:
- HTTP server: https://github.com/espressif/esp-idf/tr ... ver/simple
The idea I have to solve my task was to try to combine code from the above 3 example projects in order to use the ESP32 as AP instead of as STA, run an HTTP server on ESP32, use a computer as HTTP client to connect to the ESP32 server, and from the computer browser to upload the new firmware file to the ESP32 server, and then try to copy the new firmware from the buffer to the flash partition.
As I don't have experience with OTA at all and less experience with ESP32, I wanted to first ask if the above idea is possible at all or there exists a simpler way to accomplish the OTA. If there is no simpler method, how can I use the OTA code with ESP32 being an HTTP server instead of HTTP client ?
Thanks in advance
ota via http and using ESP32 as AP instead of as STA
Re: ota via http and using ESP32 as AP instead of as STA
Hi,
ESP32 as http server and PC as http client to upload the firmware to ESP32 and flash firmware to flash is workable. But it may be unfriendly for you to implement it. I think you can use ESP32 as AP and HTTP client, your PC as HTTP server, it will be easy for you.
ESP32 as http server and PC as http client to upload the firmware to ESP32 and flash firmware to flash is workable. But it may be unfriendly for you to implement it. I think you can use ESP32 as AP and HTTP client, your PC as HTTP server, it will be easy for you.
Re: ota via http and using ESP32 as AP instead of as STA
Thanks for you reply !
My use case is that the ESP32 devices are supposed to be on-field where there is no direct access to Internet via a router, so I guess it's needed to establish a direct connection between the ESP32 device and the computer, and there might be different persons with different computers trying to update the firmware of different ESP32 devices.
So I have a question with regard to your suggestion:
My use case is that the ESP32 devices are supposed to be on-field where there is no direct access to Internet via a router, so I guess it's needed to establish a direct connection between the ESP32 device and the computer, and there might be different persons with different computers trying to update the firmware of different ESP32 devices.
So I have a question with regard to your suggestion:
- doesn't this mean that I would need to have a permanent and fixed IP address for the computer which will act as a server, and that I will need to hard-code this IP address in the IDF code for the ESP32 ? I think this would not be possible, because if 2 different persons with 2 different computers go to 2 different sites to perform the update on 2 different ESP32 devices, then the ESP32 device cannot know in advance what the exact IP address of the computer server would be, for example if I use the mobile phone as hotspot, then connect the computer to it and run an HTTP server, to which the ESP32 then connects as HTTP client ? Am I thinking right or am I omitting an easy way for fixing the IP of the computer server ?use ESP32 as AP and HTTP client, your PC as HTTP server
Re: ota via http and using ESP32 as AP instead of as STA
Hi
Sorry that i have not considered the IP address of PC is not fixed. But i think this is not a problem. You can use mdns or other solution to let the AP to find the PC that support OTA. For mdns, i think you can check the mdns components. And for other solutions, i think you can create a TCP server in AP and when PC connect to AP, the PC can connect to TCP server(use fixed TCP port) and send a message like "You can OTA now"(Of course, this is just an example), now the AP can know the PC IP address and can do OTA job.
Sorry that i have not considered the IP address of PC is not fixed. But i think this is not a problem. You can use mdns or other solution to let the AP to find the PC that support OTA. For mdns, i think you can check the mdns components. And for other solutions, i think you can create a TCP server in AP and when PC connect to AP, the PC can connect to TCP server(use fixed TCP port) and send a message like "You can OTA now"(Of course, this is just an example), now the AP can know the PC IP address and can do OTA job.
Re: ota via http and using ESP32 as AP instead of as STA
Hello,
thanks a lot for your reply and for your suggestion ! I hadn't thought about these options.
It helped me solve the issue
Best regards
thanks a lot for your reply and for your suggestion ! I hadn't thought about these options.
It helped me solve the issue
Best regards
Who is online
Users browsing this forum: Bing [Bot] and 113 guests