Skip to content

rkuo2000/EdgeAI-AMB82mini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

745 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

人工智慧教材

1. AMB82-mini 開發板介紹

32-bit Arm v8M, up to 500MHz, 768KB ROM, 512KB RAM, 16MB Flash (MCM embedded DDR2/DDR3L up to 128MB)
802.11 a/b/g/n WiFi 2.4GHz/5GHz, BLE 5.1, NN Engine 0.4 TOPS, Crypto Engine, Audio Codec, ...




2. IDE使用介紹 (Arduino-IDE intro)

Arduino IDE 2.3.10 下載安裝


偏好設定 (Preferences)

Hub8735 ultra
https://raw.githubusercontent.com/ideashatch/HUB-8735/main/amebapro2_arduino/Arduino_package/ideasHatch.json

AMB82-mini
main https://github.com/Ameba-AIoT/ameba-arduino-pro2/raw/main/Arduino_package/package_realtek_amebapro2_index.json
dev https://github.com/Ameba-AIoT/ameba-arduino-pro2/raw/dev/Arduino_package/package_realtek_amebapro2_early_index.json


選定開發板 AMB82-MINI

Tools > Board Manager > Search AMB82 : Realtek Ameba Boards 4.1.1-build20260603

Serial-monitor = 115200 baud


首先將AMB82-mini板子用MicroUSB線 連接至電腦的USB port
確認UART com port (Ubuntu OS需 sudo chown usrname /dev/ttyUSB0)

燒錄程式碼:

  • 按下UART_DOWNLOAD按鈕, 再按下RESET按鈕, 放開RESET按鈕, 再放開UART_DOWNLOAD按鈕,板子就進入燒錄模式.
  • 然後于Arduino IDE上按下燒錄按鍵Upload

Realtek AmebaPro2 hardware libraries

C:\Users\user\AppData\Local\Arduino15\packages\realtek\hardware\AmebaPro2\4.1.0-build20260213\libraries

C:\Users\user\AppData\Local\Arduino15\packages\realtek\hardware\AmebaPro2\4.1.0-build20260213\libraries\NeuralNetwork\src
GenAI.h
GenAI.cpp


基本練習 (Arduino examples)

  1. 瀏覽器打開 EdgeAI-AMB82mini, 點[Code]並選 [Download ZIP]
  2. 解壓縮.zip, 並將 Arduino/AMB82-mini 複製到 文件/Arduino下, 成為 文件/Arduino/AMB82-mini

基本範例程式練習

Examples> 01.Basics > Blink

Examples> 02.Digitial > GPIO > Button

程式碼修改:
const int buttonPin = 1; // the number of the pushbutton pin
const int ledPin = LED_BUILTIN; // the number of the LED pin

Examples> 01.Basic > AnalogReadSerial

程式碼修改:Serial.begin(115200);


3. 通訊硬體界面

BLE (低功耗藍牙)

Examples> AmebaBLE > BLEWiFiConfig


Examples> AmebaBLE > BLEUartClient

BLE UART Client


Examples> AmebaBLE > DHT_Over_BLEUart

DHT over BLE UART


Examples> AmebaBLE > BLEWifiConfig

WiFi Config Service


Examples> AmebaBLE > BLEV7RC_CAR_VIDEO

BLE V7RC


WiFi(無線網路)

Examples > WiFi > SimpleTCPServer

WiFi - Simple TCP Server

Examples > WiFi > SimpleHttpWeb > ReceiveData

WiFi - Simple Http Server to Receive Data

Sketchbook > AMB82-mini > WebServer_ControlLED

Sketchbook> WebServer_ControlLED

Sketchbook > AMB82-min > BLEConfig_WebServer_ControlLED

Sketchbook> BLEConfig_WebServer_ControlLED

Examples > AmebaFileSystem > ReadHTMLFile

Read and display HTML file from SD card


MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT)
How MQTT Works -Beginners Guide


Examples> AmebaMQTTClient > MQTT_basic

MQTT - Set up MQTT Client to Communicate with Broker


MQTT App

Prompt: make a HTTP Server html to input MQTT topic and text to publish through Paho-MQTT test.mosquitto.org

Paho-MQTT Publisher


OTA (Over-The-Air)

To install Ameba-OTA-UI, read https://github.com/Ameba-AioT/ameba-OTA-UI

Examples > AmebaOTA > OTA

Ameba Over-the-Air Firmware Update

Examples > AmebaOTA > SDCardOTA

Ameba SDCard OTA Firmware Update


