mPython Core 2.0 Documentation

Product Overview

mPython Core 2.0 (labplus_Ledong_v2) is a high-performance open-source teaching hardware based on the dual-core ESP32-S3, aimed at K12 maker and AIoT education scenarios. It features an on-board HD LCD color display, ES8388 audio decoding, QMI8658C 6-axis sensor, MMC5603 magnetometer, LTR-308 light sensor, dual microphones, RGB LED, physical and touch buttons, and camera and motor interfaces, with a built-in MicroPython interpreter supporting Wi-Fi + Bluetooth 5 communication, making it easy to quickly implement voice interaction, sensor acquisition, display control, and IoT applications.

  • Target users: primary and secondary school IT teachers, students, makers, and educational robotics developers

  • Core value: an out-of-the-box AIoT learning platform; rich on-board peripherals and expansion capabilities; comprehensive examples and API documentation

  • Application scenarios: voice assistants, smart cars, environmental monitoring, human-computer interaction, AI vision getting started, and IoT prototype development

Section Sources

Core Business Flow

Around the closed loop of “input-processing-output”, the typical flows are as follows:

  • Voice interaction: microphone capture -> audio codec -> Xiaozhi AI or cloud service -> playback feedback

  • Sensing and control: sensor sampling -> data processing -> screen display/buzzer prompt/motor drive

  • Networking and IoT: Wi-Fi connection -> network requests/message reporting -> state updates and visualization

graph TB
A["User/Environment"] --> B["Input devices<br/>Microphone/Buttons/Sensors"]
B --> C["MCU processing<br/>ESP32-S3 + MicroPython"]
C --> D["Output devices<br/>LCD/Speaker/RGB/Motor"]
C --> E["Network services<br/>Wi-Fi/Bluetooth/Cloud AI"]
E --> C

[This is a conceptual flowchart and does not directly map to specific source files]

Feature Module List

  • Hardware modules

    • Audio: ES8388 decoder chip and amplifier, supporting recording, playback, TTS, etc.

    • Motion sensing: QMI8658C 6-axis (accelerometer/gyroscope), MMC5603 magnetometer

    • Environmental sensing: LTR-308 digital light sensor

    • Display: ST7789 LCD color display

    • Interaction: physical buttons A/B, capacitive touch P/Y/T/H/O/N, RGB LED, buzzer

    • Vision: 0.3-megapixel camera (GC0328)

    • Expansion: multiple HY2.0 4-pin expansion interfaces, I2C, UART, SPI, PWM, ADC

    • Power: USB 5V or a built-in 1200mAh lithium battery

  • Software and tools

    • Programming software: mPython IDE, Labplus 3, Mind+

    • Firmware: based on ESP-IDF v5.x + MicroPython v1.24.1

    • Example code: basic IO, network, sensors, audio, BLE, AI, etc.

    • Xiaozhi AI: a locally deployed voice conversation assistant

    • API reference: TFT display, MOTION, Pin/Button/Touch, wifi, music, audio, etc.

    • C language development: ESP-IDF project templates and board-level configuration

    • FAQ: frequently asked questions and technical support channels

Section Sources

Data and State

  • Key data models

    • Sensor data: acceleration/angular velocity/magnetic field strength/light value/sound sample value

    • Display data: characters/graphics/colors/bitmaps

    • Audio data: PCM/encoded streams/recording files

    • Network data: HTTP/MQTT/UDP packets

    • Device state: Wi-Fi connection, BLE connection, battery level, motor state

  • Key state transitions

    • Audio chain: recording initialization -> record -> store/play -> release

    • Display chain: clear screen -> draw -> refresh

    • Sensor chain: initialize -> sample -> filter/calibrate -> output

    • Network chain: scan -> connect -> authenticate -> send/receive -> disconnect

  • Data ownership boundaries

    • On-board sensors are uniformly encapsulated and accessed by modules such as MOTION/Pin

    • The file system is used to persist recordings, images, and configuration

    • The network module handles external communication; business logic resides in the application layer

