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
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
3. Follow the instructions at
Ensure that the patch files found at
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:
- For more examples, please visit our official website:
- Please join our FB Forum to further discuss with us:
- Or join our forum to bring up any questions: