Files

README.md

BCFlight ๐Ÿš

<![CDATA[]]>Build Status<![CDATA[]]> <![CDATA[]]>Tests Status<![CDATA[]]> <![CDATA[]]> GPL v3<![CDATA[]]>

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

<![CDATA[]]>Build Status<![CDATA[]]>

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
<![CDATA[]]>2023-07-18-raspbian-bcflight.img<![CDATA[]]> 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

<![CDATA[]]>Demo video<![CDATA[]]>

More videos on <![CDATA[]]>YouTube @drichfpv<![CDATA[]]>

๐Ÿ–ฅ๏ธ User Interface

PC Controller

Camera view

Sensors and Telemetry

Sensors view

๐Ÿ”Œ Hardware

Custom CM4 Carrier Board

CM4 schematics

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

CM4 front CM4 back CM4 on drone

๐Ÿ“š 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.

โš ๏ธ 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.

Report a bug