Ameba ARDUINO: Getting Started with RTL8722
AmebaD RTL8722CSM/RTL8722DM currently supports Windows XP/7/8/10 32-bits and 64-bits, Linux and Mac operating systems. In this documentation, please use Arduino IDE with version 1.8.12 or later.
Introduction to AmebaD RTL8722CSM/RTL8722DM
Ameba is an easy-to-program platform for developing all kind of IoT applications. AmebaD is equipped with various peripheral interfaces, including WiFi, GPIO INT, I2C, UART, SPI, PWM, ADC. Through these interfaces, AmebaD 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.
AmebaD and Arduino Uno have similar size, as shown in the above figure, and the pins on AmebaD are compatible with Arduino Uno.
AmebaD uses Micro USB to supply power, which is common in many smart devices.
Please refer to the following figure and table for the pin diagram and function of AmebaD.
|PIN name||GPIO INT||ADC||PWM||UART||SPI||I2C|
Setting up Development Environment
Step 1. Installing the Driver
First, connect AmebaD to the computer via Micro USB:
If this is the first time you connect AmebaD to your computer, the USB driver for AmebaD will be automatic installed.
You can check the COM port number in Device Manager of your computer:
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 AmebaD, and the examples of Arduino can run on AmebaD too. Arduino IDE can be downloaded in the Arduino website:
When the installation is finished, open Arduino IDE. To set up AmebaD correctly in Arduino IDE, go to “File” -> “Preferences”
And paste the following URL into “Additional Boards Manager URLs” field:
Next, go to “Tools” -> “Board” -> “Boards Manager”:
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 AmebaD Boards” in the list, click “Install”, then the Arduino IDE starts to download required files for AmebaD.
Finally, we select AmebaD as current connected board in “tools” -> “Board” -> “Arduino AmebaD”：
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”:
Arduino IDE opens a new window with the complete sample code.
Next, we compile the sample code directly; click “Sketch” -> “Verify/Compile”
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:
Afterwards, we will upload the compiled code to AmebaD.
Please make sure AmebaD is connected to your computer, then click “Sketch” -> “Upload”.
The Arduino IDE will compile first then upload. During the uploading process, users are required to enter the upload mode of the board. Arduino IDE will wait 5s for DEV board to enter the upload mode.
To enter the upload mode, first press and hold the UART_DOWNLOAD button, then press the RESET button. If success, you should see a green LED flashing on the DEV board.
Again, during the uploading procedure the IDE prints messages. Uploading procedure takes considerably longer time (about 30 seconds to 1 minute). When upload completed, the “Done uploading” message is printed.
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 AmebaD.
So, we find the detailed information of the Blink example:
In short, this example makes LED blinks, and it uses GPIO pin 08 (refer to the pin diagram D08). 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 D08, and connect the shorter pin to GND. In addition, please use a resister with suitable resistance in series between LED and GND to protect LED）
Finally, press the RESET button, and you can see the LED blinking.
If you encounter any problem, please refer to Trouble-shooting.