Adding GPS to Flip32+ and Cleanflight

Flip32 and Flip32+ (10 DOF version of Flip32 with built-in barometer and magnetometer) are nice little flight controllers. And cheap. Some call them clones of Naze32, but this is not completely true. Yes, they are very similar, share the same hardware, but they are not identical. I would say they are better than Naze32 since have more features and are easier to extend. But that is not the topic.

One of coolest features of every drone is GPS support. This allows for both Position Hold and even navigation support. I will not explain how to configure Position Hold and navigation on Flip32+ and Cleanfligh today. The reason is simple: I’m still trying to fully understand PID controllers used in those modes: Pos, PosR and NavR. And it is not going very well I must say. Position Hold in low wind is OK, but navigation and PH in wind conditions is unreliable and I’m still unable to configure it to work well. But GPS even without Position Hold has some use. For example, Home marker on OSD when flying FPV.

 

Ublox Neo-6M GPS moduleIn this tutorial I will use Ublox Neo-6M GPS module, Flip32+ 10DOF and Cleanflight 1.9.0.

First of all, we have to set one of serial ports to act as GPS port. This is done on “Ports” tab of Cleanflight Configurator. In case of Naze32/Flip32 this will be UART2 located on input pins 3 (TX) and 4 (RX). The only problem with this UART is that it is shared with receiver PWM input ports. In case of serial receiver or PPM receiver, there is no problem. But, when our radio is using separate input port for each chanel (Parallel PWM) there will be a change of input mapping:

  1. CH1 Roll
  2. CH2 Pitch
  3. UART2 TX
  4. UART2 RX
  5. CH3 Throttle
  6. CH4 Yaw
  7. CH5 AUX1
  8. CH6 AUX2

Luckily, this will be done automatically when we enable GPS later on.

Flip32 Cleanflight GPS UARTSo, open Ports tab, select GPS on UART2 and select correct baud rate. In case on new Ublox Neo-6M, it will be 9600.

Next, we have to connect GPS module to flight controller. GND and 5V can be taken from any free pin, GPS TX line have to be connected to UART2 RX (pin 4) and GPS RX line to UART2 TX pin (4). Do not worry if you will mix TX/RX lines. If you will not connect them correctly, you will not burn anything. It will just not work.

Enabling GPS in cleanflight

Next step is to enable GPS. Open “Configuration” tab, check GPS and select “Ublox” protocol and “Auto-detect” Ground Assistance Type. Save, reboot and connect 5V power supply to Flip32. USB power is not enought for Neo-6M GPS. After reboot GPS should be enabled and running. You can check signal and fix on “GPS” tab.

Cleanflight GPS tab

If you failed, recheck wiring, check external power supply (usually 5V from BEC) and serial configuration. Maybe you selected wrong baud rate. Check you GPS module configuration.

The last thing is using GPS for Position Hold. This is tricky and looks like not working very well in current Cleanflight (1.9.0). Still, until now I was able to make that somehow work in low wind conditions. But Return To Home mode is highly unstable and it crashed my 500 quadcopter twice. If you want to try, here is some information you will need.

GPS navigation and Position Hold uses 3 PID controllers: Pos, PosR and NavR and some CLI properties:

  • Pos PID controller is used when multicopter is withing gps_wp_radius from desired position. It’s computing desired speed for fine navigation,
  • PosR (Position Rate) PID controller is used when multicopter is also within gps_wp_radius from desired location and computes direction of movement,
  • NavR PID controller (Navigation Rate) is used when multicopter is outside of gps_wp_radius to determine movement direction,
  • CLI
    • gps_wp_radius in centimeters sets area around GPS coordinates to use PosR controller for fine navigation,
    • nav_controls_heading – when enabled (1) and magnetormeter is present, will set drone front towards current movement direction,
    • nav_speed_min and nav_speed_min set min and max navigation speed in cm/s,
    • nav_slew_rate has something to do with smoothing but did not checked that yet

If you have and success with Position Hold and Return To Home and Cleanflight, share the knowledge. There are many dark areas here.

 

5 thoughts on “Adding GPS to Flip32+ and Cleanflight

  1. Hello,

    I am currently trying to set up my quad (I posted in your broken USB article) and am kinda stuck. I am unsure if I am able to use all the add-ons that I wish to use. Here’s the list:

    VBAT
    Buzzer
    Telemetry
    OSD
    Servo Tilt
    Bluetooth
    GPS

    If you know if I can or Can’t let me know please,
    Nathan

    1. Never tried Servo Tilt so no idea. Bluetooth and OSD does not work together well. OSD works only when BT connected. Everything else works fine

  2. Please try Nav-Rewrite (iNav), a cleanflight fork to rewrite and test navigation framework from scratch.

    http://www.rcgroups.com/forums/showthread.php?t=2495732

    https://github.com/digitalentity/nav-rewrite-docs/wiki some docs

    Legacy BARO, SONAR, GPS PH, GPS RTH modes are removed and replaced by ALTHOLD, POSHOLD and RTH modes.

    http://www.banggood.com/Ublox-7-Series-Mini-GPS-wCompass-For-APM2_6-APM2_8-PX4-Pixhawk-Mini-APM-MWC-Flight-Controller-Board-p-1006319.html?p=J03113853166201410QG try this mini GPS with compass, low weight and low price.

Leave a Reply

Your email address will not be published.