Files
README.mdBCFlight ๐
BCFlight is an open-source Linux-based Raspberry Pi drone and ground controller system, offering a complete solution for flight control, stabilization, and telemetry.
๐ Key Features
๐ฏ Performance
- Low resource usage : ~25% CPU and ~100MB RAM on Raspberry Pi 4
- High frequency : Sensors and stabilizer update rate up to 8kHz (on RPi4)
- Ultra-low latency : ~5ms controls latency, ~50ms video latency over composite
- Stabilization : Up to 8 motors with customizable configuration matrix
๐ง Motor Protocols
- DShot (150 & 300) - Recommended
- OneShot125 and OneShot42
- Standard PWM
๐ก Communication
- WiFi/Ethernet : Standard TCP/UDP/IP
- Raw WiFi : Based on wifibroadcast
- Radio : nRF24L01, SX1276/77/78/79 (FSK/LoRa)
- S-BUS : Limited functionality support
๐น Video & Recording
- Composite output : Direct connection to 5GHz VTX modules, with SmartAudio support
- Multi-camera recording : MKV format, up to ~120 MPix/s total throughput
- Gyroflow output : Compatible with Gyroflow for video stabilization
- Live HUD : Real-time telemetry, battery status, speed, acceleration
โ๏ธ Configuration
- LuaJIT : Flexible configuration and customizable event handling
- User code : Execution of custom Lua functions
- Full API : Access to all systems
๐๏ธ Architecture
The project consists of three main components:
๐ flight/ - Flight Controller
Core system managing: - Main thread : Sensor data collection, attitude calculation, stabilization - Controller thread : User input reception, telemetry transmission - Power thread : Battery monitoring and current consumption
๐ฅ๏ธ controller_pc/ - PC Interface
Configurable GUI client for: - Remote control via PC - Sensor and telemetry visualization - Advanced configuration
๐ฎ controller_rc/ - Remote Control
Portable control interface with: - Touchscreen support - Adapted user interface - Lua configuration
๐ Supported Sensors
IMUs
- InvenSense ICM-42605, ICM-20608, MPU-9250, MPU-9150, MPU-6050
- STMicroelectronics L3GD20H, LSM303
Altimeters/Barometers
- Bosch BMP180, BMP280
Others
- HC-SR04 (distance sensors)
- ADS1015/ADS1115 (ADC)
๐ ๏ธ Installation
Pre-built Images
Automatically generated images based on Raspbian:
- SSH : root:bcflight by default
- System : Read-only by default (security)
- Flight Service : Disabled by default for configuration
| Image | Based on | DShot | Analog video |
|---|---|---|---|
| 2023-07-18-raspbian-bcflight.img | 2023-05-03-raspios-bullseye-armhf-lite | โ ยน | โ ยน |
ยน DShot and composite output can be enabled via /boot/config.txt and /var/flight/config.lua
Building from Source
PC Controller (Ubuntu/Debian)
# Dependencies
sudo apt-get install nasm qtmultimedia5-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libiw-dev libfftw3-dev libqscintilla2-qt5-dev
Build
git clone https://github.com/dridri/bcflight.git cd bcflight/controllerpc cmake -DCMAKEBUILDTYPE=Release -S . -B build cd build && make -j$(nproc) ./controllerpc
Flight Controller (Raspberry Pi)
# Dependencies
sudo apt update
sudo apt install git pkg-config cmake make g++ libc6-dev libraspberrypi-dev libiw-dev libdrm-dev libgbm-dev libcamera-dev libgles2-mesa-dev libgps-dev libasound2-dev libcrypt-dev zlib1g-dev libpng-dev libshine-dev libavformat-dev libavutil-dev libavcodec-dev libpigpio-dev lua5.3 libfftw3-dev
Build
git clone https://github.com/dridri/bcflight cd bcflight/flight cmake -Dboard=rpi -Ddebug=1 -S . -B build cd build && make -j$(nproc)
๐ง Configuration
Basic Configuration Example
-- Frame configuration (quadcopter)
frame = Multicopter {
maxspeed = 1.0,
air_mode = {
trigger = 0.25,
speed = 0.15
},
motors = {
DShot( 4 ), DShot( 5 ), DShot( 6 ), DShot( 7 )
},
matrix = {
Vector( -1.0, 1.0, -1.0, 1.0 ),
Vector( 1.0, 1.0, 1.0, 1.0 ),
Vector( -1.0, -1.0, 1.0, 1.0 ),
Vector( 1.0, -1.0, -1.0, 1.0 )
}
}
-- IMU configuration imu = IMU { gyroscopes = { imusensor.gyroscope }, accelerometers = { imusensor.accelerometer }, filters = { rates = { input = Vector( 80, 80, 80 ), output = Vector( 0.25, 0.25, 0.25 ) }, accelerometer = { input = Vector( 350, 350, 350 ), output = Vector( 0.1, 0.1, 0.1 ) } } }
-- PID stabilizer stabilizer = Stabilizer { looptime = 500, -- 2000Hz ratespeed = 1000, -- deg/sec pidroll = PID( 45, 70, 40 ), pidpitch = PID( 46, 70, 40 ), pid_yaw = PID( 45, 90, 2 ) }
๐ฅ Demo
More videos on YouTube @drichfpv
๐ฅ๏ธ User Interface
PC Controller
Sensors and Telemetry
๐ Hardware
Custom CM4 Carrier Board
Features: - 5V 3A LM22676 regulator (max 42V input) - ADS1115 ADC for battery voltage measurement - Dual RFM95W radio sockets with external antennas - High-precision ICM-42605 IMU - BMP581 barometer - Dual CSI camera connectors - Direct composite video output to VTX
Hardware Photos
๐ Documentation
๐ค Contributing
Contributions are welcome! The project is licensed under GPL v3.
๐ License
This project is distributed under the GNU General Public License v3.0. See the LICENSE file for more details.
๐ Useful Links
- CI/CD : ci.drich.fr
- Images : bcflight.drich.fr
- CAD : View on CADLAB.io
โ ๏ธ Warning : This software is provided for educational and research purposes. Drone usage can be dangerous. Please respect local regulations and use at your own risk.