NEO-6M Serial Communication with Arduino Nano not working MultiWii 2.4

Hello I am relatively new to the Arduino community and this is my first post.

I am building a drone with a clone Elegoo Arduino nano as the flight controller with a CH340 chip. I have been building it with sensors such as a Barometer(BMP180), Magnetometer(QMC5883L), and Acc/Gyro(MPU6050) with I2C connections.

These sensors and flight controller are all built with Multiwii 2.4 software and they are all communicating well together and the correct results are given.

Everything was going well until I tried to connect my GPS module. The last sensor I would want to add is my NEO-6M Ublox gps module rated for 3.3-5V with 9600 BAUD. I tested the module with my computer before connecting it to the nano and it works and is able to grab a fix no problem and transmit the NMEA sentences with U-Center. However I try to connect this last module with the serial port of the Arduino Nano.

GPS => Nano
TX => RX (Port 0)
RX => TX (Port 1)

I have this code in config.h to define the module in Multiwii 2.4:

  /***********************                  GPS                **************************/

    /* ENable this for using GPS simulator (NMEA only)*/
    //#define GPS_SIMULATOR

    /* GPS using a SERIAL port
       if enabled, define here the Arduino Serial port number and the UART speed
       note: only the RX PIN is used in case of NMEA mode, the GPS is not configured by multiwii
       in NMEA mode the GPS must be configured to output GGA and RMC NMEA sentences (which is generally the default conf for most GPS devices)
       at least 5Hz update rate. uncomment the first line to select the GPS serial port of the arduino */
    #define GPS_SERIAL 0         // should be 2 for flyduino v2. It's the serial port number on arduino MEGA
                                   // must be 0 for PRO_MINI (ex GPS_PRO_MINI)
                                   // note: Now a GPS can share MSP on the same port. The only constrain is to not use it simultaneously, and use the same port speed.

    // avoid using 115200 baud because with 16MHz arduino the 115200 baudrate have more than 2% speed error (57600 have 0.8% error)
    #define GPS_BAUD   9600       // GPS_BAUD will override SERIALx_COM_SPEED for the selected port

   /* GPS protocol 
       NMEA  - Standard NMEA protocol GGA, GSA and RMC  sentences are needed
       UBLOX - U-Blox binary protocol, use the ublox config file (u-blox-config.ublox.txt) from the source tree 
       MTK_BINARY16 and MTK_BINARY19 - MTK3329 chipset based GPS with DIYDrones binary firmware (v1.6 or v1.9)
       With UBLOX and MTK_BINARY you don't have to use GPS_FILTERING in multiwii code !!! */

    #define NMEA
    //#define UBLOX
    //#define MTK_BINARY16
    //#define MTK_BINARY19
    //#define INIT_MTK_GPS        // initialize MTK GPS for using selected speed, 5Hz update rate and GGA & RMC sentence or binary settings

    /* I2C GPS device made with an independant arduino + GPS device
       including some navigation functions
       contribution from EOSBandi 
       You have to use at least I2CGpsNav code r33 */
    /* all functionnalities allowed by SERIAL_GPS are now available for I2C_GPS: all relevant navigation computations are gathered in the main FC */

    //#define I2C_GPS

    // If your I2C GPS board has Sonar support enabled
    //#define I2C_GPS_SONAR

    /* indicate a valid GPS fix with at least 5 satellites by flashing the LED  - Modified by MIS - Using stable LED (YELLOW on CRIUS AIO) led work as sat number indicator 
      - No GPS FIX -> LED blink at speed of incoming GPS frames
      - Fix and sat no. bellow 5 -> LED off
      - Fix and sat no. >= 5 -> LED blinks, one blink for 5 sat, two blinks for 6 sat, three for 7 ... */

   //Enables the MSP_WP command set , which is used by WinGUI for displaying an setting up navigation
   //#define USE_MSP_WP

   // HOME position is reset at every arm, uncomment it to prohibit it (you can set home position with GyroCalibration)    

/* GPS navigation can control the heading */

// copter faces toward the navigation point, maghold must be enabled for it
#define NAV_CONTROLS_HEADING       1    //(**)
// true - copter comes in with tail first
#define NAV_TAIL_FIRST             0    //(**)
// true - when copter arrives to home position it rotates it's head to takeoff direction
#define NAV_SET_TAKEOFF_HEADING    1    //(**)

/* Get your magnetic declination from here :
Convert the degree+minutes into decimal degree by ==> degree+minutes*(1/60)
Note the sign on declination it could be negative or positive (WEST or EAST)
Also note, that maqgnetic declination changes with time, so recheck your value every 3-6 months */
#define MAG_DECLINATION  4.02f   //(**)

// Adds a forward predictive filterig to compensate gps lag. Code based on Jason Short's lead filter implementation
#define GPS_LEAD_FILTER               //(**)

// add a 5 element moving average filter to GPS coordinates, helps eliminate gps noise but adds latency comment out to disable
// use it with NMEA gps only 
//#define GPS_FILTERING                 //(**)

// if we are within this distance to a waypoint then we consider it reached (distance is in cm)
#define GPS_WP_RADIUS              100      //(**)

// Safe WP distance, do not start mission if the first wp distance is larger than this number (in meters)
// Also aborts mission if the next waypoint distance is more than this number
#define SAFE_WP_DISTANCE           500      //(**)

//Maximu allowable navigation altitude (in meters) automatic altitude control will not go above this height
#define MAX_NAV_ALTITUDE           100     //(**)

