ESP32 OTA update via internet (once for ever)
Show you how to update yourfirmware using the OTAdrive library We have sample hardware, combined ESP32 UNO board and Arduino liquid crystal shield. Here We have a simple program that just counts. A number in an interval Lets write this program to our board to check how it works. As you can see the counter increments, every 0.5 seconds, as we excepted Now, we want to add the OTA firmware update feature to this device. The first step is to add the OTAdrive library to our project. We can do that by adding a dependency to the platformio.ini file or finding that in the library manager of the IDE, If you are using Arduino IDE, you can find the library from the library manager. Then we should include it in our program. The first method you should call is setInfo. You should pass your firmware API key and version to this method To obtain your API key. You have to create a new project in your OTAdrive panel and copy the API key of the project to the program. Now we have the API key. I call the setInfo method in the setup function of my program. Then I start the WiFi connection. I want to show a sign on the LCD to notify its connected Here. I will check and update to the new version. Every 10 seconds Lets write the program and see what happens. The device will show up in your panel after the first time it tries to get an update.
You have to confirm the device is yours, otherwise, the server doesnt, let it download firmware or anything else. Then I want to upload my newer firmware to the OTAdrive I have to change. My firmware version Then Ill make some minor changes to my program and compile it. The bin file is what you should upload to the server. If you are using Arduino IDE see our documents about how to find bin files In your OTAdrive panel, go to the firmware section of the project. Choose the bin file and press next Enter the version number exactly as you entered into the setInfo Press next and finish: the upload operation Goto the group of the device and choose the new firmware for the group, Then you can see the device gets. The new version automatically You can see the device firmware version changes after successfully downloading. I want to do that again: Ill change, my firmware version and upload the new bin file to the OTAdrive, The updateFirmware method, returns the result of the operation as a code. I want to show the code on LCD, The device started to download new firmware and the counter stopped The device firmware updated successfully and you can see the device firmware version changed on the OTAdrive panel. The 304 code means the device is updated with the latest firmware on the server The OTAdrive.