🧪 New tutorials are being published — build from robot arms to sensors step by step
Skip to content

ESP32-NanoCam Serial Protocol Manual

Buy in Store

Baud rate: 115200 | Data bits: 8 | Parity: None | Stop bits: 1 | Flow control: None

Compatible with the mainstream camera module AT command set, with additional NanoCam extended commands.

1. General Rules

  • Commands are case-insensitive (STA_SSID = sta_ssid)
  • Commands must be followed by any English punctuation mark (, . : ; etc.) as a terminator
  • Some commands trigger an automatic reboot after being changed
  • Each command ends with \r\n (serial assistants usually add this automatically)

2. WiFi Configuration

STA Mode (connect to a router)

CommandDescriptionExampleReturn
sta_ssid:名称Set WiFi SSIDsta_ssid:MyWiFiOK
sta_pd:密码Set WiFi password (reboots after change)sta_pd:12345678OK (reboots)

The WiFi SSID and password are at most 30 characters; Chinese characters are not supported.

AP Mode (self-hosted hotspot)

CommandDescriptionExampleReturn
ap_ssid:名称Set hotspot SSIDap_ssid:NanoCam-APOK
ap_pd:密码Set hotspot password (reboots after change)ap_pd:12345678OK (reboots)

WiFi Mode

CommandDescriptionParameterReturn
wifi_mode:XSwitch mode0=AP 1=STA 2=AP+STAOK (reboots when changed)

3. AI Mode Switching

CommandModeDescriptionReboot
ai_mode:0NormalMJPEG streaming, no AI
ai_mode:1Cat face detectionReal-time cat face boxes + confidence
ai_mode:2Face detectionReal-time face boxes + coordinates
ai_mode:3Color recognitionBox-select to enroll → real-time detection
ai_mode:4Face recognitionEnroll → identify → delete
ai_mode:5QR codeReal-time decoding → serial output
ai_mode:6LLM agentXiaoZhi AI voice chat + AI vision
ai_mode:7ESP-ClawVoice control + photo vision analysis + OpenAI Vision

ai_mode valid values: 0-7. Out-of-range values fall back to 0 by default. The device reboots automatically after a change, and the new mode takes effect after the reboot.

4. Information Queries

CommandDescriptionExample Return
sta_ipQuery STA IPsta_ip:192.168.1.100
ap_ipQuery AP IPap_ip:192.168.4.1
wifi_verQuery firmware versionNanoCam Board Ver:0.2.0

5. System Control

CommandDescriptionReturn
wifi_resetRestore factory settings (reboots)Reset_OK
nano_rebootSoft resetRebooting...
nano_infoFull device info (JSON)See below

nano_info Response Example

JSON
{
  "device": "NanoCam",
  "ver": "0.2.0",
  "chip": "ESP32-S3",
  "flash": "16MB",
  "psram": "8MB",
  "ai_mode": 1,
  "wifi_mode": 2,
  "sta_ip": "192.168.1.100",
  "free_heap": 245760
}

6. Face Recognition Commands

Only valid in ai_mode:4 (face recognition mode).

CommandDescriptionLabel BehaviorExample Return
face_erilEnroll the face detected in the current frameBlue "Enroll: ID N", flashes for 0.5s>>> face enroll triggered
face_rzEnter continuous face recognition modeGreen "ID: N" / red "who?", stays visible without disappearing>>> face recognize triggered
face_delDelete the last enrolled face IDRed "N IDs left", flashes for 0.5s>>> face delete triggered
face_detectExit recognition mode, back to plain face detectionClears all labels>>> face detect mode

Face Recognition Workflow

Plaintext
ai_mode:4          # 进入人脸识别模式 (设备自动重启)
face_eril          # 注册人脸 (确保只有一张脸在画面中)
face_rz            # 开始持续识别 — 标签持续显示不消失
face_detect        # 退出识别模式 — 标签清除
face_del           # 删除最后注册的人脸

Face Recognition Notes

  1. When enrolling, make sure there is only one face in the frame, at a distance of 30-50cm
  2. In recognition mode (face_rz) the label stays visible and does not disappear after 0.5s — this is new behavior in 0.3.0
  3. To exit recognition mode, send face_detect; otherwise the label keeps showing
  4. Face features are stored in the Flash fr partition, persist across power cycles, up to 47 IDs
  5. Recognition uses frame skipping (MFN inference runs once every 10 frames)

7. Extended Commands (NanoCam-specific)

CommandDescriptionStatus
nano_server:urlSet LLM server address (saved in NVS)
nano_api_key:keySet LLM API key (saved in NVS)
nano_mqtt:broker,port,topicConfigure MQTT server🔨
nano_led:R,G,BSet RGB LED (WS2812, GPIO18 DIN)📋
nano_snapTake a photo and store it (SPIFFS)
nano_stream:on/offStart/stop streaming📋

nano_server / nano_api_key

CommandDescriptionExampleReturn
nano_server:URLSet LLM server addressnano_server:https://api.openai.comOK server=https://api.openai.com
nano_api_key:KEYSet API keynano_api_key:sk-xxxxOK

Supports any OpenAI-compatible API (vLLM / Ollama / local models all work). ESP-Claw mode (ai_mode:7) supports nano_server; XiaoZhi AI (ai_mode:6) uses a separate server configuration.

8. Notes

  1. sta_pd / ap_pd reboot automatically after being changed; the new password takes effect after the reboot
  2. ai_mode reboots automatically after being changed (only when the mode actually changes)
  3. In face recognition mode (mode 4), Type-C serial configuration may stop working (insufficient memory)
  4. WiFi SSID/password cannot exceed 30 characters and cannot contain Chinese characters
  5. Commands must be followed by a punctuation mark as a terminator

Next Steps

  • Quick Start — the complete walkthrough from flashing the firmware to switching AI modes