Overview

    The library is built from our experience of shipping a production ready OTA solution. The library works with latest version of ESP-IDF and will be actively maintained.

    Documentation

    The documentation of the library can be found hereYou may also refer to the OTA user guide to know how to use this library for OTA updates.

     

    Getting started with the library

    Follow this article to do provisioning & registering the device on AWS.

    Example Setup

    1. Change the working directory to the OTA example.
    2. Copy the generated claim certificates from earlier example to
        ..\<example>\main\claimCerts  folder.
    3. Update the Wi-Fi and AWS parameters in app_config.h of the example.

    Building the project

      1. Open the ESP-IDF 4.2 CMD command prompt
      2. Navigate to ..\<example> folder
      3. Flash Command
        idf.py -p <SERIAL_PORT> flash monitor
        Note : Don’t erase-flash as device is already registered.

    Testing OTA Update Job

    1. Update the APP_VERSION in app_config.h
      #define APP_VERSION "NEW_VERSION"
    2. Open the ESP-IDF 4.2 CMD command prompt
    3. Build the project
      idf.py build
    4. Under ..\<example>\build a binary file is created (otaS3Bucket.bin)

    AWS IOT Setup

     

    1. Upload the new binary to s3 bucket.

    create a new bucket

    1. open the AWS S3 Storage
    2. In Buckets section, click Create bucket
    3. Enter a unique name  (for example, aws-ota-buildstorm).
    4. Select the AWS Region
    5. In Block Public Access settings for this bucket,
      1. uncheck Block all public access
      2. In Turning off block all public access might result in this bucket and the objects within becoming public, check I acknowledge that the current settings might result in this bucket and the objects within becoming public
    6. click Create bucket

    upload new binary to S3 bucket

    1. select the bucket you created in the earlier section
    2. click upload
    3. In the Upload section click Add files & select ..\<example>\build\otaS3Bucket.bin
      1. check the otaS3Bucket.bin file to upload
      2. mark.png
      3. In the Permissions
        1. under Predefined ACLs, check Grant public-read access.
        2. in Granting public-read access is not recommended, check I understand the risk of granting public-read access to the specified objects.
    4. click Upload
    permissions view

    create the Job document

    1. In objects, click on binary file object(otaS3Bucket.bin)
    2. Under Object overview section, copy Object URL
    3. paste the copied URL in esp32OtaCommand.txt file as url string.
    4. Save and upload this file to S3 bucket (similar to earlier section).

    2. Create a custom OTA job.

    1. Open the AWS IoT console
    2. In the left navigation pane, choose Manage, choose Things, your thing id, choose Jobs, and then click Create job as shown in below image.
      1. In the Job type section, select Create custom job & click Next
      2. In the Job properties, Enter a name for the Job_Name (for example, esp32_ota_001). & click Next
      3. In the File configuration,
        1. In Job targets, choose the thing to be updated.
        2. In File, click Browse S3 & select the job document(s3://testforarticle/esp32OtaCommand.txt).
        3. Click Next
      4. Under Job run type, choose Snapshot
    3. Click Submit
    4. Device will accept the job, performs the ota and the updates the OTA status to the AWS cloud.

    Device OTA logs

    The free usage of library is limited to 30 min. It is meant for testing and demonstration only. If you need access to the source code of the library or if you’re looking for a customized solution, reach out at hello@buildstorm.com