Maker Pro

RTL8722DM supporting TensorFlow Lite “Micro Speech” Example

July 07, 2021 by Qi Zhu

Runs the voice recognition model of TFL for a microcontroller on Ameba D RTL8722DM/RTL8722DM-MINI

Ameba is an easy-to-program platform for developing all kinds of AIoT applications.

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.

download (3).jpg

“Micro Speech” Example


  • Ameba D [RTL8722 CSM/DM] x 1 or Ameba D- MINI
  • Adafruit PDM MEMS microphone
  • LED x 4

In this example, we will use Ameba D as an example, however, the microcontroller EVB using in the video link above is Ameba D-mini.


Connect the microphone and LEDs to the RTL8722 board following the diagram.


How to get the code?

  1. Download the Ameba customized version of TensorFlow Lite for Microcontrollers library at:
  2. Follow the instructions at to install it.
  3. Ensure that the patch files found at are also installed.
  4. Open the example, “Files” -> “Examples” -> “TensorFlowLite_Ameba” -> “micro_speech”.
  5. Upload the code and press the reset button on Ameba once the upload is finished.

Expected Behavior

Once it is running, you should see one of the LEDs flashing, indicating that it is processing audio. Saying the word “yes” will cause the green LED to light up. Saying the word “no” will cause the red LED to light up. If the word is not recognized, the blue LED will to light up.

The inference results are also output to the Arduino serial monitor, which appear as follows:


If you are having trouble getting the words recognized, here are some tips:

  • Ensure that your surroundings are quiet with minimal noise.
  • Experiment with varying the distance of the microphone, starting with it at an arm’s length.
  • Experiment with different tones and volumes when saying the words.
  • Depending on how you pronounce the words, the characteristics of the microphone used, getting one keyword recognized may be easier than the other.

Reference and Q&A

1. More information on TensorFlow Lite for Microcontrollers can be found at:

2. For more examples, please visit our official website:

3. Please join our FB Forum (English version) to further discuss with us: 

4. Or join our forum to bring up any questions:


Related Content


You May Also Like