ESP32 and GPS with a help of TinyGPS++ library

One of the first projects I did with ESP32 development boards is a simple GPS tracker. OK, it's not really a tracker since it does not store the position anywhere, more like distance meter with a UBLOX Neo-8M Beitian BN-880 GPS unit and small SSD1306 OLED display.

This ESP32 GPS Thingy as I call it uses one button to store current position and then report straight line distance, speed and altitude compared to "Home Point". GPS communication is handled by TinyGPS++ library.

Oh, one the best things about ESP32 is that you can map ports to almost any pin you want. It's not like on ATmega328 where UART and I2C are always the same pins. Here you can choose them. How nice is that?

Code is available on GitHub.

Matek SAM-M8Q and SAM-M8Q Compass GPS modules hands on

You might say that UBLOX NEO-M8N (Beitian BN-880 for example) is the workhorse on INAV and other drones with GPS functions. It is reliable, well know and proven. But it is also big and heavy. So why not try something new?

Matek did tried something new and just provided me with two brand new GPS modules of their: Matek SAM-M8Q and SAM-M8Q Compass with a QMC5883 magnetometer. One is only a small GPS module suitable for airplanes (flat surface) while the other one has also a QMC5883 compass that makes it a perfect choice for multirotor drones. Let's take a look at those two and figure out if they might be worth it.

The best GPS module for INAV

This is my personal best GPS module for INAV: Beitian BN-880 based on Ublox Neo-M8N. Currently I have 3 pieces of BN-880, all works just great, and if I will have a need to have another one, I would also choose it.

Why? It really works well. On the outside it gets a solid 3D fix in less than a minute. It even can get a fix with 9-10 sats in a center of a city when only a small piece of sky is visible simply by lying on a windowsill. It take time, but works.

Beitian BN-880 - best GPS module for INAV?

Continue reading The best GPS module for INAV

Beitian BN-880 GPS 3D Printed Case

Beitian BN-880 (I’ve bought mine from Banggood) is an excellent, cheap and accurate Ublox NEO-M8N GPS module. I’m using it for last few months and I’m very happy with it. But is has one serious flaw: there are no cases/enclosures for it. So, in most applications it is naked. I’ve decided to fix that and designed 3D printed Beitian BN-880 case.

Beitian BN-880 3D printed case

Beitian BN-880 Case in Cura

Case can be dowloaded from Thingverse

iNav: Waypoint Mission

This video was taken few weeks ago during my tests of Waypoint Mission implemented in iNav.

Hardware setup:

  • Transporter Q7.6 600mm quadcopter frame
  • SPRacingF3 Acro with BMP085 external barometer
  • Beitian BN-880 (ublox Neo-M8M)
  • 10×4.5" APC props
  • EMAX GT2218/08 1100KV motors
  • 5000mAh 3S battery

Software setup:

  • iNav pre 1.1
  • Default navigation PIDs
  • Slightly tuned FP-PID, quite close to default values
  • GPS nav model: HIGH_G set gps_nav_model=HIGH_G
  • Velocity calculation done by GPS module set inav_use_gps_velned=ON

Mission plan:

  1. Take off in Angle model
  2. Follow 3 waypoints on total distance of about 300m, constant altitude of 10m
  3. At last waypoint goto Position Hold mode
  4. Manually engage Return To Home mode
  5. Automatic RTH and land

iNav: RTH with land mission

This video was taken last weekend during tests of latest changes implemented in iNav, as well as new GPS module Beitian BN-880 I shortly described here.
Mission plan:

  • Take off in Angle mode,
  • Engage 3D Position Hold
  • Fly away 100m
  • Return to Position Hold
  • Engage Return To Home mode

Summary:

  • Beitian BN-880 performed well. Quadcopter returned home with 1m accuracy. Constant fix on 15 sats all the time and HDOP at 1.2
  • No problems with magnetometer inside GPS module
  • No bigger problems during whole mission. I still have to work on yaw behavior. At the moment FP-PID and linear mixer from Betaflight can cause some strange yaw behavior on bigger quads. Fix should be available soon

Hands-on: Beitian BN-880 GPS module

