Content
# Tool List
## Hardware Architecture
```
┌─────────────────────────────┐
│ ESP32-P4 (Main Control) │
│ • MIPI DSI Touch Screen │
│ • MIPI CSI Camera │
│ • ES8311 Audio Codec │
│ • DHT22 Temperature Humidity Sensor │
│ • BH1750 Light Sensor │
│ • EC11 Rotary Encoder │
└────────────┬────────────────┘
│ WiFi / LAN
┌────────┴────────┐
│ │
┌───┴──────────┐ ┌──┴───────────┐
│ ESP32-C3 │ │ Cloud AI Service │
│ Sensor Node │ │ (WebSocket / │
│ • DHT22 │ │ MQTT+UDP) │
│ • BH1750 │ │ │
└──────────────┘ └──────────────┘
```
## Features
### 🤖 AI Voice Interaction
- WebSocket / MQTT+UDP Dual Protocol Connection to Cloud Large Model
- Streaming ASR + LLM + TTS Full-Duplex Voice Interaction
- Offline Voice Wake-Up (ESP-SR)
- MCP (Model Context Protocol) Standardized Call Interface, AI Controllable Hardware
- OPUS Audio Codec
### 🏠 Smart Home Control
- LVGL 9.3 Multi-Page Touch UI (Chat, Home Control, Sensor Curve, Weather)
- SoftAP Web Server — Mobile Browser Can Control Device
- GPIO Control Fans, Lights, and Other Home Devices
- MCP Protocol Supports AI Automatic Control
### 📊 Environmental Monitoring
- Local DHT22 + BH1750 Sensor Collection
- Remote ESP32-C3 Node Reports Data via HTTP
- Temperature, Humidity, Light History Curve Display
- Timed Voice Broadcast Current Environment Data
### 📷 Security Monitoring
- MIPI CSI Camera Support
- Frame Difference Method Motion Detection + Skin Color Detection
- Abnormal Movement Sound and Light Alarm
- Local PCM Voice Alert
### 🔧 System Function
- OTA Remote Firmware Upgrade
- Local PCM Voice Broadcast (Temperature, Humidity, Reminder, etc.)
- Timed Reminder Function
- Multi-Language Support
## Development Environment
- **Framework**: ESP-IDF 5.5+
- **UI Library**: LVGL 9.3
- **Chip**: ESP32-P4 (Main Control) + ESP32-C3 (Sensor Node)
- **Compiler**: GCC (xtensa-esp / riscv32-esp)
- **Recommended IDE**: VSCode + ESP-IDF Plugin
## Quick Start
### 1. Clone Repository
```bash
git clone https://github.com/hhchhc1/hanma-p4.git
cd hanma-p4
```
### 2. Set ESP-IDF Environment
```bash
# Install ESP-IDF v5.5 or higher
# Reference: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/get-started/
```
### 3. Compile P4 Main Control Firmware
```bash
idf.py set-target esp32p4
idf.py build
idf.py flash
```
### 4. Compile C3 Sensor Node
```bash
cd c3_sensor_node
idf.py set-target esp32c3
idf.py build
idf.py flash
```
## Project Structure
```
hanma-p4/
├── main/ # P4 Main Control Code
│ ├── application.cc/.h # Core Application Logic
│ ├── boards/wks-p4-cb/ # Custom P4 Development Board
│ ├── display/ # Display Subsystem (LVGL)
│ │ └── extra_screens.cc # Smart Home Custom Page
│ ├── audio/ # Audio Subsystem
│ ├── protocols/ # Communication Protocol (WebSocket/MQTT)
│ ├── camera/ # Camera Driver
│ ├── sensors/ # Sensor Driver (DHT22/BH1750)
│ ├── input/ec11.cc # Rotary Encoder Driver
│ ├── mcp_server.cc # MCP Server
│ ├── smart_home_web_server.cc # Smart Home Web Server
│ └── assets/ # Audio Resources
├── c3_sensor_node/ # C3 Sensor Node
├── partitions/ # Partition Table
├── scripts/ # Build/Tool Scripts
└── docs/ # Documentation
```
## Based on Project
This project is based on [Xiaozhi AI Chatbot](https://github.com/78/xiaozhi-esp32) development, on the basis of its excellent AI voice interaction framework, extended smart home edge control, environmental sensing, security monitoring and other functions.
## License
This project is open-sourced under the MIT License. See [LICENSE](LICENSE) file for details.