ESP32 Arduino library for controlling VTX (Video Transmitter) modules via SmartAudio and TRAMP protocols. Based on Betaflight and esp-fc implementations.
Optimized for PlatformIO development.
- SmartAudio protocol support (v1, v2, v2.1) - fixed 4800 baud
- TRAMP protocol support - fixed 9600 baud
- Frequency control (5000-5999 MHz)
- Power level control (25mW - 800mW typical)
- Pit mode support
- TX-only mode (no RX needed, as per esp-fc)
- Dummy byte transmission for UART stabilization
- Non-blocking operations
- Manual protocol selection (VTX_PROTOCOL_SMARTAUDIO / VTX_PROTOCOL_TRAMP)
- CRC validation for SmartAudio
- Checksum validation for TRAMP
- Thread-safe (FreeRTOS compatible)
Method 1: From GitHub
Add to your platformio.ini:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
https://github.com/igorka48/BetaVTXControl.gitMethod 2: Local Development
Copy the library to your project's lib/ directory.
- Download the latest release
- Sketch → Include Library → Add .ZIP Library
- Select the downloaded file
Note: Examples are provided as .ino files for Arduino IDE compatibility, but #include <Arduino.h> is included for PlatformIO.
Important: Only TX pin (GPIO 16) is needed - VTX control wire connects to TX only.
ESP32 GPIO 16 (TX) ────── VTX Control Wire (SmartAudio/TRAMP)
ESP32 GND ───────────────── VTX GND
Notes:
- Both protocols use half-duplex UART on a single wire
- TX-only mode: Commands sent, no response expected
- SmartAudio: 4800 baud, 8N2
- TRAMP: 9600 baud, 8N1
- Check VTX voltage level (3.3V or 5V) - use level shifter if needed
#include <BetaVTXControl.h>
#define VTX_TX_PIN 16 // ESP32 GPIO pin for VTX control
BetaVTXControl vtx(VTX_PROTOCOL_SMARTAUDIO); // or VTX_PROTOCOL_TRAMP
void setup() {
Serial.begin(115200);
if (vtx.begin(&Serial2, VTX_TX_PIN)) {
vtx.setFrequency(5732); // R3 (Raceband 3)
delay(300); // IMPORTANT: Wait between commands
vtx.setPower(200); // 200mW
delay(300);
vtx.setPitMode(false);
delay(300);
}
}
void loop() {
delay(100); // TX-only: configure once in setup()
}Enable debug output to see raw HEX commands sent to VTX:
#include <BetaVTXControl.h>
#define VTX_TX_PIN 16
BetaVTXControl vtx(VTX_PROTOCOL_SMARTAUDIO);
void setup() {
Serial.begin(115200);
// Enable debug: pass Serial as third parameter
if (vtx.begin(&Serial2, VTX_TX_PIN, &Serial)) {
vtx.setFrequency(5732);
delay(300);
}
}
void loop() {
delay(100);
}Debug output example:
[SmartAudio] Debug enabled
[SmartAudio] AA 55 09 02 16 64 7E
[SmartAudio] AA 55 05 01 00 C4
Important Notes:
- SmartAudio: Power is specified in mW but converted to device index (0-4)
- TRAMP: Power is sent directly in mW
- Always add 300ms delay between commands to ensure VTX processes each one
- Some VTX devices may require longer delays (500ms+)
BetaVTXControl vtx(VTX_PROTOCOL_SMARTAUDIO); // or VTX_PROTOCOL_TRAMP
bool begin(HardwareSerial* serial, uint8_t txPin = 16);| Method | Parameters | Description |
|---|---|---|
setFrequency(freq) |
uint16_t freq |
Set frequency in MHz (5000-5999) |
setPower(power) |
uint16_t power |
Set power in mW (25, 200, 400, 600, 800) |
setPitMode(enable) |
bool enable |
Enable/disable pit mode (low power) |
Note: TX-only mode - commands are sent immediately, no response expected. Add 300ms delay between commands.
#include <SmartAudio.h>
SmartAudioVTX vtx;
vtx.begin(&Serial2, 16); // TX pin
#include <TRAMP.h>
TrampVTX vtx;
vtx.begin(&Serial2, 16); // TX pin| SmartAudio | TRAMP | |
|---|---|---|
| Baudrate | 4800 (8N2) | 9600 (8N1) |
| Validation | CRC8 (0xD5) | Checksum |
| Packet Start | 0xAA 0x55 |
0x0F |
| Versions | v1, v2, v2.1 | - |
See frequency tables for channel mappings.
VTX not responding:
- Check wiring (TX on GPIO 16, common GND)
- Verify VTX is powered
- Check voltage levels (use level shifter for 5V VTX)
- Try opposite protocol (SmartAudio ↔ TRAMP)
Commands ignored:
- VTX may be in race lock mode
- Add 300ms delays between commands
- Power cycle VTX
Power commands not working (SmartAudio):
- SmartAudio uses power index (0-4), not direct mW
- Different VTX models have different power tables
- Try
setPowerByIndex(0)throughsetPowerByIndex(4)to find working values - Example:
vtx.setPowerByIndex(2)might be 400mW on your VTX
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push and create a Pull Request
MIT License - see LICENSE file for details.
Based on Betaflight VTX implementation (GPL-3.0).
- Betaflight - Original protocol implementation
- esp-fc - ESP32 flight controller implementation
- SmartAudio protocol by TBS (Team BlackSheep)
- TRAMP protocol by ImmersionRC
- Issues: GitHub Issues
- Discussions: GitHub Discussions