12 Commits

Author SHA1 Message Date
Oleg Kalachev 4530c05b5c Add Flix 1.5 to builds 2026-05-17 06:46:11 +03:00
Oleg Kalachev 3816ae376f Bring back initializing the lpf with the first input value
It's much better for voltage measuring and slightly better for gyro bias estimation.
2026-05-17 06:21:13 +03:00
Oleg Kalachev 72a72fde80 Some docs improvements 2026-05-14 21:59:15 +03:00
Oleg Kalachev e53051a349 Fix console command parsing 2026-05-13 06:00:51 +03:00
Oleg Kalachev f8a9f1f838 Remove reboot requirement when changing RC_RX_PIN 2026-05-13 01:27:01 +03:00
Oleg Kalachev 76af83fc88 Improve firmware overview article 2026-05-13 00:35:43 +03:00
Oleg Kalachev dd176180a7 Update help message
Remove 'welcome to', add copyright and repo link.
2026-05-12 17:50:28 +03:00
Oleg Kalachev 48c33c7050 Fix and improve wifi subsystem
Fix a fault when wifi is disabled (udp can't be used without wifi).
Print RSSI and channel in wifi command.
2026-05-10 22:39:34 +03:00
Oleg Kalachev 35e94f6ea6 Support ESP32-C3
User Serial1 for rc instead of Serial2, as ESP32-C3 has only 2 Serials.
Add CI build for ESP32-C3.
2026-05-10 21:07:20 +03:00
Oleg Kalachev 1f48e379e3 Improve the rc calibration code
More convenient steps order.
Improve the readability a bit.
2026-05-10 19:05:27 +03:00
Oleg Kalachev ee3c6999ab Add mavlink joystick app usage to the docs 2026-05-10 14:50:27 +03:00
Oleg Kalachev 34c6993842 Some fixes in the docs 2026-05-10 02:33:03 +03:00
14 changed files with 95 additions and 29 deletions
+2
View File
@@ -23,6 +23,8 @@ jobs:
with:
name: firmware-binary
path: flix/build
- name: Build firmware for ESP32-C3
run: make BOARD=esp32:esp32:esp32c3
- name: Build firmware for ESP32-S3
run: make BOARD=esp32:esp32:esp32s3
- name: Check c_cpp_properties.json
+6 -8
View File
@@ -71,8 +71,8 @@ Additional articles:
|Type|Part|Image|Quantity|
|-|-|:-:|:-:|
|Microcontroller board|ESP32 Mini|<img src="docs/img/esp32.jpg" width=100>|1|
|IMU (and barometer¹) board|GY91, MPU-9265 (or other MPU9250/MPU6500 board)<br>ICM20948V2 (ICM20948)³<br>GY-521 (MPU-6050)³⁻¹|<img src="docs/img/gy-91.jpg" width=90 align=center><br><img src="docs/img/icm-20948.jpg" width=100><br><img src="docs/img/gy-521.jpg" width=100>|1|
|Microcontroller board|ESP32 Mini.<br>ESP32-S3/ESP32-C3 boards are also supported.|<img src="docs/img/esp32.jpg" width=100>|1|
|IMU (and barometer¹) board|GY91, MPU-9265 (or other MPU9250/MPU6500 board)<br>ICM20948V2 (ICM20948)<br>GY-521 (MPU-6050)|<img src="docs/img/gy-91.jpg" width=90 align=center><br><img src="docs/img/icm-20948.jpg" width=100><br><img src="docs/img/gy-521.jpg" width=100>|1|
|Boost converter (optional, for more stable power supply)|5V output|<img src="docs/img/buck-boost.jpg" width=100>|1|
|Motor|8520 3.7V brushed motor.<br>Motor with exact 3.7V voltage is needed, not ranged working voltage (3.7V — 6V).<br>Make sure the motor shaft diameter and propeller hole diameter match!|<img src="docs/img/motor.jpeg" width=100>|4|
|Propeller|55 mm or 65 mm|<img src="docs/img/prop.jpg" width=100>|4|
@@ -152,18 +152,16 @@ You can see a user-contributed [variant of complete circuit diagram](https://mir
|-|-|
|GND|GND|
|VIN|VCC (or 3.3V depending on the receiver)|
|Signal (TX)|GPIO4¹|
|Signal (TX)|GPIO4|
*¹ — UART2 RX pin was [changed](https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#id14) to GPIO4 in Arduino ESP32 core 3.0.*
* Optionally connect the battery voltage divider for voltage monitoring to any ADC1 pin (e. g. *GPIO32* on ESP32, *GPIO3* on ESP32-S3).
* Optionally connect the battery voltage divider for voltage monitoring to any ADC1 pin (e. g. *GPIO32* on ESP32, *GPIO3* on ESP32S3).
ESP32 and ESP32S3 [can measure](https://docs.espressif.com/projects/arduino-esp32/en/latest/api/adc.html#analogsetattenuation) up to 3.1 V and ESP32S3/ESP32C3 can measure up to 2.5 V, so choose the voltage divider resistors accordingly.
ESP32 and ESP32-S3 [can measure](https://docs.espressif.com/projects/arduino-esp32/en/latest/api/adc.html#analogsetattenuation) up to 3.1 V and ESP32-S3/ESP32-C3 can measure up to 2.5 V, so choose the voltage divider resistors accordingly.
## Resources
* Telegram channel on developing the drone and the flight controller (in Russian): https://t.me/opensourcequadcopter.
* Official Telegram chat: https://t.me/opensourcequadcopterchat.
* Official Telegram chat: https://t.me/opensourcequadcopterchat (English / Russian).
* Detailed article on Habr.com about the development of the drone (in Russian): https://habr.com/ru/articles/814127/.
## Disclaimer
+29
View File
@@ -67,6 +67,35 @@ In order to add a console command, modify the `doCommand()` function in `cli.ino
>
> For on-the-ground commands, use `pause()` function, instead of `delay()`. This function allows to pause in a way that MAVLink connection will continue working.
### Parameter subsystem
Parameters subsystem (`parameters.ino`) uses standard [Preferences.h](https://docs.espressif.com/projects/arduino-esp32/en/latest/tutorials/preferences.html) ESP32 library to store parameters in non-volatile memory. Each parameter is a regular global variable, which is registered in the `parameters` array.
To add a new parameter:
1. Define a global variable for the parameter, two types are supported: `float` and `int`.
2. Add an entry to the `parameters` array, with the parameter name, a pointer to the variable, and optionally a callback function to call when the parameter is changed.
3. Everything else will be handled automatically.
See examples of adding new parameters in commits: [c434107](https://github.com/okalachev/flix/commit/c434107), [a687303](https://github.com/okalachev/flix/commit/a687303).
## Adding a subsystem
To add a new subsystem:
1. Create a new `*.ino` file for your subsystem.
2. Define setup and loop functions for the subsystem, for example `setupMySubsystem()` and `loopMySubsystem()`.
3. Use `Rate` class if you need to limit the loop frequency, for example:
```cpp
Rate mySubsystemRate(100); // 100 Hz
void loopMySubsystem() {
if (!mySubsystemRate) return;
// Do something...
}
4. Add setup and loop calls in to `setup()` and `loop()` functions in `flix.ino`.
## Building the firmware
See build instructions in [usage.md](usage.md).
Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

+15 -3
View File
@@ -138,7 +138,7 @@ Before flight you need to calibrate the accelerometer:
If using non-default motor pins, set the pin numbers using the parameters: `MOTOR_PIN_FL`, `MOTOR_PIN_FR`, `MOTOR_PIN_RL`, `MOTOR_PIN_RR` (front-left, front-right, rear-left, rear-right respectively).
Certain ESP32 models (such as ESP32-S3) support a lower maximum PWM frequency; on these boards the parameter `MOT_PWM_FREQ` should be set to 38000 Hz.
Certain ESP32 models (such as ESP32-S3 and ESP32-C3) support a lower maximum PWM frequency; on these boards the parameter `MOT_PWM_FREQ` should be set to 38000 Hz.
If using brushless motors and ESCs:
@@ -192,6 +192,18 @@ There are several ways to control the drone's flight: using **smartphone** (Wi-F
### Control with a smartphone
#### Using Mavlink Joystick app (Android)
<img src="https://github.com/goldarte/mavlink-joystick/blob/master/app_screen.png?raw=true" width="400">
1. Download and install [Mavlink Joystick app](https://github.com/goldarte/mavlink-joystick/releases/latest).
2. Power the drone using the battery.
3. Connect your smartphone to the appeared `flix` Wi-Fi network (password: `flixwifi`).
4. Open Mavlink Joystick app. It should connect and begin showing the drone's telemetry automatically.
5. Use the virtual joystick to fly the drone!
#### Using QGroundControl app
1. Install [QGroundControl mobile app](https://docs.qgroundcontrol.com/master/en/qgc-user-guide/getting_started/download_and_install.html#android) on your smartphone.
2. Power the drone using the battery.
3. Connect your smartphone to the appeared `flix` Wi-Fi network (password: `flixwifi`).
@@ -204,11 +216,11 @@ There are several ways to control the drone's flight: using **smartphone** (Wi-F
### Control with a remote control
Before using SBUS-connected remote control you need to enable SBUS and calibrate it:
If using SBUS-connected remote control you need to enable SBUS and calibrate it:
1. Connect to the drone using QGroundControl.
2. In parameters, set the `RC_RX_PIN` parameter to the GPIO pin number where the SBUS signal is connected, for example: 4. Negative value disables SBUS.
3. Reboot the drone to apply changes.
3. Check if the receiver is working using `rc` command in the console.
4. Open the console, type `cr` command and follow the instructions to calibrate the remote control.
5. Use the remote control to fly the drone!
+8
View File
@@ -12,6 +12,14 @@ Description: XR2981 based DC-DC converter, ELRS MINI 2.4GHz RX SX1280 receiver (
---
Author: Oleg Kalachev.<br>
Description: the first attempt on making an official PCB based Flix drone (Flix2 board). The IMU is not working on this version, so an external MPU-6050 board was used, therefore considered as **Flix version 1.5**.<br>
[Flight video](https://drive.google.com/file/d/1R7tuUsFmPY0CGcOCFfMFaCp9kR49K3bl/view?usp=sharing).
<img src="img/flix1.5.jpg" width=300>
---
Author: [FanBy0ru](https://https://github.com/FanBy0ru).<br>
Description: custom 3D-printed frame.<br>
Frame STLs and flight validation: https://cults3d.com/en/3d-model/gadget/armature-pour-flix-drone.
+2 -1
View File
@@ -19,13 +19,14 @@ extern LowPassFilter<Vector> gyroBiasFilter;
extern float voltage;
const char* motd =
"\nWelcome to\n"
" _______ __ __ ___ ___\n"
"| ____|| | | | \\ \\ / /\n"
"| |__ | | | | \\ V /\n"
"| __| | | | | > <\n"
"| | | `----.| | / . \\\n"
"|__| |_______||__| /__/ \\__\\\n\n"
"(C) Oleg Kalachev\n"
"https://github.com/okalachev/flix\n\n"
"Commands:\n\n"
"help - show help\n"
"p - show all parameters\n"
+8 -1
View File
@@ -14,6 +14,10 @@ public:
LowPassFilter(float alpha): alpha(alpha) {};
T update(const T input) {
if (!init) {
init = true;
return output = input;
}
return output += alpha * (input - output);
}
@@ -22,6 +26,9 @@ public:
}
void reset() {
output = T(); // set to zero
init = false;
}
private:
bool init = false;
};
+1 -1
View File
@@ -86,7 +86,7 @@ Parameter parameters[] = {
{"MOT_PWM_MIN", &pwmMin},
{"MOT_PWM_MAX", &pwmMax},
// rc
{"RC_RX_PIN", &rcRxPin},
{"RC_RX_PIN", &rcRxPin, setupRC},
{"RC_ZERO_0", &channelZero[0]},
{"RC_ZERO_1", &channelZero[1]},
{"RC_ZERO_2", &channelZero[2]},
+11 -11
View File
@@ -6,7 +6,7 @@
#include <SBUS.h>
#include "util.h"
SBUS rc(Serial2);
SBUS rc(Serial1);
int rcRxPin = -1; // -1 means disabled
uint16_t channels[16]; // raw rc channels
@@ -55,18 +55,18 @@ void calibrateRC() {
print("RC_RX_PIN = %d, set the RC pin!\n", rcRxPin);
return;
}
uint16_t zero[16];
uint16_t center[16];
uint16_t max[16];
uint16_t zero[16]; // for zero positions
uint16_t center[16]; // for center positions
uint16_t _[16]; // for unused data
print("1/8 Calibrating RC: put all switches to default positions [3 sec]\n");
pause(3);
calibrateRCChannel(NULL, zero, zero, "2/8 Move sticks [3 sec]\n... ...\n... .o.\n.o. ...\n");
calibrateRCChannel(NULL, center, center, "3/8 Move sticks [3 sec]\n... ...\n.o. .o.\n... ...\n");
calibrateRCChannel(&throttleChannel, zero, max, "4/8 Move sticks [3 sec]\n.o. ...\n... .o.\n... ...\n");
calibrateRCChannel(&yawChannel, center, max, "5/8 Move sticks [3 sec]\n... ...\n..o .o.\n... ...\n");
calibrateRCChannel(&pitchChannel, zero, max, "6/8 Move sticks [3 sec]\n... .o.\n... ...\n.o. ...\n");
calibrateRCChannel(&rollChannel, zero, max, "7/8 Move sticks [3 sec]\n... ...\n... ..o\n.o. ...\n");
calibrateRCChannel(&modeChannel, zero, max, "8/8 Put mode switch to max [3 sec]\n");
calibrateRCChannel(NULL, _, zero, "2/8 Move sticks [3 sec]\n... ...\n... .o.\n.o. ...\n");
calibrateRCChannel(&throttleChannel, zero, _, "3/8 Move sticks [3 sec]\n.o. ...\n... .o.\n... ...\n");
calibrateRCChannel(NULL, _, center, "4/8 Move sticks [3 sec]\n... ...\n.o. .o.\n... ...\n");
calibrateRCChannel(&yawChannel, center, _, "5/8 Move sticks [3 sec]\n... ...\n..o .o.\n... ...\n");
calibrateRCChannel(&pitchChannel, zero, _, "6/8 Move sticks [3 sec]\n... .o.\n... ...\n.o. ...\n");
calibrateRCChannel(&rollChannel, zero, _, "7/8 Move sticks [3 sec]\n... ...\n... ..o\n.o. ...\n");
calibrateRCChannel(&modeChannel, zero, _, "8/8 Put mode switch to max [3 sec]\n");
printRCCalibration();
}
+4 -1
View File
@@ -36,11 +36,14 @@ float wrapAngle(float angle) {
// Trim and split string by spaces
void splitString(String& str, String& token0, String& token1, String& token2) {
str.trim();
if (str.isEmpty()) return;
char chars[str.length() + 1];
str.toCharArray(chars, str.length() + 1);
token0 = strtok(chars, " ");
token1 = strtok(NULL, " "); // String(NULL) creates empty string
token1 = strtok(NULL, " ");
token2 = strtok(NULL, "");
if (token1.c_str() == NULL) token1 = "";
if (token2.c_str() == NULL) token2 = "";
}
// Rate limiter
+5
View File
@@ -24,6 +24,8 @@ void setupWiFi() {
WiFi.softAP(storage.getString("WIFI_AP_SSID", "flix").c_str(), storage.getString("WIFI_AP_PASS", "flixwifi").c_str());
} else if (wifiMode == W_STA) {
WiFi.begin(storage.getString("WIFI_STA_SSID", "").c_str(), storage.getString("WIFI_STA_PASS", "").c_str());
} else {
return;
}
WiFi.setSleep(false); // disable power save
udp.begin(udpLocalPort);
@@ -37,6 +39,7 @@ void sendWiFi(const uint8_t *buf, int len) {
}
int receiveWiFi(uint8_t *buf, int len) {
if (WiFi.softAPgetStationNum() == 0 && !WiFi.isConnected()) return 0;
udp.parsePacket();
if (udp.remoteIP()) udpRemoteIP = udp.remoteIP();
return udp.read(buf, len);
@@ -57,10 +60,12 @@ void printWiFiInfo() {
print("SSID: %s\n", WiFi.SSID().c_str());
print("Password: ***\n");
print("IP: %s\n", WiFi.localIP().toString().c_str());
print("RSSI: %d dBm\n", WiFi.RSSI());
} else {
print("Mode: Disabled\n");
return;
}
print("Channel: %d\n", WiFi.channel());
print("Remote IP: %s\n", udpRemoteIP.toString().c_str());
print("MAVLink connected: %d\n", mavlinkConnected);
}
+1 -1
View File
@@ -151,7 +151,7 @@ public:
void setRxInvert(bool invert) {};
};
HardwareSerial Serial, Serial2;
HardwareSerial Serial, Serial1, Serial2;
class EspClass {
public:
+2 -1
View File
@@ -43,9 +43,10 @@ void print(const char* format, ...);
void pause(float duration);
void doCommand(String str, bool echo);
void handleInput();
void setupRC();
void normalizeRC();
void calibrateRC();
void calibrateRCChannel(int *channel, uint16_t zero[16], uint16_t max[16], const char *str);
void calibrateRCChannel(int*, uint16_t[16], uint16_t[16], const char*);
void printRCCalibration();
void printLogHeader();
void printLogData();