Ameba ARDUINO: Getting Started with AMB01 (RTL8195)


Required Environment

Currently, Ameba RTL8195AM currently supports Windows 7/8/10 and above (32 and 64 bits), Linux ubuntu and MAC OS operating systems. In this example, please use Arduino IDE with version 1.8.12 or later.

Introduction to Ameba

is a programmable platform for developing all kind of IoT applications. Ameba is equiped with various peripheral interfaces, including Wifi, GPIO, NFC, I2C, UART, SPI, PWM, ADC. Through these interfaces, Ameba can connect with electronic components such as LED, switches, manometer, hygrometer, PM2.5 dust sensors, …etc.

The collected data can be uploaded via WiFi, and be utilized by applications on smart devices to realize IoT implementation.

get-start-1

Ameba and Arduino Uno have similar size, as shown in the above figure (Ameba is the upper one), and the pins on Ameba are compatible with Arduino Uno. Besides the pins, Ameba boards are equipped with an NFC antenna (the right part of Ameba board.) If the NFC feature is not required, the NFC antenna can be cut down from Ameba board.
Ameba uses Micro USB to supply power, which is common in many smart devices.

Setting up Development Environment

Step 1. Installing Driver

First, connect Ameba to the computer via Micro USB:

get-start-2
If this is the first time you connect Ameba to your computer, you have to install the USB driver for Ameba. Ameba uses the standard Arm MBED CMSIS DAP driver, you can get the installation file and related information in the following website:
https://developer.mbed.org/handbook/Windows-serial-configuration

In “Download latest driver” download and install mbedWinSerial_16466.exe. Afterwards, you will see “mbed Serial Port” in Device Manager of your computer:

get-start-3
Step 2. Set up Arduino IDE

From version 1.6.5, Arduino IDE supports third-party hardware. Therefore, we can use Arduino IDE to develop applications on Ameba, and the examples of Arduino can run on Ameba too. Arduino IDE can be downloaded in the Arduino website:

https://www.arduino.cc/en/Main/Software

When the installation is finished, open up Arduino IDE. To set up Ameba correctly in Arduino IDE, go to “File” -> “Preferences”

get-start-4
And paste the following URL into “Additional Boards Manager URLs” field:

Arduino Ameba package v1.0.0 to v2.0.5

https://github.com/Ameba8195/Arduino/raw/master/release/package_realtek.com_ameba_index.json

Arduino Ameba package v2.0.6 and above

https://github.com/ambiot/amb1_arduino/raw/master/Arduino_package/package_realtek.com_ameba1_index.json

Moreover, if you use IDE version earlier than 1.6.7, please make sure the IDE language is set to English to avoid problem.
In version 1.6.7, Arduino has resolved the language problem.
get-start-5
If you have changed the language setting, please restart the Arduino IDE.

Next, go to “Tools” -> “Board” -> “Boards Manager”:
get-start-6
The “Boards Manager” requires about 10~20 seconds to refresh all hardware files (if the network is in bad condition, it may take longer). Every time the new hardware is connected, we need to reopen the Board Manager. So, we close the Boards Manager, and then open it again. Find “Realtek Ameba Boards” in the list, click “Install”, then the Arduino IDE starts to download required files for Ameba.
get-start-7

If you are facing GitHub downloading issue, please refer to the following link at “Download/Software Development Kit”. There are 3 sections.
1. “Ameba1_Arduino_patch1_SDK”, please select at least 1 of the SDKs. There are 5 latest released SDK options.
2. “Ameba1_Arduino_patch2_Tools”, please select according to your operation system. There are Windows, Linux and MacOS.
3. “Ameba1_Arduino_Source_Code”, this section is optional download only wants to refer the latest source code.

https://www.amebaiot.com.cn/en/ameba-arduino-summary/

Download the files selected, then unzip (patch1 and patch2 are compulsory). There are “Install.doc”/“Install.pdf” for you to refer installation steps. According to your system, please run the installation tool in the “Offline_SDK_installation_tool” folder.

After the installation tool running successfully, you may open Arduino IDE and proceed to “tools” -> “Board“ -> “Boards Manager…”. Try to find “Realtek Ameba Boards” in the list, click “Install”, then the Arduino IDE starts to download required files for Ameba.

Finally, we select Ameba as current connected board in “tools” -> “Board” -> “Arduino Ameba”:
get-start-8
Try the First Example

Step 1. Compile & Upload

Arduino IDE provides many built-in examples, which can be compiled, uploaded and run directly on the boards. Here, we take the “Blink” example as the first try.
Open “File” -> “Examples” -> “01.Basics” -> “Blink”:

get-start-9
Arduino IDE opens a new window with the complete sample code.
get-start-10
Next, we compile the sample code directly, click “Sketch” -> “Verify/Compile”
get-start-11
Arduino IDE prints the compiling messages in the bottom area of the IDE window. When the compilation is finished, you will get the message similar to the following figure:
get-start-12
Afterwards, we will upload the compiled code to Ameba. Please make sure Ameba is connected to your computer, then click “Sketch” -> “Upload”
get-start-13
Again, during the uploading procedure the IDE prints messages. Uploading procedure requires respectively longer time (about 30 seconds to 1 minute). When upload completed, the “upload finish” message is printed.
get-start-14

Step 2. Run the Blink example

In each example, Arduino not only provides sample code, but also detailed documentation, including wiring diagram, sample code explanation, technical details, …etc. These examples can be directly used on Ameba.
So, we find the detailed information of the Blink example:

https://www.arduino.cc/en/Tutorial/Blink
In short, this example make LED blinks, and it uses GPIO pin 13.
According to the pin diagram of Ameba, we find pin D13:
get-start-15
Then we connect the LED and resistance as the following figure:
(NOTE: In an LED, the longer pin is the positive pole, and shorter pin is the negative pole. So we connect the longer pin to D13, and connect the shorter pin to GND.)
get-start-16
Finally, press the reset button, and you can see the LED blinking.
If you encounter any problem, please refer to Trouble-shooting

Please confirm that QQ communication software is installed