- Fri Oct 13, 2017 5:24 pm
#70837
The easiest way to do HTTP updates is to use a free web hosting account. I use hostinger.co.uk
If you’re not familiar with how web hosting servers work, you may struggle, so here’s a quick guide..
Create a free hosting account - in this example we’ll assume that the URL is updater.hostinger.com
Set Arduino IDE to verbose output.
Update your code to use the http update URL of http//:updater.hostinger.com/updater.ino.bin and put some code in there that gets your device to check for updates every 24 Hours at a specific time of day (2am maybe).
Compile the code and find the path for your ino.bin file you see this in verbose mode) pick-up the file and rename it to updater.ino.bin
Log in to your free hosting account and navigate to /public_html and drop the updater.ino.bin file in there.
That’s basically it. At 2am the ESP will check to see if there’s a file in your specified URL location and if there is it will install it and reboot.
The only drawback is that if you leave the updater file where it is, the ESP will keep reinstalling it every day at 2am. Not really a problem, but probably not what you really want.
The easy solution is to delete the updater file once it’s been installed. The more complex solution is to run a script on the server that deletes the file automatically, but that’s really beyond the scope of what I use HTTP updater for, so I’ve never bothered.
I’ve refined the process described above a little to make it work better for me. I have separate sub folders for each device and the names of these folders are based on the MAC address of the ESP device.
I also include the system compile date/time in my code (__DATE__ and __TIME__) and get the device to send a Pushover message to me when it reboots. The message includes the compile date/time info.
This way, I know that the new firmware has successfully installed and it acts as a reminder for me to go and manually delete the updater file. It also lets me know when the device has restarted unexpectedly, and it’s good to be able to see which version of the firmware you’re running.
Hope this helps.
Pete.