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. And 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, external inverter is not a big issue. Some time ago I’ve published The Simplest Harware Inverter. One MOSFET transistor, one resistor and that’s all.

In case of SmartPort, it’s slightly more complicated. Not only signal is inverted, SmartPort also combines TX and RX UART line into single wire. That means the following:

  1. More complicated inverter is required
  2. Software has to support this case and fallback to unidirectional UART mode

Hardware

Continue reading “SmartPort inverter for F4 flight controllers” »

Read More

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. Continue reading “INAV: how to setup asynchronous gyro” »

Read More

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:

  1. Most F4 flight controllers have only 2 to 3 hardware UARTs available and usually one of them is shared with I2C (Revolution, Airbot F4)
  2. 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.

  1. 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
  2. Plug-in USB and connect to INAV Configurator
  3. Position flight controller facing up and hit “Calibrate acccelerometer” button. Wait for success message
  4. Rotate FC 180 degrees so it is bottoms-up and hit “Calibrate acccelerometer” button. Wait for success message
  5. Rotate FC so its rear edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  6. Rotate FC so its right edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  7. Rotate FC so its front edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  8. Rotate FC so its left edge is facing down and hit “Calibrate acccelerometer” button. Wait for success message
  9. Disconnet and power down
  10. Advanced accelerometer calibration is done. If is succeeded, acczero_x, acczero_y and acczero_z should different than 0, while accgain_x, accgain_y and accgain_z should be different than 4096

Advanced accelerometer calibration

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

What’s new in INAV 1.4

Although INAV 1.4 was not released yet, it’s going to happen very soon. When? Probably in the beginning of a next week. Release Candidate is already available and until now, there are no major bugs discovered.

So, what’s new in INAV 1.4? Quite a few…

  • IMPORTANT: by default, motor output is disabled after flashing. This is to prevent servos from being damaged with too fast PWM rate. User has to enable motor output using Configurator (version 1.4 or newer) or with CLI command feature PWM_OUTPUT_ENABLE
  • Asynchronous gyroscope processing. I’ve described some time ago why this is good idea to have something like this. With 1.4, asynchronous gyroscope is available, but not enabled by default yet. I will try to write a longer article how to set it up later (I hope at least I will find time for it). Until then, this entry in INAV docs is all that has been written on the topic
  • Airplane launch assistant. Launching an airplane with INAV is almost as easy as it can be! You can read documentation on this feature on INAV Wiki
  • Improved throttle PID attenuation (or rather PID scaling) for airplanes. Read documentation on the topic
  • Emergency landing for airplanes
  • Experimental Pitot tube support (logging only) compatible with Pixhawk PX4 Airspeed Sensor
  • Improved handling for GPS+MAG and GPS+BARO configurations. With INAV 1.4 it should be not required to disable MAG and BARO when GPS is used
  • Improved failsafe
  • New targets: Airbot F4 / Flip32 F4, Omnibus F4 and YuPiF4
  • Multiple bugs fixed

Additionally, new version of INAV Configurator has been already released. All users are advised to update! With Configurator 1.4.1 and firmware 1.4 following new features will be available:

  • Possibility to enable motor output
  • Gyroscope hardware filtering (gyro_lpf) and syncing PID loop with gyroscope (gyro_sync) setup
  • Advanced PID tuning now allows to set:
    • Gyroscope software LPF cutoff frequency
    • Accelerometer software LPF cutoff frequency
    • D-term cutoff frequency
    • Yaw P-term cutoff frequency
    • MAG_HOLD yaw rate limit
    • Axis acceleration limits
    • Yaw P limit and yaw jump prevention limit
    • I-term ignore rates

Read More

INAV for Airbot F4 / Flip32 F4 flight controller

INAV 1.3 has been released few hours ago, now I would like to do unofficial release of Flip32 F4 / Airbot F4 target of INAV 1.3. Target was flight tested last weekend.

Airbot F4 / Flip32 F4 reporting for navigational duty, sir!