// minimum speed when approach waypoint
#define NAV_SPEED_MIN              100    // cm/sec //(**)
// maximum speed to reach between waypoints
#define NAV_SPEED_MAX              400    // cm/sec //(**)
// Slow down to zero when reaching waypoint (same as NAV_SPEED_MIN = 0)
#define NAV_SLOW_NAV               0      //(**)
// Weight factor of the crosstrack error in navigation calculations (do not touch)
#define CROSSTRACK_GAIN            .4     //(**)
// Maximum allowable banking than navigation outputs
#define NAV_BANK_MAX 3000                 //(**)

//Defines the RTH altitude. 0 means keep current alt during RTH (in meters)
#define RTH_ALTITUDE               15        //(**)
//Wait to reach RTH alt before start moving to home (0-no, 1-yes)
#define WAIT_FOR_RTH_ALT           1         //(**)

//Navigation engine will takeover BARO mode control
#define NAV_TAKEOVER_BARO          1         //(**)

//Throttle stick input will be ignored  (only in BARO)
#define IGNORE_THROTTLE            1         //(**)

//If FENCE DISTANCE is larger than 0 then copter will switch to RTH when it farther from home
//than the defined number in meters
#define FENCE_DISTANCE      600

//This governs the descent speed during landing. 100 is equals approc 50cm/sec
#define LAND_SPEED          100

//#define ONLY_ALLOW_ARM_WITH_GPS_3DFIX      // Only allow FC arming if GPS has a 3D fix.

When I power on the whole thing the arduino has the Power LED on as well as the RX LED flashing.

However when I try to see results in Multiwii GUI I suddenly get no information coming through when before it would easily recognize all the previous sensors just fine and show output. It shows me the image that is attached to this post

When I disconnect the GPS the flight controller and GUI go back to functioning normally.

I am stuck and would be grateful for any help on the issue as I do not understand what is blocking me.

Thanks in advance!

How does the Nano communicate with the Multiwii GUI? Does the Multiwii GUI need the hardware serial port?

Have you tried the GPS connected through a software serial port to free the hardware serial port?

Thanks for the quick reply!

The Nano communicates with Multiwii GUI through the USB port. I understand that the Arduino Nano only has one serial port available (Port 0 and Port 1 for RX and TX) which it shares with the USB port.

Is this why the GUI is blank although the Nano is clearly powered on and has RX LED blinking for incoming data from the GPS? Is there another way to be able to use the GUI and to have the GPS in the one serial port?

I do not have much experience with Software Serial but I read up that it may be too slow for the 5Hz GPS module to output the NMEA correctly.

I also thought of connecting the GPS via I2C connection to save up the Serial Port however I am not sure how to convert the Serial RX and TX of the GPS to valid I2C.


I am building a small form factor drone that uses an Arduino Nano as a flight controller with multiwii. I connected all of my modules via I2C great including Baro, Magnetometer, and Acc/Gyro. They all work great. However I now want to add my GPS module which is a NEO-6M Ublox GPS 9600 BAUD, 5Hz module.

GPS => Arduino Nano
TX => RX(Port 0)
RX => TX(Port 1)

The problem is that an Arduino Nano only has one serial port which is shared with the USB connection. I tend to tweak alot of PID values and check/test the flight controller through the GUI. However when I set Multiwii to read from the Serial Port of the Nano for the GPS I am unable to also plug it in to my computer to use the GUI.

I looked into Software Serial however read that it is inefficient especially for a fast moving object like a drone.

I also was thinking maybe I could change the RX, TX UART serial interface of the GPS and convert it to I2C connection since Multiwii 2.4 supports i2C GPS. However I am not sure how to do that conversion.

Due to the small form factor of the drone I cannot go to a board that is larger with more serial ports as well.

I am very stuck atm and would appreciate any help and suggestions on my project!

Thanks in advance!

You just cannot have both the GUI and GPS connected to the same serial port.

I also thought of connecting the GPS via I2C connection to save up the Serial Port however I am not sure how to convert the Serial RX and TX of the GPS to valid I2C.

There is no way that I know of to convert serial to I2C. You will need to get a GPS that has I2C.
Adafruit GPS

Teesny 3.2? They are really small and have a pile of IO. Pile of horsepower 'n RAM too.

-jim lee

I don't understand.

Are you saying I should replace the Arduino Nano with a Teensy 3.2? Why?

Because it has more serial port connections?

Unfortunately I am not familiar with Teensy and if it is easily usable with the multiwii platform.

Its tiny, its faster etc etc. And you program it with the Arduino IDE. Works like an Arduino. I'm pretty sure multiWii would run in there like it was on vacation. I use them for about 99% of my Arduino stuff.

I gotta' hand it to ya though, I've used the multiWii code, I couldn't make heads or tails of it. With all the #define hacks out of it and the crazy optimizations. Made my head spin.

-jim lee

I also thought of connecting the GPS via I2C connection to save up the Serial Port however I am not sure how to convert the Serial RX and TX of the GPS to valid I2C.

You dont 'convert' at all.

The Ublox GPSs have a DDC (I2C) port, you just send the GPS the address of the stream register (0xFF) over I2C and keep reading bytes using the standard Wire.requestFrom().

Duplicate topics merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a timeout from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Did You download the Ubox Ucenter Software ?

hook the FTDI to the GPS and and use the software to check its settings

the Baud rate should match the Baud of the Config.h Serial Com