ESP32 OTA Updates over BLE from a React Web Application

Pages
Contributors: Englandsaurus
Favorited Favorite 2

Github

Our WebApp is going to interact with GitHub so it's relatively easy for us as developers to push new code through GitHub's Release feature. However, we're really only grabbing a JSON and a BIN so you could also just host those within the App itself. The only step that GitHub removes from this is that by titling your release properly, you can avoid having to manually change some file structure so the WebApp can find the proper BIN. Anyway, there are two components that we need on GitHub. One is a JSON of our existing software versions and their compatible hardware versions and the other is all of the BIN files compatible with the software release. Check out the releases page on GitHub and check the contents of each release if you still have questions on how things should be structured.

version.JSON

Our version.JSON file is structured with the newest software release at position 0 in the array. The newest software version would be accessed by calling data.firmware[0]['software']. You can then iterate through the 'hardware' section of that same entry to see all of the hardware that is compatible with this software. Newest hardware versions should also be kept at the top of the JSON entry. An example JSON file is below.

language:json
{
    "firmware": [
        {
            "software": "v2.0.0",
            "hardware": [
                "v2.0"
            ]
        },
        {
            "software": "v0.1.1",
            "hardware": [
                "v1.3",
                "v1.2"
            ]
        },
        {
            "software": "v0.1.0",
            "hardware": [
                "v1.3",
                "v1.2",
                "v1.1"
            ]
        }
    ]
}

BIN Files

The repository that this tutorial uses has three folders. The one titled GithubRepo should have all that is necessary for the actual public facing repository that is accessed by the App which is really just a few BIN files (multiple hardware versions compatible with the same software) and a JSON. Your BIN files should be titled with their compatible hardware versions and your JSON file should include the structure for the current release as well as all previous releases. For instance, the above JSON file would be in a folder with only a single BIN titled v2.0.bin. After pushing these files to GitHub, make a release for the repository in this state and title it as the software version. For the above JSON (and associated BIN) this title for both tag and release would be v2.0.0. It is important that each software version have it's own corresponding release with the compiled binaries and JSON.