What is inside:

  • Full 6 motors support
  • 2 motors / 4 servos support, so it can be used on airplanes
  • RSSI ADC on dedicated pin
  • Current meter ADC on dedicated pin
  • S.Bus and PPM working
  • I2C bus works, it is possible to attach external barometer and magnetometer. Tested hardware:
    • Barometeres: BMP085, BMP280 and MS5611
    • Magnetometers: HMC5883l
  • I2C is not initialized when UART3 is configured
  • GPS over UART. Supported protocols: UBLOX, NMEA and NAZA

The only think that is not working, is LED strip support. Looks like there is generic STM32F4 LED strip issue in INAV and we will be able to fix it in reasonable future.

HEX file of INAV for Airbot F4 / Flip32 F4 can be downloaded here.

Read More

INAV 1.3 has been released

I'm happy to announce new version of INAV ready do download from official repository.

What is new in INAV 1.3? Quite a few thinks. No "revolutions", more like steady progress. From most important things:

  • INAV now supports PWM, OneShot124, OneShot42 and Multishot ESC protocols and asynchronous motors and servos updates
  • Something for airplanes with a lot of servos: INAV can now supports PCA9685 PWM drivers and drive up to 16 servos plus motors! Although mixer can not yet support as many servos, this will change in future releases. I will try to write few words on this topic in a near future
  • FlySky I-Bus telemetry
  • Airplane auto arming with throttle option
  • In case of airplanes (again airplane improvement!), I-term of PID controller is constrained to about 30% of max servo throw. This prevents from servo saturation that can happen in some cases before take off
  • I2C improvements for STM32F1 and STM32F4 targets. This solves the problem of undetected BMP085, BMP180 and HMC5883L on Naze32, Flip32, OpenPilot Revolution and other boards
  • Code cleanups, including removal of unused or very rarely used flight modes like SERVO1-3, GOVERNOR, LEDMAX and CAMTRIG

All users are advised to use latest INAV Configurator and reconfigure flight modes is configuration is to be restored from files! Owners or STM32F1 boards should consult hardware support map if features they are using are still supported.

Read More

INAV is learning to do mini-quad racing too

Let's be honest: in terms of mini-quad racing there is Betaflight (probably also Raceflight but I've never flew it yet, so will not comment on its flight performance), long long gap, and then it's everything else including Cleanflight, LibrePilot, INAV etc.

Originally INAV concentrated on "big" UAVs with GPS capabilities. After all NAV in name stands for Navigation. Mini-quads and acro performance were left alone, and once again, let's be honest: comparing to Betaflight, it sucked. It was possible, I've even written a short tutorial how to set it up, but it sucked.

Luckily, it is changing. INAV 1.2 had brought some improvements like Iterm limiting and acceleration limiting, and Acro flying in INAV became very nice. Small revolution, or maybe bigger catch up, is planned for INAV 1.3: asynchronous gyroscope, accelerometer and attitude processing. I've been working on it for last few months and results are very promising: INAV can drive a mini-quad with Betaflight comparable performance. Like this (please remember I'm not the best pilot!)

Setup:

  • PID task frequency: 1kHz
  • Gyro task frequency: 2kHz
  • Accelerometer task frequency: 120Hz
  • Attitude task frequency: 100Hz
  • Frame: Reptile X4R 220
  • Motors: EMAX RS2205 2300KV
  • Propellers: DALprop TJ5045
  • Flight controller: SPracingF3
  • Firmware: INAV 1.2 with custom changes

Read More

Marabou Stork: FPV airplane maiden flight

For the last few week I’ve been little busy building my next fixed wing UAV: “Marabou Stork” Depron/Carbon/3D Printed airplane with pusher prop build for FPV. It’s improved version of “Red Cruiser” model from last year.

marabou stork depron airplane

marabou stork depron airplane 2

It’s equipped with KFm-2 wing, Turnigy D2826-6 2200KV motor, APC-E 7×4″ propeller, 2700mAh Lipo battery, FPV setup with MinimOSD and RunCam PZ0420H camera. And Flip32 running INAV for stabilization and navigation (no GPS yet).

As you can see on a video above, it flies. Even pretty well. It needs some tuning, but have big potential. Unfortunately elevator malfunction grounded it after few minutes in the air.

Read More