Beitian BN-180 is one of the most popular small, and cheap GPS modules used with INAV on airplanes, or on Betaflight on quadcopters. Most of the time, they work just fine, but I discovered that they could make problems from time to time. Here is a shortlist of possible issues and solutions for Beitian BN-180 GPS module:
Thanks to a very versatile Input/Output matrix, it is quite simple to connect NMEA GPS modules to ESP32 MCUs. Not only ESP32 boards have 3 serial ports you can choose from, they can be assigned to almost any pin you want.
In this example we will connect a popular Ublox NEO-M8N like Beitian BN-880 or BN-220 to a ESP32 development board and output current position on a USB serial port using Arduino IDE and TinyGPS++ library. Let’s begin
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.
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.
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 (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.
Case can be dowloaded from Thingverse
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
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.
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.
- 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
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” »
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:
- 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_denomhas 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=ONcommand has to be executed to enable it.
- 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.