Section Sources

Key Constraints and Boundaries

  • Hardware constraints

    • Operating voltage 3.3V, maximum operating current about 500mA, maximum load current about 1500mA

    • P4 is dedicated to the light sensor and P10 to the sound sensor; they cannot be used as general-purpose pins

    • The I2C bus is shared with internal sensors; external I2C devices must mind address conflicts

    • The camera occupies multiple GPIOs; avoid multiplexing conflicts with other functions

  • Software constraints

    • Memory limits: PSRAM 8MB, Flash 16MB; mind large objects and cache release

    • Running audio and display simultaneously places high demands on the CPU and bandwidth

    • Concurrent use of Wi-Fi/Bluetooth requires reasonable resource scheduling

  • Integration boundaries

    • Xiaozhi AI depends on the network and audio chains; ensure the microphone and speaker work properly

    • BLE/GATT services must follow standard UUIDs and characteristic definitions

    • Third-party expansion modules must match resources such as I2C/SPI/UART

Section Sources

Appendix: Architecture and Data Flow (Diagram)

sequenceDiagram
participant U as "User"
participant MIC as "Microphone"
participant CPU as "ESP32-S3"
participant AI as "Xiaozhi AI/Cloud"
participant SPK as "Speaker"
participant LCD as "LCD"
U->>MIC : Speak
MIC-->>CPU : Audio sampling
CPU->>AI : Speech recognition/intent understanding
AI-->>CPU : Reply text/command
CPU->>SPK : Speech synthesis and playback
CPU->>LCD : Display state/result
CPU-->>U : Feedback

[This is a conceptual sequence diagram and does not directly map to specific source files]

Appendix: Examples and Getting Started

  • Quick experience

    • Upload example programs to mPython Core 2.0 via mPython IDE to verify basic functions such as buttons, screen, sound, and sensors

    • Use the audio, network, BLE, camera, and other modules in the examples for advanced experiments

  • Recommended paths

    • basics: repl/io/lcd/buzz/buttons/touchpad/sound/light/accelerometer/gyroscope/wifi/udp/uart

    • advance: iot/random/timer/radio/i2c/thread/filesystem/ble

    • AI: AudioAI, Agent, ImageAI (camera)

Section Sources

Appendix: Xiaozhi AI

  • Introduction: an ESP32-S3-based locally deployed voice conversation assistant supporting wake-word detection, real-time translation, and responsive interaction

  • Getting started: provides compilation-free firmware ready to use after flashing; supports multi-turn dialogue and emotional voice communication

  • Open-source information: the xiaozhi-esp32 project lowers the barrier to AI development and helps build edge-computing prototypes

Section Sources

Appendix: API Reference Index

  • Display: TFT_displayer (DispChar/DispChar_font/clear/show)

  • Motion: MOTION (Accelerometer/Gyroscope/Magnetic)

  • Pins and interaction: MPythonPin, Button, Touch

  • Network: wifi (connectWiFi/disconnectWiFi/enable_APWiFi)

  • Audio and music: music, audio (recording/playback/volume/TTS)

  • Wireless: radio (send/receive/configure)

  • Expansion: BLE, camera, file system, MQTT, etc.

Section Sources

Appendix: C Language Development

  • Build system: ESP-IDF v5.x + CMake

  • Board-level configuration: board.json defines features and deployment instructions

  • Project entry: main.c and component organization follow ESP-IDF conventions

  • Recommendation: prefer MicroPython for rapid prototyping; implement complex algorithms or low-level drivers in C/ESP-IDF

Section Sources

  • board.json:1-25

Appendix: FAQ and Technical Support

  • Contact methods: forum, QQ group, service hotline, and service hours

  • Frequently asked questions: consult the FAQ page or submit questions for help

Section Sources