Ameba Arduino: [RTL8195AM] [RTL8710AF] Cloud OTA

  • Ameba x 1
  • Apache Web Server
The example illustrates how to use AMEBA to download firmware from Web Server to do remote OTA function. This project is contributed by Maker Rododo.
  • Install Web Server
This example needs to install Web Server. Take Apache Web Server installation on Windows as an example, download on Apache Lounge website. 1 Complete download and to unzip the file, copy directory Apache24 to C:\ root directory. Open CMD with administrator and key in:
C:\Apache24\bin\httpd -k install
Start Apache:
net start apache2.4
1 Test: Open browser and input:
1 The page shows “It works!” if the Apache Web Server starts successfully.
  • Generate OTA firmware
We generate OTA firmware to verify if the download from Web Server is complete. Open Arduino IDE and add a sketch file as below and print “Hello From Ameba!!” on the console every 1 second in the loop() function . 1 Find ota.bin to use for OTA after the compilation and open the directory we install Arduino Ameba SDK. It should be the location shown below if the certain path had not been changed when installing Arduino IDE:
Copy ota.bin and put it to Apache Web Server htdocs directory (C:\Apache24\htdocs).
  • Generate checksum files
Before remote OTA, we check ota.bin correctness via checksum. We can use the checksum tool provided by Github: Download checksum.exe and copy to Apache Web Server htdocs directory (C:\Apache24\htdocs). Open cmd and change to C:\Apache24\htdocs directory. Key in:
Checksum.exe ota.bin
1 203df9 is the checking code generated from checksum. Add a check.txt in C:\Apache24\htdocs after transform the value to Decimal as shown below: 1
  • Example
The libraries we need are: Refer to Arduino website to install .zip library to Ameba: Open “File” -> “Examples” -> “AmebaCloudOTA” -> “ota_cloud”, fill in AP SSID and Password. Remember to fill in Web Server IP Address and Port. 1 Compile and upload to Ameba. Start downloading OTA from Web Server after pushing Reset button. And open the terminal. 1 Run check.txt checking after connecting to the WiFi. 1 Start to download ota.bin 1 Check checksum after the download and start OTA. It restarts and prints ” Hello from Ameba!!!” if the process is successful. 1
Code Reference
int checksum = OTA.gatherOTAinfo(REMOTE_ADDR,"/check.txt", REMOTE_PORT);
if( checksum != -1) Serial.println("info_ok");
In setup(), getting checksum information in check.txt from remote server via OTA.gatherOTAinfo. Remember to fill in web server address and port
Please confirm that QQ communication software is installed