BTWifiSerial is an ESP32-C3 firmware + EdgeTX Lua toolchain that replaces legacy FrSky-style Bluetooth modules with a modern bridge.
It lets you run trainer, telemetry, and configuration workflows through one device, with two control surfaces:
- Web UI (phone/PC browser)
- Lua UI on the radio (EdgeTX Tools)
- What BTWifiSerial does
- Configuration paths: Web UI or Lua UI
- Operating concepts
- Hardware target
- Repository contents
- Installation
- First steps (recommended order)
- Save and restart behavior
- Runtime roles of Lua scripts
- Troubleshooting quick checks
- Factory reset (Web UI)
- ELRS head tracking
- Documentation
- Notes for maintainers
BTWifiSerial sits between your radio and the outside world (BLE peers, WiFi telemetry clients, and serial peripherals).
Core capabilities:
- BLE central/peripheral behavior depending on selected device mode
- Trainer channel transport and mapping
- SBUS / S.PORT related serial routing modes
- Telemetry output routing (WiFi UDP / BLE / Off)
- On-device configuration with persistence + controlled reboot flows
- OTA firmware update from browser
- WiFi IP address reported with mode label (
STATICfor AP,DHCPfor STA) - Local BLE MAC address visible in Lua Bluetooth page (uses persisted value from first boot onward)
You can configure the same device from either interface.
Use this when you want to:
- Perform initial setup
- Configure WiFi SSID/password/port quickly
- Run OTA updates
- Manage BLE scan/connect/disconnect/forget
Access:
- AP mode:
http://192.168.4.1 - STA mode: the IP assigned by your router
Use this when you want to:
- Configure and monitor directly from the radio
- Scan/select WiFi networks and edit credentials
- Manage BLE actions without leaving the transmitter
- Keep all operational checks in one place during field use
- View local BT MAC address and saved peer from the Bluetooth page
frskysbussport_btsport_mirrorlua_serial
trainer_in(BLE central)trainer_out(BLE peripheral)telemetryelrs_ht(ELRS Backpack head tracking via ESP-NOW)
offapsta
The firmware can restart into different internal runtime profiles depending on saved config.
Target board: ESP32-C3 SuperMini
| Pin | Function |
|---|---|
| GPIO21 | UART TX |
| GPIO20 | UART RX |
| GPIO9 | BOOT button (active low) |
| GPIO8 | LED (active low) |
src/firmware sources (Arduino + PlatformIO)lua/SCRIPTS/FUNCTIONS/btwfs.luaEdgeTX background functionlua/SCRIPTS/TOOLS/BTWFS/modular EdgeTX Tools app (current UI)docs/project documentation
Requirements:
- PlatformIO
- ESP32-C3 board support
Commands:
pio run
pio run --target upload
pio device monitorOn EdgeTX/OpenTX radio, set AUX serial to:
- LUA @ 115200
Copy:
lua/SCRIPTS/FUNCTIONS/btwfs.lua->/SCRIPTS/FUNCTIONS/btwfs.lua- folder
lua/SCRIPTS/TOOLS/BTWFS/->/SCRIPTS/TOOLS/BTWFS/
Create a Special Function:
- Switch:
ON - Action:
Lua Script - Script:
btwfs
From radio Tools menu, run:
BTWFS/main.lua
-
Power and verify link
- Confirm board is responsive in Web UI or Lua UI.
-
Set base mode selections
- Device mode, serial mode, trainer mapping.
-
Set WiFi behavior
- Choose
APorSTA. - If
STA, configure SSID/password and verify router connection.
- Choose
-
Select telemetry output strategy
- WiFi UDP / BLE / Off depending on your ground station workflow.
-
BLE workflow check
- Scan, connect, disconnect, reconnect, forget as needed.
-
Persist and reboot when prompted
- Some settings are immediate, others require restart.
Typical behavior by setting category:
- System mode changes: save + restart
- WiFi mode/credentials changes: save + restart (mode dependent)
- BT name: save without restart
- Telemetry output / mirror baud / UDP-related fields: may trigger immediate action or restart depending on setting
Always wait for completion/acknowledgement before changing another critical setting.
-
btwfs.lua- Runs in background
- Handles channel/telemetry data path
- Coordinates serial ownership with tools heartbeat
-
BTWFSTools app- Foreground UI and user actions
- Preference/info synchronization
- BLE and WiFi scan command execution
-
No data in Tools page:
- Verify AUX is
LUA 115200 - Verify
btwfsSpecial Function is active - Verify wiring GPIO21/GPIO20 to radio serial path
- Verify AUX is
-
WiFi scan unavailable:
- Ensure WiFi mode is active (
APorSTA) - If BLE is currently active in conflicting mode, close BLE action first
- Ensure WiFi mode is active (
-
BLE connect fails:
- Re-scan and confirm target is still advertising
- Retry from clean state (disconnect/forget if needed)
Web UI includes a Factory Reset action under System Actions.
Behavior:
- Restores configuration defaults
- Saves defaults to NVS
- Reboots the device
Important default values after reset:
- Device Mode:
Trainer IN - Serial Mode:
LUA Serial - WiFi Mode:
Off
After reset, you can still enter AP mode manually (BOOT button) or configure from the radio Lua UI.
Receive head tracking (pan/tilt/roll) from an ELRS Backpack VRx (e.g., HDZero goggles) via ESP-NOW.
In Lua Tools Settings:
- Set Device Mode to ELRS HT
- Set ELRS Phrase to match your ELRS Binding Phrase
Accept the restart when prompted.
Head tracking values are injected into GV1 (pan), GV2 (tilt), GV3 (roll). Use these as mixer sources. WiFi, BLE, and telemetry are automatically disabled while in ELRS HT mode.
- End-user guide:
docs/user-manual.md
- Keep Lua constants and firmware protocol IDs synchronized.
- Treat
docs/as the source for long-form documentation updates.