-
Using PCA9685 with INAV
One of the hardware limitations of flight controllers that usually multirotor users ignores is a number of PWM outputs. To fly a quadcopter you need "only" 4 PWM outputs. Since most FCs have 6 outputs and 90% of multirotors are quadcopters, there is no problem.
In case of airplanes, this is not that simple. 6 PWM outputs is an absolute minimum to fly a classic airplane using MultiWii and derivatives (Baseflight, Cleanflight, INAV): 2 outputs reserved for motors, 2 ailerons, elevator, rudded. Suddenly, 6 outputs barely meets the requirements. If you want flaps, gas engine, pan & tilt or anything else, you are missing some outputs.
For some time INAV tries to address this issue by supporting external PWM driver: PCA9685.
-
SmartPort inverter for F4 flight controllers
While STM32F4 family processors installed in newest flight controllers are superior to STM32F3 (and F1 of course) in terms of raw speed, they are inferior to F3 family in terms of IO handling capabilities. For example, F4 family is not equipped with UART port inverters. Just take a look at the Omnibus F4 flight controller. There is an S.BUS inverter, but not a SmartPort inverter. That creates a series of problems when it comes to connecting various serial RX receivers and telemetry systems.
The most popular FrSky (Futaba) S.Bus serial RX protocol and FrSky SmartPort telemetry require inverted UART signal. If there is no hardware inverter on hardware UART port, they will not work. While S.Bus requires only one data line, an external inverter is not a big issue. Some time ago I've published The Simplest Hardware Inverter. One MOSFET transistor, one resistor and that are all.
In the case of SmartPort, it's slightly more complicated. Not only signal is inverted, SmartPort also combines TX and RX UART line into a single wire. That means the following:
- The more complicated inverter is required
- The software has to support this case and fallback to unidirectional UART mode
Hardware
-
INAV: Launch mode video tutorial
One of the best new features of INAV 1.4 was Launch assistant mode (NAV LAUNCH). It greatly simplified the process of hand launching a fixed wing. All you had to do was to throw it into the air. INAV detected the throw, engaged motor(s) and stabilized flight and kept constant climb rate in the initial flight phase. INAV 1.5 will make it even better: it will also allow swing launch!
Since INAV 1.5 should be release in next 2 days, and there is very little info on INAV Launch mode, I've decided to create a short video showing how to do it.
Read more... -
INAV: how to setup asynchronous gyro
Together with version 1.4, INAV introduced asynchronous gyroscope processing. What is async gyro and why it is useful to have it, you can read here. In short worlds: data from gyroscope is read and filtered faster than PID controller updates motor and servo output.
When it is worth to enable asynchronous processing
In general, async gyro can be enabled when:
- Flight controller does not ave enough processing power to run control loop faster than 2000us (500Hz mode). This is the case for all SMT32F1 boards like Naze32, Flip32 or CC3D
- Flight controller is powerful enough to process PID control loop faster than ESC protocol (PWM, Oneshot125, Multishot) transfer commands to ESC and servos. This is usually true in case of all STM32F4 boards
- INAV is setup on a "racer" machine that requires the best gyro signal possible
Async gyro should not be enabled when gyro and control loop frequency are the same. For example, 1kHz gyro and 1kHz control loop would give worse results than 1kHz synchronous processing. Read more...
-
Simplest hardware inverter for flight controller
Together with increasing popularity of STM32F4 flight controllers, telemetry became hard topic again. Why? Most popular telemetry protocols, SmartPort and FrSky telemetry , requires inverted signal. Zero becomes one, one becomes zero.
In case on STM32F3 that was not a big problem. Those CPUs have built in inverters. STM32F1 and STM32F4 does not. So, if flight controller designer did not put external inverters on UART ports, FrSky telemetry, SmartPort and even S.Bus would not work.
Luckily, simple inverter for FrSky telemetry and S.Bus can be build using only few electronic parts:
- Small logic level N-channel MOSFET transistor. One of the best choices is 2N7000
- 10kOhm resistor
- few cables
-
Flip32 F4 and Airbot F4 Software Serial
When STM32F4 based flight controllers made its way to the world of MultiWii derivatives (Cleanflight and whole family), all I think all developers assumed that SoftwareSerial feature will not be needed on those boards. Why it should be? STM32F4 has enough hardware UARTs to satisfy everyones needs.
Unfortunately, live had it's own point of view on that topic:
- Most F4 flight controllers have only 2 to 3 hardware UARTs available and usually one of them is shared with I2C (Revolution, Airbot F4)
- STM32F4 does not have internal hardware inverters. Hardware manufacturers usually put only one external inverter for S.Bus and that's all
Because of that, Software Serial feature is coming back to F4 boards. Together with INAV 1.5, SoftSerial will be available on Airbot F4 / Flip32 F4 target on two small pads located near UART3 connector. RX line on pad CH5, TX line on CH6 line. Pads are quite small, but with basic soldering skills and decent soldering iron there should be no problems to solder thin cables to them.
Since F4 CPU is much more powerful than F1, limitation of 19200bps on Software Serial UARTs is no longer actual. I have tested 57600bps and 115200bps should be archivable.
Read more... -
INAV Advanced Accelerometer Calibration: why and how
One of the most often forgotten tasks required to bring the most of INAV, is good accelerometer calibration. Why? While flight controller software like Cleanfligth and Betaflight use accelerometer only to compute UAV's body inclination (Angle and Horizon modes as well as artificial horizon), INAV uses it also for position estimation.
Cleanfligt has to only know where "down" is. For this, simple accelerometer calibration is fully enough: place UAV on a level surface and hit "Calibrate accelerometer" button. Few seconds and done.
INAV not only has to know where bottom is. It also has to know where all other directions are, and how fast UAV is accelerating in those directions to be able to estimate its position. For this, advanced, or 6 point accelerometer calibration is required.
How to perform Advanced Accelerometer Calibration [AAC]
During AAC, each side of flight controller has to be positioned "down" during calibration. Order is not important with one exception: during first step, top of flight controller has to positioned up. This is impotrant: we are calibrating accelerometer, not whole UAV. Even is FC is mounted upside-down, during first step, FC has to to positioned upwards.
- Prepare stable surface that will allow to keep FC stable in all required positions. Angles does not have to be super precise, even few degrees should be enough, but flight controller has to be motionless during calibration
- Plug-in USB and connect to INAV Configurator
- Position flight controller facing up and hit "Calibrate acccelerometer" button. Wait for success message
- Rotate FC 180 degrees so it is bottoms-up and hit "Calibrate acccelerometer" button. Wait for success message
- Rotate FC so its rear edge is facing down and hit "Calibrate acccelerometer" button. Wait for success message
- Rotate FC so its right edge is facing down and hit "Calibrate acccelerometer" button. Wait for success message
- Rotate FC so its front edge is facing down and hit "Calibrate acccelerometer" button. Wait for success message
- Rotate FC so its left edge is facing down and hit "Calibrate acccelerometer" button. Wait for success message
- Disconnet and power down
- Advanced accelerometer calibration is done. If is succeeded,
acczero_x
,acczero_y
andacczero_z
should different than0
, whileaccgain_x
,accgain_y
andaccgain_z
should be different than4096
Worth remembering: calibration values can be restored via CLI when flight controller firmware is updated. It is hardware, not software dependent. Calibration should be executed when new hardware is used.
Read more... -
Yaw unstable at full throttle
Last weekend I've experienced quite serious problem with Reptile X4R 220 racing quadcopter: on full throttle quad was loosing stability. At first, it was starting to drift yaw to the right. Then, if throttle was not lowered, roll and pitch was also becoming unstable and quad was doing crazy things in the air.
I do not have a video footage of those issues, but Blackbox footage looks like this:
Roll, Pitch and Yaw sticks are at zero, throttle is raised from aroung 45% up to 90%. When throttle reaches around 80%, gyro starts to record movement on all axises. At one point, yaw gets a kick and reaches more that 200dps. Finally, I lowered throttle and quadcopter stabilized (moment of stabilization is not visible, but trust me, it is there).
The reason for such a behavior became pretty visible as soon as I displayed motor output:
Flight controller requests much more power from Motor #1 than from other motors. Not only in this short scenario. Look at this graph:
FC requests more thrust from Motor #1 almost all the time. Why? Motor #1 provides less thrust than other motors. There are few possible reasons:
- Damaged propeller
- Damaged motor
- Damaged ESC
- ESC not calibrated
In my case, it was ESC calibration issue. While this might sound strange, ESCs loses calibration from time to time. Usually after a crash that resulted in detached battery.
Proper ESC calibration solved all the problems I was experiencing.
Read more... -
STM32 VirtualComPort driver for Windows
Virtual Com Port, VCP to method of choice for almost all recent flight controllers to connect to PCs. No more onboard USB-to-UART converters like CP2102. SMT32 can work as USB device too after all... But for this, Windows users will require dedicated driver.
I have no idea why STMicroelectronics made it so hard do download and use STM32 VCP driver for Windows. You have to register, confirm and then you can download, install package and look for the driver on HDD... Why, oh why....
So, to fix this issue, here it is: STM VCP driver for Windows as a zip, ready for download. Just unzip...
Read more... -
Marabou Stork: Depron airplanes do not last long
Marabou Stork, my Depron FPV airplane had a bad luck. Few weeks ago, when I was testing development version of INAV, it crashed during take off. Poor accelerometer calibration combined with a software bug resulted in heavy roll 2 meters above ground. As a result, whole front section was smashed. Everything else more less survived. Luckily, winter is coming, flying season is more less over. I have few month to rebuild the nose and glue it back into place. With some extra reinforcements.
While Marabou Stork awaits new nose, I still have some footage to show...
Read more...
I'm Paweł Spychalski and I do things. Mainly software development, FPV drones and amateur cinematography. Here are my YouTube channels: