Files
2026-02-02 08:05:31 +01:00

2.7 KiB

🚀 ESP32 Wand Gateway - Quick Start Card

📋 Prerequisites

  • PlatformIO installed (pip install platformio)
  • ESP32-C6 DevKit connected via USB
  • Magic Caster Wand powered on

🔧 Build in 3 Steps

1️⃣ Configure Wand MAC Address

Edit include/config.h:

#define WAND_MAC_ADDRESS "AA:BB:CC:DD:EE:FF"  // Your wand's MAC

Find MAC: Use nRF Connect app or BLE scanner

2️⃣ Prepare Model

# Windows
setup_model.bat

# Linux/Mac
./setup_model.sh

3️⃣ Build & Upload

pio run --target uploadfs    # Upload model to filesystem
pio run --target upload       # Upload firmware
pio device monitor            # View output

🪄 Using the Wand

  1. Connect - Wand auto-connects on startup
  2. Cast - Press all 4 buttons, draw gesture, release
  3. Result - See detected spell in serial monitor
Started spell tracking
Stopped tracking: 347 positions
========================================
🪄 SPELL DETECTED: Wingardium_Leviosa
   Confidence: 99.87%
========================================

📊 What You Get

71 spell classes from Harry Potter Magic Caster Wand 15-50ms latency (3-5x faster than Python) Local processing - No internet required Low memory - 212KB / 512KB RAM (41%) Production ready - Error handling, reconnection, logging

🐛 Troubleshooting

Problem Solution
"Model file not found" Run setup_model script, then pio run --target uploadfs
"Failed to connect" Check wand is on, verify MAC address in config.h
Low confidence Lower threshold in config.h: #define SPELL_CONFIDENCE_THRESHOLD 0.85f
Out of memory Reduce MAX_POSITIONS to 2048 in spell_detector.h

📚 Documentation

  • BUILD.md - Detailed build instructions
  • ARCHITECTURE.md - System design and algorithms
  • IMPLEMENTATION_COMPLETE.md - Full implementation summary

🎯 Next: Home Assistant Integration

Add to src/main.cpp in onSpellDetected():

#include <WiFi.h>
#include <HTTPClient.h>

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
HTTPClient http;
http.begin("http://homeassistant.local:8123/api/services/input_text/set_value");
http.addHeader("Authorization", "Bearer YOUR_TOKEN");
http.addHeader("Content-Type", "application/json");
String json = "{\"entity_id\":\"input_text.wand_spell\",\"value\":\"" + 
              String(spell_name) + "\"}";
http.POST(json);

💡 Tips

  • Battery monitoring: wandClient.getBatteryLevel()
  • Debug logs: Enable in config.h: #define DEBUG_SPELL_TRACKING true
  • Try easy spells first: Lumos (circle), Alohomora (line)

Ready to cast spells? Run: pio run --target upload 🪄