This is an information post mostly for myself – I spent a lot of time trying to program my ESP32 using the OTA functionality of it and some of it is a bit clumsy. I created a board that I will be soldering the chip version of the ESP and this particular board I won’t have any pin outs for it.
This is because it’s purpose built and has the components / sensors already broken out. The ESP needs to be initially programmed, which I can use a programmer for before I mount the chip.
Once the chip is mounted, I won’t be able to remove it easily to update or modify my code. So, I knew using OTA would be a necessity.
I searched for some tutorials to start to understand the principles of how it will work and came across these videos which seem to be the best BUT the code differs on them, and it differs to the code in the git hub too!
The code and videos
This is the repository for where the code is https://github.com/SensorsIot/ESP32-OTA
This needs to be uploaded with your actual code every time or it will lose the ability to be OTA and you will need to plug in your board.
Save this file. Great advice from the video but if you name the file with a ‘0’ in place of the ‘O’ it will come up top of your file list which is really handy.
Then in Arduino, go to the sketch menu and ‘add file’ or I went to the little drop down arrow in the Arduino window to create a new tab. You then can create a new file through this way.
The new file name is OTA.h
Both files of code :
Also check that you have the correct libraries installed.
Upload your code to your board, make sure you have the correct board and port selected.