Over-The-Air(OTA) update for Arduino by AglowOTA

Today, I talk about how you can update your #esp8266, #esp32 in a way more easy. the library is ready to use in you production devices, the best part is the company will provide the Free backend dashboard service for you. where you can manage your whole projects and complete product line under each project.

In this article, I will show you how to update your device in just a single click.

So here we go.

Step 1: Download the library form the this link. you can download zip file for your ease.

Step 2: Go to arduino, Click on Sketch > Include Library > Add .ZIP library > Select downloaded AglowOta-master.zip file.

Step 3: Click on File > Examples > AglowOTA > aglow_ota_auto_update

Step 4: Compile the sketch, if you got error don’t worry, just follow the steps mention here and here. earlier version of esp8266 core does not support precompile binary. so we just need to change one line under platform.txt file.

Step 4: Login to https://ota.aglow.co.in

Step 5: Add New Project .

Step 6: Click on Project > Add New Product > Click on Product.

Step 7: Now here you will find Project ID and Product ID below product name.

This is the Sketch

#include “ota_https.h”#define WIFI_SSID “.....”
#define WIFI_PASSWORD “......”
/*
In test mode the api will check every 2 minute for testing purpose
as we have two different track please use TEST for testing purpose only as we
have to pay so much for the cloud call. and we give this service for free.
If you like our service please donate so that we can keep working for everyone.
https://www.buymeacoffee.com/aglow
*/
DEV_MODE mod = TEST; // and “PROD” for production deviceCHECK_TIME tim = MIN30; // and “MIN60” to check every 60 MIN
uint16_t currentVersion = 0;
String project_id = “.....”; // add project id here
String product_id = “.....”; // add product id here
OtaHttps ota;void setup()
{
Serial.begin(115200);
while (!Serial){}
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
ota.setAutoUpdate(true);
/*
This library will check the server every 30 Min or 60 Min based on what to select,
when every it will find version > then current version it will push new update.
*/
ota.begin(product_id, project_id, mod, tim, currentVersion);
}void loop() {
Serial.println("Version 0");
}

Step 8: Upload the sketch to the esp8266.

Step 9: Now change the version code to next version , In my case, I change to 1. Also change the text “Version 0 ” to “Version 1” inside loop for testing.

#include “ota_https.h”#define WIFI_SSID “.....”
#define WIFI_PASSWORD “......”
/*
In test mode the api will check every 2 minute for testing purpose
as we have two different track please use TEST for testing purpose only as we
have to pay so much for the cloud call. and we give this service for free.
If you like our service please donate so that we can keep working for everyone.
https://www.buymeacoffee.com/aglow
*/
DEV_MODE mod = TEST; // and “PROD” for production deviceCHECK_TIME tim = MIN30; // and “MIN60” to check every 60 MIN
uint16_t currentVersion = 1;
String project_id = “.....”; // add project id here
String product_id = “.....”; // add product id here
OtaHttps ota;void setup()
{
Serial.begin(115200);
while (!Serial){}
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
ota.setAutoUpdate(true);
/*
This library will check the server every 30 Min or 60 Min based on what to select,
when every it will find version > then current version it will push new update.
*/
ota.begin(product_id, project_id, mod, tim, currentVersion);
}void loop() {
Serial.println("Version 1");
}

Step 10: Click on Sketch > Export Compile Binary.

Step 11: Upload the binary to the dashboard , Click on Manage under Test Track, upload binary and use the version code you use in sketch, in our example it is 1.

Step 12: Enter Release Name and about your new build then click on submit.

Step 13: Then Click On Build to make it Live.

Step 14: Wait for 2 minute and see the Serial Logs.

A video example to show how it works.

Let me know in the comments if you have any questions or suggestions!

Product Engineer @Tickle Co. Always looking for new problems. IOT Enthusiastic