Welcome to IoTForums.com Community
Register now to participate in discussions, ask questions and share your knowledge on internet of things and automation! Feel free to sign up today.
Register Now

Ameba RTL8722CSM/RTL8722DM Supports TensorFlow Lite Basic Example "Magic Wand"


Just Hatched
May 10, 2021
Introduction to Google TensorFlow
TensorFlow (TF) is an end-to-end open-source platform for machine learning. It has a comprehensive, flexible ecosystem of tools, libraries, and community resources that lets researchers push the state-of-the-art in ML, and developers easily build and deploy ML-powered applications.

TensorFlow Lite for Microcontrollers

While TensorFlow Lite (TFL) for Microcontrollers is designed to run machine learning models on microcontrollers and other devices with only a few kilobytes of memory. The core runtime just fits in 16 KB on an Arm Cortex M3 and can run many basic models. It doesn't require operating system support, any standard C or C++ libraries, or dynamic memory allocation.

Ameba and TFL for Microcontrollers
Ameba is an easy-to-program platform for developing all kinds 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.

Magic Wand Example Details
• Ameba D [RTL8722 CSM/DM] x 1
• Adafruit LSM9DS1 accelerometer
• LED x 2

Example Procedure
1. Connect the accelerometer and LEDs to the RTL8722 board following the diagram.

2. Download the Ameba customized version of TensorFlow Lite for Microcontrollers library at
Please, Log in or Register to view URLs content!

3. Follow the instructions at
Please, Log in or Register to view URLs content!
to install it.
Ensure that the patch files found at
Please, Log in or Register to view URLs content!
are also installed.

4. In the Arduino IDE library manager, install the Arduino_LSM9DS1 library. This example has been tested with version 1.1.0 of the LSM9DS1 library.
Open the example, “Files” -> “Examples” -> “TensorFlowLite_Ameba” -> “magic_wand”.

5. Upload the code and press the reset button on Ameba once the upload is finished.

6. Holding the accelerometer steady, with the positive x-axis pointing to the right and the positive z-axis pointing upwards, move it following the shapes as shown, moving it in a smooth motion over 1 to 2 seconds, avoiding any sharp movements.

If the movement is recognized by the Tensorflow Lite model, you should see the same shape output to the Arduino serial monitor. Different LEDs will light up corresponding to different recognized gestures.

Note that the wing shape is easy to achieve, while the slope and ring shapes tend to be harder to get right.

  • More information on TensorFlow Lite for Microcontrollers can be found at:
    Please, Log in or Register to view URLs content!
  • For more examples, please visit our official website:
    Please, Log in or Register to view URLs content!
  • Please join our FB Forum to further discuss with us:
    Please, Log in or Register to view URLs content!
  • Or join our forum to bring up any questions:
    Please, Log in or Register to view URLs content!

Log in

or Log in using