4. 感測器與週邊裝置

Sensors


ToF Distance Sensor (紅外線測距感測器)


Peripherals

TFT-LCD (液晶顯示器)

AMB82-mini and QVGA TFT LCD Wiring Diagram


Motor Driver (馬達驅動器)

myservo.attach(8);
myservo.write(pos);

TB6612


DRV8833

Sketchbook > AMB82-mini > RoboCar_DRV8833


Gripper (夾具)

Examples> AmebaAnalog > PWM_ServoControl


5. 音頻應用

播放MP3

AMB82-mini + PAM8403 + 4ohm 3W speaker

Examples > AmebaMultimedia > SDCardPlayMP3

Sketchbook> AMB82-mini > SDCardPlayMP_All

.mp3 files stored under mp3 directory


音頻串流 (Audio Streaming)

Examples > AmebaMultimedia > Audio > RTSPAudioStream


MP4錄音 (Audio Recording)

Examples> AmebaMultimedia > Audio > AudioTriggerRecording

Examples> AmebaMultimedia > RecordMP4 > AudioOnly


音頻分類 (Audio Classification)

Examples> AmebaNN > AudioClassification

The default pretrained model can recognise 521 different types of audios in total.

YAMNet


聲音播放 (Play MP3)

  • Examples > AmebaMultimedia > SDCardPlayMP3
  • Sketchbook> AMB82-mini > SDCardPlayMP_All

6. 影像串流 (Video Streaming)

Video-Only

Examples> AmebaMultimedia > StreamRTSP > VideoOnly

Sketchbook> RTSP_VideoOnly


WebSocket Viewer

Examples > AmebaMultimedia > WebSocketViewer


Examples> AmebaMultimedia > MotionDetection > LoopPostProcessing

  • 修改ssid, passwd, 後燒錄到AMB82-mini,
  • 按reset後程式即開始運行, 用serial-monitor 查看顯示串流網址
  • 啟動手機或電腦上之VLC player, 設定RTSP串流網址


7. 神經網路模型 (AmebaNN)

Examples> AmebaNN > RTSPFaceDetection


Examples> AmebaNN > RTSPFaceRecognition

Serial_monitor: REG=RKUO

  • Enter the command REG=Name to give the targeted face a name.
  • Enter the command DEL=Name to delete a certain registered face. For example, DEL=SAM
  • Enter the command BACKUP to save a copy of registered faces to flash.
  • If a backup exists, enter the command RESTORE to load registered faces from flash.
  • Enter the command RESET to forget all previously registered faces.

影像分類 (Image Classification)

Examples > AmebaNN > RTSPImageClassification


Garbage模型訓練與檔案轉換

required in kaggle for AmebaPro2

  1. pip install tensorflow==2.14.1
  2. model.save('garbage_cnn.h5', include_optimizer=False)
  1. Download garbage_cnn.h5 from kaggle.com/rkuo2000/garbage-cnn Output
  2. Compress garbage_cnn.h5 to garbage_cnn.zip
  3. Go to Amebapro2 AI convert model, fill up your E-mail
  4. Upload garbage_cnn.zip
  5. Upload one (.jpg) test picture (EX. glass100.jpg from Garbage dataset)
  6. Email will be sent to you for the link of network_binary.nb

程式範例:RTSP_GarbageClassification.ino

  1. click the recieved Email link to download network_binary.nb
  2. create NN_MDL folder in SDcard, save network_binary.nb under NN_MDL folder, and rename it to imgclassification.nb
  3. plugin SDcard back to AMB82-MINI
  4. modify Sketch RTSP_GarbageClassification.ino
    1. modify SSID and PASSWD
    2. modify imgclass.modelSelect (change DEFAULT_IMGCLASS to CUSTOMIZED_IMGCLASS)
  5. burn code into board AMB82-MINI, and run it with VLC player streaming


物件偵測 (Object Detection)

Roboflow Datasets

Examples > AmebaNN > ObjectDetectionLoop


Kaggle 範例:


Pothole模型訓練與檔案轉換

  1. repro https://github.com/WongKinYiu/yolov7
  2. create pothole.yaml %%writefile data/pothole.yaml
train: ./Datasets/pothole/train/images
val:  ./Datasets/pothole/valid/images
test: ./Datasets/pothole/test/images

# Classes
nc: 1  # number of classes
names: ['pothole']  # class names
  1. YOLOv7-Tiny Fixed Resolution Training
!sed -i "s/nc: 80/nc: 1/" cfg/training/yolov7-tiny.yaml
!sed -i "s/IDetect/Detect/" cfg/training/yolov7-tiny.yaml
  1. Download best.pt from kaggle.com/rkuo2000/yolov7-pothole
  2. Compress best.pt to best.zip
  3. Go to Amebapro2 AI convert model, fill up your E-mail
  4. Upload best.zip
  5. Upload one (.jpg) test picture (EX. pothole_test.jpg from Pothole dataset)
  6. Email will be sent to you for the link of network_binary.nb

程式範例:RTSP_YOLOv7_Pothole_Detection.ino

  1. click the recieved Email link to download network_binary.nb
  2. create NN_MDL folder in SDcard, save network_binary.nb under NN_MDL folder, and rename it to yolov7_tiny.nb
  3. plugin SDcard back to AMB82-MINI
  4. modify Sketch RTSP_YOLOv7_Pothole_Detection.ino
    1. modify SSID and PASSWD
    2. modify ObjDet.modelSelect(OBJECT_DETECTION, CUSTOMIZED_YOLOV7TINY, NA_MODEL, NA_MODEL);
  5. burn code into board AMB82-MINI, and run it with VLC player streaming


AMB82 Mini - 物件偵測範例

RTSP_YOLOv7_Pothole
RTSP_YOLOv7_Sushi


AMB82 Mini - SD卡加載模型範例

RTPS_ObjectDetection_AudioClassification.ino


AMB82 Mini - 綫上AI 模型轉換工具


8. 語音應用 (TTS & STT)

語音合成 (TTS)

Examples > AmebaNN > MultimediaAI > TextToSpeech (google-tts)


語音辨識 (STT)

聲音偵測 (VAD)

Examples> AmebaMultimedia > Audio > AudioTriggerRecording

Examples> AmebaMultimedia > Audio > SoundDetectorTrigger


雲端語音辨識

ffmpeg.exe is needed for Windows to run Whisper

Examples > AmebaNN > MultimediaAI > GenAISpeech_Whisper (Whisper)

Examples > AmebaNN > MultimediaAI > GenAISpeech_Gemini (Gemini)


本地PC語音辨識

AmebaPro2 Whisper LLM_server

  • Examples -> AmebaHttp > HTTP_Post_MP4_Whisper_server
  • Examples -> AmbeaHttp > HTTP_Post_MP4_Whisper_server_FastAPI

9. 語言模型 (LLM & VLM)

雲端視覺解析

Examples > AmebaNN > MultimediaAI > GenAIVision

Examples > AmebaNN > MultimediaAI > GenAIVisionTTS

Examples > AmebaNN > MultimediaAI > GenAIVideo


本地PC視覺解析

PC-RTX5060OC-8/16GB running Ollama-server with Gemma-4 model
ollama run gemma4:e2b

Examples > AmebaNN > MultimediaAI > SendImageOllama

Sketchbook > AMB82-mini > Ollama_sendText

Sketchbook > AMB82-mini > Ollama_sendImage


10. 機器人應用

AMB82 mini MCP Server for FreeRTOS SDK

  • Dual-mode development:
    • Arduino — arduino-cli compile & upload
    • FreeRTOS SDK — cmake + arm-none-eabi-gcc compile, uartfwburn upload
  • Semantic search with ONNX Runtime — pre-built index covers 3,500+ documents from:
    • amb82-mini-docs — official tutorials and API docs
    • ameba-arduino-pro2 — Arduino SDK libraries and examples
    • ameba-rtos-pro2 — FreeRTOS SDK components

VLA Robot

RoboCar: AMB82-mini + DRV8833 + MPU6050 + VL53L0X + PAM8403 + Speaker + DC-motor x2

PC: ollama run gemma4:e2b

Functions:

  • 防撞 - 需讀取紅外線測距 (VL53L0X)
  • 朝向 - 需讀取慣性感測元件偵測角度 (MPU6050)
  • 行進 - 需讀取行進命令,執行馬達控制 (DRV8833)
  • 導航 - 需拍照送VLM 識別 (Gemma4:E2B)
  • 命令 - 提問LLM/Agent控制 (Gemma4:E2B)

Appendix. EdgeAI 應用專題實作

114年度專題實作

  1. AI輔助回收系統
  2. AI輔助英語讀字卡造句
  3. AI看圖說故事
  4. AI情緒感知音樂播放器
  5. AI監視錄影系統
  6. 盲人輔助系統
  7. 盲人導航系統

About

EdgeAI Electronics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors