A programmable, tunable siren system using BLDC motors with FOC (Field-Oriented Control).
## Overview
This project implements a tunable siren where the frequency is controlled remotely via OSC (Open Sound Control) messages over WiFi. The system uses a DJI 2212 920KV BLDC motor driven by a B-G431B-ESC1 controller running SimpleFOC. Multiple stations can be controlled independently or simultaneously.
## Hardware
| Component | Part |
|-----------|------|
| Motor | DJI 2212 920KV BLDC |
| Motor Controller | STMicroelectronics B-G431B-ESC1 |
| Processors | ESP32 WROOM (one per station, one for remote) |
| Display | SSD1306 128x64 OLED (on both remote and station) |
| Input | AiEsp32 Rotary Encoder (on both remote and station) |
## Architecture
```
┌──────────────────────┐
│ Remote Control │
│ (ESP32 + OLED) │
┌─────────────────┐ OSC (WiFi) │ 192.168.4.200 │
│ External OSC │ ───────────────┤ Port: 54001 │
│ (Any client) │ │ - Acts as WiFi AP │
└─────────────────┘ │ - Routes to stations│
└──────────┬───────────┘
│ OSC forward
│ (optional path)
▼
┌────────────────┐ ┌────────────────┐
│ Station 1 │ │ Station N │
│ 192.168.4.201 │ ... │ 192.168.4.20X │
│ Port: 54000 │ │ Port: 54000 │
└───────┬────────┘ └────────┬────────┘
│ │
│ ┌─────────────────┴─────────┐
└────────►│ B-G431B-ESC1 │
│ SimpleFOC │
│ DJI 2212 920KV BLDC │
└────────────────────────────┘
```
## Communication Modes
### 1. Via Remote Control (Router Mode)
The remote control acts as a WiFi access point and forwards OSC messages to stations. This allows controlling multiple sirens from a single entry point.
- **Remote IP**: `192.168.4.200`
- **Port**: `54001` (receives commands)
### 2. Direct to Station
Send OSC messages directly to each station's IP address: