U-Blox Neo M8N U-Center configuration and Arduino parser sketch

!! U-Blox Neo M8N configuration file and Arduino sketch available on my gitHub toskyRocker account !!

Today I’ll explain how to configure the outstanding U-Blox Neo M8N GPS/GLONASS receiver for multirotors usage.

Introduction to the U-Blox Neo M8N

Why this receiver?
Well, the answer is pretty simple: it’s one of the best receivers you can get for 50€ . It can be used with many concurrent navigation satellite systems, like GPS+GLONASS, allowing better performance.
Not all the boards including M8N have the same performance, I suggest you to buy the board developed by DroTek since it seems to have a better accuracy. Different boards with the same M8N receiver have been tested here:  DIY Drones forum.

First of all you need to:

  1. Download the free tool U-Center available on U-Blox Website.
  2. Install U-Blox Neo M8N driver
  3. Choose a way to connect the U-Blox to your PC. You can use either a FTDI Cable or the PL2303 USB to UART converter (this last needs its driver)

U-Blox Neo M8N configuration with U-Center

U-Center is a smart tool that allows you to choose the configuration you need for the GPS receiver and store it in its non volatile memory. With U-Center you can test the accuracy of the receiver with visual instruments displaying info about: satellites, DOP, output messages, baudrate, FIX mode etc..

U-Center
U-Center

There’s a simple way to upload a configuration on the non-volatile memory of the receiver.

    1. Connect the receiver to your PC and open U-Center

U-Center magic wand
Click on the magic wand to enable the autobauding. Then the connection status should turn green.

    1. Go to: Tools-> GNSS Configuration

U-Center GNSS Configuration
Then browse where Configuration_Ublox_Neo_M8N.txt is stored (download it from my gitHub) and click on “File>GNSS” . Now the configuration is permanently stored on the M8N receiver.
U-Center upload configuration

My configuration affects:

  1. Dynamic model configured on Pedestrian (low speed and acceleration)
  2. 10Hz refresh
  3. SBAS On. Be sure your area is covered by SBAS
  4. Static Hold 0.01 m/s
  5. Baudrate fixed to 115200

If you want to change many more parameters, go to View->Message View

U-Center Message View
Browse until UBX->CFG . Here you can set many parameters. Once you’ve done, click on Send (on left bottom-hand of the windows).

U-Center CFG
U-Center CFG

In order to make it permanent on M8N’s flash memory, go to Receiver->Action and select “Save Config”.
U-Center save configuration

Arduino parser for the U-Blox Neo M8N

Do you want to read GPS/GLONASS info on your Arduino?
You need to parse NMEA output strings from your GPS/GLONASS receiver!
Wire your receiver on whatever Arduino (e.g. Yun/Micro/Leonardo etc..) having the Atmega32u4. This is essential since we’re going to use Serial1, unfortunately unavailable on Arduino Uno (Atmega328).

Arduino wiring Ublox Neo M8N
Arduino wiring for Ublox Neo M8N

Now compile and run my sketch on Arduino and enjoy your M8N!

The parser takes into account 5 NMEA messages :

  • GNGGA: latitude, longitude, altitude, fix quality, HDOP, satellites in view, satellites in use
  • GNGSA: Fix Mode, PDOP, HDOP, VDOP
  • GPGSV: Satellites in view, elevation, azimuth, SNR, satellites info
  • GNRMC: Time, latitude, longitude, speed over ground, course, magnetic variation
  • GNVTG: Track made good e ground speed

Comments (39)

  1. Anthony

    Jun 13, 2015 at 2:06 pm

    Thank you! Very useful post

  2. thanapong

    Jul 31, 2016 at 2:16 pm

    great…

  3. Jose

    Aug 08, 2016 at 9:45 am

    This post is what I was waiting for! Thx!

  4. sadaiv

    Sep 22, 2016 at 4:48 pm

    can i configure neom8n to send only GNRMC message ?

    • AndrewTosky

      Sep 22, 2016 at 10:50 pm

      Hi, I don’t think it is allowed..
      In any case you can write a parser that reads only what you need i.e. only GNRMC messages.

  5. sonny

    Nov 08, 2016 at 7:28 pm

    Thank you very much and it’s working great, But i have one question. When i run the file on arduino ide , i have 12 rows in 1 second with the same infos in the serial port. The baud rate is 9600 and the datas are readable. I haved changed the arrays to single float and int. Sorry, but i’m no profi 😉

    • AndrewTosky

      Nov 14, 2016 at 9:36 pm

      Hi! In my opinion you should increase the baudrate. 9600 bits per second are just not enough. Try with 115200 as you can see in my code.

      PS You need to configure the Ublox accordingly

  6. Winfried

    Jan 10, 2017 at 10:55 pm

    Thank you for your parser! Many pobular GPS libraries do not work with the u-blox M8N.
    I have modified your example to work with SoftwareSerial on other Arduinos.
    Two questions:
    1. How do I get date and time information from the receiver (in which format)?
    2. It seems that I have bought a clone M8N that can’t be updated to the latest u-blox M8N firmware 3.01 because of missing flash memory. You recommend the DorTec M8N Module. Do you know if this receiver is using the original u-blox M8N module and can be updated to the latest fimware 3.01 (capable of receiving Galileo)?!

  7. Tangui

    Jan 16, 2017 at 1:59 pm

    Hi ! First thank you a lot. Works great with serial1. But im not able to make it work with SoftwareSerial. Any idea ?

    • AndrewTosky

      Jan 19, 2017 at 12:06 am

      Hi!
      What’s exactly your problem?

      I know that SoftwareSerial’s baud limitation is 38400.
      Maybe it’s not enough to handle GPS’s output 🙁

      Cheers

      • Winfried

        Jan 19, 2017 at 12:27 am

        I was able to use the parser with SoftwareSerial and an Arduino Nano. The maximum rate that worked stable was 19200 baud.

  8. Victor Johansen

    Feb 13, 2017 at 11:21 am

    I have a holybro m8n gps/compass according to what I have read my naz32 just wants the position info. help

    • AndrewTosky

      Feb 16, 2017 at 11:25 pm

      Hi Victor,
      which part of the tutorial is not clear?

      Cheers
      Andrea

  9. Joe

    Mar 24, 2017 at 8:42 pm

    I wire my GPS, run the sketch provided, and when i run it i get 0s on every category.

    Note that i converted the Serial1 to software serial because I am running it on arduino uno. Baud rate is the same, and essentially nothing else has changed. What am i doing wrong?

    • AndrewTosky

      Mar 25, 2017 at 2:20 pm

      Hi,
      have you checked on U-Center you can actually receive GPS data?

      • Joe

        Mar 28, 2017 at 7:51 am

        Although I tried receiving GPS data, i was unsuccessful. GPS seems to be sending no data at all actually, Serial Screen is empty. For this test I am using the arduino mega because it supports hardware serial and I don’t have to use software serial. It still doesn’t make much sense. Also I haven’t been able to use any other parser so far.

        • AndrewTosky

          Mar 28, 2017 at 12:13 pm

          Hi,
          first of all, are you sure your M8N receives data at all?
          Have you plugged it in U-Center and tried to receive data?
          I don’t expect major changes in the latest firmware upgrade since the protocol used should be the same.
          Which firmware version are you running now? Keep in mind that my parser and M8N configuration file date back to 2015.

          • Joe

            Mar 31, 2017 at 10:03 am

            After a lot of research I found out that my firmware was fine, and I was able to connect the receiver to u-center. I found out that the package that I needed was UBX NAV_PVT. It gives me latitude, longitude and heading of the vehicle (compared to the north). Now my problem is that i can’t get a valid fix, and the data i got so far has been inaccurate by several meters. Thanks.

          • Joe

            Mar 31, 2017 at 10:09 am

            Another question I have: does course on your parser refer to the heading (angle from the north)?

          • AndrewTosky

            Apr 04, 2017 at 2:08 pm

            I’m glad you found a solution 🙂

            If you parse GNVTG, you’ll then get both angles from True North and Magnetic North.
            Have a look here (VTG section):
            http://wiki.openseamap.org/wiki/OpenSeaMap-dev:NMEA

  10. rue

    Apr 10, 2017 at 4:21 pm

    Hello,
    So this should also work on an Arduino Mega right? And I have to configure the M8N before I can read anything? Im quiet the newbie tho 🙂

  11. fangy

    Jul 01, 2017 at 12:21 pm

    Thank you Andrea for a VERY helpful post :-). I have followed your instructions, but I think I have made an error. When I view the Arduino serial monitor I get 4 arrays of zeros. When I had the neo8 plugged directly into u-centre, I had plenty of satellite fixes and resultant data streams. Is there a newbie mistake to be made somewhere that would give no apparent data being received to the logger board? (the blue Tx LED on the neo8 is rapidly flashing) Thank you.

    • fangy

      Jul 02, 2017 at 11:10 am

      Solved it – I just had to match all the baud rates. 🙂

      • AndrewTosky

        Jul 03, 2017 at 7:59 am

        Hi, sorry for my late reply! I’m glad you solved the problem.

        Best
        Andrea

        • fangy

          Jul 03, 2017 at 8:15 am

          Hi Andrea,
          No problemo 🙂
          I am trying to put together a high precison GPS (using Doppler shift). I need to record these messages:

          UBX-NAV-PVT, UBX-NAV-DOP, and UBX-NAV-SAT

          My coding ability is poor 🙁 IF possible, could you please provide an example of how I would code for the above and then write it to an SD card?

          I am using a Neo8 and Adalogger( feather32u4)

          Thank you!
          Ross

  12. chewyiching

    Sep 27, 2017 at 5:19 pm

    this GPS module can connect with arduino uno?

    • AndrewTosky

      Sep 28, 2017 at 8:25 am

      You can, but I’d rather choose a board with atmega32u4, like Leonardo and Micro, because they have got 2 real serial connections. Useful if you want to both debug with a Pc and receive data as quick as you can from the GPS receiver.

      • Chew yi ching

        Sep 28, 2017 at 10:02 am

        Thx for help me…i am a biginner in using arduino..where i can obtain the coding for gps module n8m with aruini uno? Isit it can connect same like gps module neo 6m…because very seldom ppl upload and post thing and the video about arduino uno with neo m8n most of the post related with arduino uno with neo 6m…can help me ?

        • AndrewTosky

          Sep 28, 2017 at 7:43 pm

          Mainly you have to replace Serial1 with SoftwareSerial . It should work, even though it will be slower.
          I’m sure there are plenty of examples on the internet if you look for Ublox GPS receiver and Arduino UNO.
          Cheers

          Andrea

  13. vergleich lebens versicherung

    Aug 24, 2018 at 1:31 pm

    Aw, thos was aan extremely good post. Takinbg a few minutes and actual effort to generate a gredat article… but what can I
    say… I procrastinate a lot and never seeem to
    get anything done.

  14. Nicola

    Jan 07, 2019 at 10:27 pm

    Hi and thanks for this.

    I tried to do the configuration via “messages view”. There I can also change the sample rate. It was already at 10 hz, but my n8m gps module keeps sampling at 1 Hz, why this?
    Thanks allot!

  15. Jino

    Jan 07, 2019 at 11:19 pm

    Hi Andrew,
    Thanks much for sharing the code. Whether this code can be used for SAM-M8Q?

  16. donald

    Apr 17, 2019 at 2:49 am

    This Mateksys GPS I have output data into U-Center perfectly. But my working arduino code, does not hook up to it. How do I configure it, via U-center, so that the output format can be parsed via tinyGPS++?

    Many thanks.

  17. Hashem Shahsavani

    Jun 04, 2019 at 3:53 pm

    Hi, Dear. Unfortunately your code does not work! and give just 0,0,0,0

  18. Gyoosuhn

    Aug 03, 2020 at 3:04 am

    Very useful and exact information about Ublox M8N.
    Thanks alot!

  19. Anc

    Jul 02, 2021 at 9:05 am

    Hi i cant find the sketch nor your gitub page to download it.

Leave a Reply to Gyoosuhn

This site uses Akismet to reduce spam. Learn how your comment data is processed.