TensorFlow Lite - Magic Wand
材料準備
AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1
Adafruit LSM9DS1 加速感測器
LED x 2
範例説明
步驟
AMB21/AMB22 接線圖:
如下圖,將加速感測器和LED連接到 AMB21 / AMB22 開發板上。
AMB23 Wiring Diagram: For AMB23, we will use the onboard LEDs on the board itself.
BW16 Wiring Diagram: For BW16, we will use the onboard LEDs on the board itself.
BW16-TypeC Wiring Diagram: For BW16-TypeC, we will use the onboard LEDs on the board itself.
從以下網址下載TensorFlow Lite for Microcontrollers的Ameba版本 https://github.com/ambiot/tree/master/Arduino_zip_libraries.
請按照以下說明進行安裝操作 https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries。
確保在以下位置找到patch文件並安裝 https://github.com/ambiot/ambd_arduino/tree/master/Ameba_misc/。
在 Arduino IDE 庫管理器中,安裝 Arduino_LSM9DS1 庫。此範例已使用 LSM9DS1 庫的 1.1.0 版進行了測試。
Open the example, "Files" → "Examples" → “TensorFlowLite_Ameba” →
“magic_wand”
.
上傳代碼並在上傳完成後按Ameba上的重置按鈕。
保持加速感測器穩定,使x軸的正極指向右側,z軸的正極指向上方,按照所示形狀移動加速感測器,使其平穩運動1至2秒鐘,避免劇烈運動。
If the movement is recognised 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.
程式碼説明
有關TensorFlow Lite for Microcontrollers的更多信息,請參考以下網址: https://www.tensorflow.org/lite/microcontrollers