ELEVON CONTROLLER · MASTERCLASS SIMULATOR · BUG-FIXED
The F-22 NX4 EVO is a custom digital flight controller for RC delta-wing aircraft running on the ESP8266 with onboard 802.11 Wi-Fi. It implements elevon mixing, sensor fusion, and proportional angle-hold stabilisation in a 250 Hz control loop.
revRight=true). Simulation must apply physR = −(rightOut−1500)/500 before computing moments. Without this, aileron input produces pitch moment and vice-versa.| Signal | NodeMCU | GPIO | Dir | Protocol | Notes |
|---|---|---|---|---|---|
| MPU-6050 SDA | D2 | GPIO4 | Bidir | I²C Data | Addr 0x68 |
| MPU-6050 SCL | D1 | GPIO5 | Out | I²C Clock | 400 kHz fast mode |
| CH1 Aileron | D7 | GPIO13 | In | RC PWM | 1000–2000 µs @ 50 Hz |
| CH2 Elevator | D8 | GPIO15 | In | RC PWM | 1000–2000 µs @ 50 Hz |
| CH3 Throttle | D5 | GPIO14 | In | RC PWM | 1000–2000 µs @ 50 Hz |
| CH5 Mode | D0 | GPIO16 | In | RC PWM | <1300 PASS · ≥1300 STAB |
| Left Elevon | D4 | GPIO2 | Out | Servo PWM | 50 Hz; revLeft configurable |
| Right Elevon | D3 | GPIO0 | Out | Servo PWM | 50 Hz; revRight=true in hardware! |
| ESC/Throttle | D6 | GPIO12 | Out | ESC PWM | Direct CH3 passthrough |
The F-22 uses elevons: combined elevator+aileron surfaces. A tailless delta wing has no dedicated horizontal stabiliser, so the single trailing-edge surface pair must generate both pitch and roll simultaneously.
Pitch UP (reflex): Both elevons trailing-edge DOWN → symmetric → increases aft camber → shifts lift behind CoG → nose-up moment.
Roll RIGHT: Left elevon DOWN, right elevon UP → differential lift → rolling moment.
Two sensor sources with complementary error profiles are blended: gyro is fast but drifts; accelerometer is drift-free but noisy. The filter weights them by frequency band.
| Sensor | Fast? | Drifts? | Noisy? |
|---|---|---|---|
| Gyro ±500°/s | ✓ | ✓ Yes | Low |
| Accel ±4g | ✗ | ✗ Never | High |
| CF Fused | ✓ | ✓ Corrected | Low |
Raw RC deviation (±500 µs) passes directly to elevon mixer. IMU updates silently — always primed.
Angle-hold P-controller. Stick maps to ±maxStickAngle° target. Autopilot closes error every 4 ms. Max authority ±400 µs.
| Constant | Default | Increase effect | Decrease effect |
|---|---|---|---|
COMP_FILTER_ALPHA | 0.98 | More gyro → faster, more drift | More accel → less drift, more noise |
HOLD_P_GAIN | 8.0 µs/° | Stronger → risk oscillation | Weaker → sluggish levelling |
MAX_STICK_ANGLE | 3.0° | More agile, harder to fly | Gentle, strong self-levelling |
MAX_CORRECTION | 400 µs | More autopilot authority | Limits recovery force |