Looking for a decent replacement for my u-blox NEO-6M GPS modules I came by super cheap, Chinese, Beitian BN-880 modules from Banggood. According to information found in the internet, it’s build based on u-blox Neo-M8N and is capable of receiving signals from GPS, GLONASS, Galileo, BeiDou, QZSS and SBAS. Plus integrated magnetometer module. Yesterday package finally arrived and here are my first impressions:

  • It’s not single board, but 2 boards glued together
  • There is not casing, and cases for popular Neo-6M wont fit. BN-800 is much taller
  • It accepts both 5V and 3.3V voltage and 5V UART level is safe, nothing burned
  • It connected to Cleanflight and iNav without any problems at 38400bps
  • Quick windowsill test showed that indeed it works not only with GPS, but also other positioning systems. When GPS Neo-6M was barely able to acquire 4 satellites, Beitian BN-880 found 9 and a solid 3D fix
  • I did not tested magnetometer yet

Beitian BN-880

Beitian BN-880 Antenna

Beitian BN-880 Side view

Hopefully I will be able to perform more tests next few weekends and provide more info on this module. For now it looks very promising.

iNav: Cleanflight learned how to do missions

In my recent post I mentioned that iNav flight controller software (fork of Cleanflight) introduced missions. Missions are preprogrammed waypoints that drone will fly to in specified order and/or do specified action at each of them. For example, if pilot wants to make a video on specified route, he does not have to pilot his drone all the time. He enters waypoints and lets machine do everything else. In this entry I will show how to configure iNav to do missions.

Requirements

  • iNav compatible drone flight controller flashed with iNav software. Currently supported boards are: Naze32, Flip32, CC3D, SPracingF3, Sparky, RDMO
  • GPS module connected to flight controller board. This example shows how to do it for Flip32, but it will work for all other boards, only UART pins might be different
  • Magnetometer connected and properly calibrated
  • Barometer connected
  • EZ-GUI Ground Station Android application that will act as Mission Planner. Official Cleanflight Configurator does not support this function yet
  • Bluetooth telemetry. Some time ago I have written how to do it for Flip32, but it will work almost the same for all other flight controllers, only UART pins might be different

Continue reading iNav: Cleanflight learned how to do missions

Better GPS for Cleanflight: iNav

Cleanflight is an awesome piece of software for STM32 based flight controllers. But Cleanflight has one very serious flaw that makes its usage on bigger drones at least problematic. Cleanflight sucks in GPS and barometer support. Sucks a lot. It can handle Position Hold (somehow), Return To Home (barely) and Altitude Hold (oh man, up and down, up and down) but if you at least one tried that, you should know that is not only not reliable, but also not precise and hard to tune. Personally I gave up after few tires. It was not worth it. Comparing to Pixhawk (not talking even about Naza) it might as well not exists at all. But it has changed recently…. Continue reading Better GPS for Cleanflight: iNav

Cleanflight 1.12 is coming to town…

Looks like Cleanflight release cycle is speeding up. Last stable version, 1.11.0, was published in the beginning of December 2015, next stable release, 1.12, can appear any day now. Its Release Candidate is available for testing for more than a week now.

So, what can we expect? First of all, bad news: no improved GPS navigation from iNavFlight yet. iNavFlight is not ready and looks like it’s too big to fit all targets, specially F1 processors. So, we will have to wait a while for it. In the meantime, iNavFlight 1.0 RC4 is ready for testing. And it is very promissing. I’ve been able to do only a few test flights on it before winter, but results were very nice.

In Cleanflight 1.12.0 we can expect few quite important new features:

  1. Looptime sync to gyro readouts. This is something that Betaflight users knows very well. No more looptime as we know it. Control loop processes data as soon as it have it from gyros. Approximately every 1000us, since gyro updates with 1kHz frequency. But, that does not mean that we all will be using looptime of 1000. Not all hardware targets with features like GPS have enough computing performance to handle that. This is why CLI command gyro_sync_denom has been introduced. It tells CF every which gyro update control loop should be executed. Value of 1 results of looptime around 1000us, value of 2 give looptime of 2000us and so on. Important note: by default gyro sync is disabled and CLI set gyro_sync=ON command has to be executed to enable it.
  2. Improved task scheduler. Task scheduler in revious versions of Cleanflight was rather simple. This new implementation will allow for better processing of pheripherials like GPS. Users probably will not see much (if any) difference, but this is required for future features like better GPS navigation,

In addition to that: faster computations and better gyro filtering, bugfixes, documentation updates (to which I contributed too) and smaller improvements. See release notes for full list.