๐ Advanced dual-core flight control system built for ESP32, featuring real-time LoRa communication, OLED display, and precision servo control for RC aircraft.
- โก Dual-Core Architecture - Dedicated cores for flight control and communication
- ๐ก LoRa Communication - Long-range wireless control with packet validation
- ๐ฅ๏ธ OLED Display - Real-time flight data visualization
- ๐ฎ PS5 Controller Support - Wireless controller integration
- ๐ก๏ธ Safety Systems - Connection timeout and emergency procedures
- ๐ง Advanced Trim Control - Precise flight surface adjustments
- โก Engine/Throttle Control (0-100%)
- ๐ฏ Rudder Control (ยฑ30ยฐ freedom)
- โฌ๏ธโฌ๏ธ Elevator Control (Full range)
- ๐ฉ๏ธ Aileron Control (Dual servo setup)
- ๐ชถ Flap Control (0-4 positions)
- ๐ Emergency Airbrake
- ๐ฎ Manual Mode - Direct pilot control
- ๐ Stability Mode - Computer-assisted stabilization
- ๐ข Acrobatic Mode - High-performance maneuvers
- ๐ฌ Landing Mode - Automated landing assistance
- ๐ฏ ESP32-PICO-D4 (Revision v1.1)
- โก Dual Core 240MHz
- ๐ถ WiFi + ๐ฑ Bluetooth
- ๐พ Embedded Flash
- ๐ฎ 40MHz Crystal
- LoRa Module - Long range control
- OLED Display (SSD1306, I2C) - Status monitoring
- PS5 Controller (Bluetooth) - Primary input
# Install PlatformIO Core
pip install platformio
# Or use PlatformIO IDE extension in VS Code
-
Clone the repository
git clone https://github.com/Arsalan134/Airplane.git cd Airplane
-
Build the project
pio build
-
Upload to ESP32
pio upload
-
Monitor serial output
pio device monitor
๐ Airplane/
โโโ ๐ LICENSE # ๐ MIT License file
โโโ ๐ platformio.ini # ๐ง PlatformIO configuration
โโโ ๏ฟฝ README.md # ๐ This comprehensive documentation
โโโ ๐ README_DUAL_CORE.md # ๐๏ธ Dual-core implementation details
โโโ ๐ include/ # ๐ Header files directory
โ โโโ ๐ Airplane.h # ๐ฉ๏ธ Aircraft class definition
โ โโโ ๐ common.h # ๐ Shared definitions and pin config
โ โโโ ๐ Display.h # ๐บ Display interface and prototypes
โ โโโ ๐ images.h # ๐ผ๏ธ OLED graphics and icons
โ โโโ ๐ main.h # ๐ง Main header includes
โ โโโ ๐ SD-Card.h # ๐พ Storage definitions
โโโ ๐ src/ # ๏ฟฝ Source code directory
โ โโโ ๐ main.cpp # ๏ฟฝ๐ Main dual-core setup and control loop
โ โโโ ๐ Airplane.cpp # โ๏ธ Flight control logic and servo management
โ โโโ ๐ Display.cpp # ๏ฟฝ๏ธ OLED display functions and UI
โ โโโ ๐ Lora.cpp # ๏ฟฝ LoRa communication and protocol handling
โ โโโ ๐ SD-Card.cpp # ๐พ Data logging functionality
โโโ ๐ test/ # ๐ Unit tests directory
โโโ ๏ฟฝ README # ๐ Test documentation
โโโ ๐ test_airplane/ # โ๏ธ Aircraft control tests
โ โโโ ๐ test_airplane.cpp # ๐งช Aircraft functionality unit tests
โโโ ๐ test_lora/ # ๐ก LoRa communication tests
โ โโโ ๐ test_lora.cpp # ๐งช LoRa protocol unit tests
โโโ ๏ฟฝ test_main/ # ๏ฟฝ Main functionality tests
โ โโโ ๐ test_main.cpp # ๐งช Main system integration tests
โ โโโ ๐ test_main_simple.cpp # ๐งช Simplified main function tests
โโโ ๐ test_safety/ # ๏ฟฝ๏ธ Safety system tests
โโโ ๐ test_safety.cpp # ๐งช Safety feature validation tests
main.cpp
: Dual-core task implementation with FreeRTOS schedulingcommon.h
: Shared definitions, pin configurations, and system constantsmain.h
: Function declarations and system-wide includes
Airplane.cpp/.h
: Complete aircraft control logic, servo management, and flight algorithmsDisplay.cpp/.h
: OLED display management with real-time flight data visualizationimages.h
: Graphics definitions, icons, and display assets
Lora.cpp
: LoRa communication protocol, packet handling, and error recoverySD-Card.cpp/.h
: Data logging system for flight data recording
test/
: Comprehensive unit testing suite with dedicated test categoriestest_airplane/
: Aircraft-specific functionality teststest_lora/
: LoRa communication and protocol teststest_main/
: Core system and integration teststest_safety/
: Critical safety system validation tests
README.md
: This comprehensive project documentationREADME_DUAL_CORE.md
: Detailed dual-core architecture implementation guideplatformio.ini
: Build configuration with dual-core optimization flagsLICENSE
: MIT License terms and conditions
The system uses a custom LoRa protocol with the following data structure:
e[engine]a[aileron]r[rudder]l[elevator]t[trim]i[aileron_trim]f[flaps]z[reset_aileron]y[reset_elevator]b[airbrake]#[checksum]
Command | Range | Description | Emoji |
---|---|---|---|
e |
0-180 | Engine throttle | โก |
a |
0-180 | Aileron position (90=center) | ๐ฉ๏ธ |
r |
0-180 | Rudder position (90=center) | ๐ฏ |
l |
0-180 | Elevator position (90=center) | โฌ๏ธโฌ๏ธ |
t |
-1,0,1 | Elevator trim adjustment | ๐ง |
i |
-1,0,1 | Aileron trim adjustment | ๐ง |
f |
0-4 | Flap position | ๐ชถ |
z |
0-1 | Reset aileron trim | ๐ |
y |
0-1 | Reset elevator trim | ๐ |
b |
0-1 | Airbrake activation | ๐ |
- โ XOR Checksum - Packet integrity verification
- โฑ๏ธ Connection Timeout - 2 second failsafe
- ๐จ Emergency Procedures - Auto-safe mode on signal loss
- ๐ Packet Validation - Malformed packet rejection
The OLED display shows real-time flight data:
- ๐ฏ Aileron position
- โฌ๏ธโฌ๏ธ Elevator position
- ๐ฏ Rudder position
- ๐ง Trim values (elevator & aileron)
- ๐ถ Signal strength (RSSI)
- โฑ๏ธ Last packet time
- โก Engine power percentage
- ๐ชถ Flap position
- ๐จโ
โ๏ธ Pilot identification
- ๐ฉ๏ธ Real-time servo control
- ๐จ Emergency safety systems
- ๐ Performance monitoring
- ๐ 100Hz update rate
- ๐ป LoRa packet handling
- ๐ฅ๏ธ Display updates
- ๐ฑ Bluetooth management
- ๐ 50Hz update rate
- Connection Loss - Automatic safe mode activation
- Invalid Packets - Ignore corrupted data
- Hardware Timeout - Servo centering
- Memory Protection - Mutex-based data sharing
- โก Engine: 0% (Motor off)
- ๐ฉ๏ธ All control surfaces: Center position (90ยฐ)
- ๐ Flight mode: Stability mode
- ๐ Airbrakes: Deactivated
The system provides real-time performance metrics:
- ๐ Update Frequencies - Per-core execution rates
- ๐พ Memory Usage - Heap and stack monitoring
- โฑ๏ธ Task Timing - Microsecond precision logging
- ๐ Communication Stats - Packet success rates
We welcome contributions! Here's how you can help:
- ๐ด Fork the repository
- ๐ Create a feature branch (
git checkout -b feature/amazing-feature
) - ๐พ Commit your changes (
git commit -m 'โจ Add amazing feature'
) - ๐ค Push to the branch (
git push origin feature/amazing-feature
) - ๐ Open a Pull Request
- ๐ฑ Mobile app development
- ๐งช Unit testing
- ๐ Documentation improvements
- ๐ง Hardware integration
- ๐ฉ๏ธ Flight algorithms
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฉ๏ธ Arsalan Iravani
- ๐ง Email: airavani2018@gmail.com
- ๐ GitHub: @Arsalan134
- ๐ ESP32 Community - For excellent hardware support
- ๐ก LoRa Alliance - For long-range communication standards
- ๐ฎ Gaming Community - For PS5 controller integration inspiration
โ๏ธ RC Aviation Community - For flight control insights
- ๐๏ธ Started: 2024
- ๐ป Language: C++ (Arduino Framework)
- ๐ฏ Target: ESP32-PICO-D4
- ๐ฆ Dependencies: PlatformIO, Arduino, LoRa
- ๐ท๏ธ Version: 1.0.0