Computer webserver (for OTA)

ok I either don’t know what to look for or I can’t seem to find it so…

I wanted to think about OTA for my ESP chip. so I started looking about OTA and all that… didn’t really delved into that with full force… but I read everywhere that I need to have a webserver of some sort in each option I’ll choose.
but I want to think ahead and plan for everything.
my network won’t have only 1 ESP chip in it… and each chip will run different sketches… but I want them to be updated if I make a change in the version on my computer all on their own.

I understand that I can put the “webserver” on the ESP it self but then I’ll need to enter each ESP and upload the file manually… and it’s not a good enough option…

I also got the fact that I can install a webserver on my computer so the ESP will connect to the network go to a specific path and look for an update or something like that…

so my questions are:

  1. what is the best option to do an OTA for multiple ESPs running different sketches on the same network?
  2. if I do need to install a webserver software on my computer what do I need to install?

if you can please point me to the right direction I’ll appreciate it.

You don’t need a webserver if your computer and the ESP(s) are on the same network.
However, the update process isn’t fully automated. What OTA gives is the ability to update a device without physically plugging it into your computer’s USB port. Instead you can use the Arduino IDE (or potentially other software, but the IDE is my preferred route) to update and compile your code then send it to your ESP device via a virtual network port rather than a physical COM port. If you have multiple ESPs running in OTA Mose through your house then you’ll choose the correct device by its IP address.

If the devices aren’t on the same network as your computer then you have to code-in an HTTP OTA routine that looks at a specific URL to see if there is an update available. If there is then it will download and install the update then reboot. It’s up to you to place the compiled updates in the correct location on your webserver so that the ESP will find them when it checks the specific URL. It’s also up to you to manage the logic behind removing the updates once they’ve been installed, otherwise the same update will continue to be installed each time your ESP checks the URL and finds a file - unless you do some clever coding on the ESP to check the update, such as changing the expected file name each time.

Bottom line is that if you can be attached to the same network each time you want to update a device then go for standard OTA without a webserver. But, all that OTA gives you is the convenience of not needing to dig your device out its hiding place in the wall/ceiling/loft/basement etc. to update it.


1 Like

@PeteKnight thank you for the answer.

I understand that the OTA gives me the option to update far away ESPs.
I saw a solution on youtube or somewhere else that you put the update in a specific location and the ESP gets the update everyday and the webserver check to see if it even need to get the update.

I want this solution… with the webserver and the HTTP OTA and all that… this is why I asked about which webserver to install and how.
I just need a direction.

The fact that I’ll be able to update multiple devices just by putting a file or a folder in a specific place for the webserver to update is what I want to do. and it sounds like a complex thing but I want that option instead of the updates taking so much time of me everytime I want to update something.

I’m aware that if it’s in production it shouldn’t be updated as much but still it can be great not to worry about anything once I set this thing up.

if you have any direction on the webserver please let me know. :slight_smile:
Thank you.

I use a free web hosting service. Mine is provided by but there are a million others out there.

However, some of what you’ve said either doesn’t make sense, or conflicts with other things you’ve said…

These two statements seem to conflict with each other. If you want to run different code on different devices then you can’t simply put a single file on your webserver.

The tricky part about HTTP OTA is managing what you do once an update has been installed. You either need to run a server-side script that removes the file once it’s been accessed by your device, or you need some logic on the device that looks for a different file location each time.
I do neither. I have multiple devices, all running slightly different code. Each device is coded to look at a different folder on my webserver (folder names are organised by MAC address of the devices, so it’s easier for me to know where to put a specific file). If I want to update a device then I change the code and compile it, then fish around and pull-out the compiled file. I then FTP it to the relevant folder on my webserver using Putty or something similar.
At 2:00am the following morning the device will check for an update and install it then reboot. The devices are programmed to send me a Pushover message each time they reboot, and that message contains the MAC address of the device and the compile date/time of the firmware they are running. The message also contains a reminder that I may need to manually go and remove an OTA file from the webserver.
If I do nothing then the device will continue to check for and re-install the same file then reboot and send me a Pushover message. Ones I log on to the webserver and delete the file then updates will stop until I pot a new file there.

I use this system for devices that I’ve built for other people, so aren’t connected to my home network.
For the devices that are on my home network, which can be accessed via normal OTA, I don’t bother with HTTP OTA as I find it much simpler to fire-up the Arduino IDE and send the update directly to the device.

Try both methods and come back in 12 months time and tell us which one you’re using…


1 Like

yeah what I said wasn’t a well thought sentence… I meant to describe what you described.
multiple devices connect to their specific folder and downloading the update.

Anyways… thank you I’ll try the free hosting websites.

If you’re not familiar with the file structure if web hosting sites then you might spend a while scratching your head trying to get things working. It took me a while to figure out that you need to go to the /public_html folder and create your device specific folders there.
If your update file is called update.ino then it’s path should be something like:

In this situation your application external URL would be:

Also, watch out for the fact that these file names and URLs are case sensitive.


I know these things… but I’m not really sure about how to do the PHP thing… since I didn’t learn this ever… I’ll try looking for something.

@sagirokach the main “Arduino ESP” site has some php code for what you want to do.

Do you have Arduino coding experience? We code “new firmware versions” within the Arduino sketch so it knows what to look for each day. It means we don’t have to do any PHP or manual removal of the old firmware files.

We do however have to be very sure that we get the numbering correct in the sketch.

yeah @Costas I have some coding experience. :slight_smile:
but not with PHP. (I’ll learn that or find something eventually to do what I want)
anyways. thank you for point me to the arduino ESP…
I’ll take a look.