How to do OTA updates with Blynk and Wio Terminal

Blynk offers an interface to easily update your devices over-the-air. In this tutorial we will explain how to use OTA functionality to Wio Terminal. Go on reading to discover how simple the provisioning process can be.


What is Wio Terminal
Wio Terminal is an ATSAMD51-based microcontroller with both Bluetooth and Wi-Fi connectivity powered by Realtek RTL8720DN.


Hardware Required
  • Wio Terminal
  • Mobile Phone
  • Download Blynk App from App Store
  • WiFi

Preparatory work

Go to Blynk to register and log in, go to the Templates screen, and create a new template.
Then edit the name and select the device and connection mode, in this case "Seeed Wio Terminal" and "WiFi".
Make a note of BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME. In the example, they are:

#define BLYNK_TEMPLATE_ID "TMPLCc16MxA1"
#define BLYNK_DEVICE_NAME "WioTerminal"

Then click the save button in the upper right corner.
Set up the Arduino IDE and tune the code

Next, download and open the sample code in the Ardunio IDE.

Edgent_Wio_Terminal_0-2.zip

Select the Wio Terminal device from the development board options (see the Wio Terminal wiki page for how to add Wio Terminal in the Ardunio IDE).

Add blynk-library

Search for and add the following library files in the Ardunio IDE library manager:

  • Seeed Arduino rpcunified
  • Seeed Arduino rpcWiFi
  • Seeed Arduino SFUD
  • Seeed Arduino FS
  • Seeed Arduino mbedtls
  • ArduinoOTA
  • ArduinoHttpClient

In lines 16 and 17 of the code, fill in the ID and NAME that the system just generated:

Then compile and upload the code to Wio Terminal (if a library file is missing during compilation, search the library manager and download it).

After the program is successfully uploaded, open the serial port monitor and set the baud rate to 115200. Wait for 5-10s. The serial port displays the following information :(if the serial port monitor does not respond, please try to reconnect the data cable and reopen the serial port monitor.)

Mobile APP Settings

Download Blynk IoT APP:

Android

iOS





After the APP configuration is successful, the serial port monitor will prompt the network connection status. When 'Ready' is displayed, the WiFi connection is successful.
Now it's time to try the OTA feature.

OTA: Update BLYNK_FIRMWARE_VERSION

You can write a personal program in "edgent_wio_terminal_0-2" with "void setup()" and "void loop()". In this example, we will change the version information of the program directly for the sake of demonstration. If the program is successfully uploaded, the version information will change. We changed BLYNK_FIRMWARE_VERSION from "0.2.0" to "0.2.11"






Then click "Export compiled Binary" and wait for the build to complete.
Then open the folder and go to the BIN file.

Open Blynk Air and select "New Shipping" in the upper right corner.Click down on this screen to find the "Firmware" option.
Select the bin. file you just generated here, and you will see that the software version is changed to "0.2.11" which we just set. Then click the "Start Shipping" button in the lower right corner to start the wireless upload program.

You can see real-time uploads on the web page or on the serial monitor.





Wait about 2 minutes if your serial port monitor does not have output then try to restart the device and turn on the serial port monitor again and you will see the upload in real time.
Restart the device and you can see that the software version here has changed to "0.2.11" which we just changed.

We hope this handy tutorial helped you to get started with Over-the-air functionality. We are working on more cool guides to help you get to know the new Blynk better.

If you have any suggestions feel free to share with us here.
September 8, 2021
CEO at Blynk
If you are working on a commercial project - let's get in touch. We'd be happy to learn about your business challenges and share our expertise.

Other publications for you: