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:
- Download the free tool U-Center available on U-Blox Website.
- Install U-Blox Neo M8N driver
- 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..

There’s a simple way to upload a configuration on the non-volatile memory of the receiver.
- Connect the receiver to your PC and open U-Center
Click on the magic wand to enable the autobauding. Then the connection status should turn green.
- Go to: Tools-> 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.
My configuration affects:
- Dynamic model configured on Pedestrian (low speed and acceleration)
- 10Hz refresh
- SBAS On. Be sure your area is covered by SBAS
- Static Hold 0.01 m/s
- Baudrate fixed to 115200
If you want to change many more parameters, go to View->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).

In order to make it permanent on M8N’s flash memory, go to Receiver->Action and select “Save Config”.
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).

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 (40)
Anthony
Jun 13, 2015 at 2:06 pmThank you! Very useful post
thanapong
Jul 31, 2016 at 2:16 pmgreat…
Jose
Aug 08, 2016 at 9:45 amThis post is what I was waiting for! Thx!
sadaiv
Sep 22, 2016 at 4:48 pmcan i configure neom8n to send only GNRMC message ?
AndrewTosky
Sep 22, 2016 at 10:50 pmHi, 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.
sonny
Nov 08, 2016 at 7:28 pmThank 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 pmHi! 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
Winfried
Jan 10, 2017 at 10:55 pmThank 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)?!
AndrewTosky
Jan 14, 2017 at 3:31 pmDear Winfried, sorry for my late reply.
1. In my parser you get (year, month, day) [from line 275] and
(hour, minute, second) [from line 335].
2. The M8N Drotek contains a genuine Ublox receiver.
You should be able to upgrade the firmware and see Galileo’s constellation.
https://forum.u-blox.com/index.php?qa=4762&qa_1=galileo-satellites-channel-flashers-but-strong-signal
Jai
Dec 20, 2018 at 11:51 pmCan you share your software serial modified code for Arduino uno or nano?
Tangui
Jan 16, 2017 at 1:59 pmHi ! 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 amHi!
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 amI was able to use the parser with SoftwareSerial and an Arduino Nano. The maximum rate that worked stable was 19200 baud.
Victor Johansen
Feb 13, 2017 at 11:21 amI 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 pmHi Victor,
which part of the tutorial is not clear?
Cheers
Andrea
Joe
Mar 24, 2017 at 8:42 pmI 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 pmHi,
have you checked on U-Center you can actually receive GPS data?
Joe
Mar 28, 2017 at 7:51 amAlthough 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 pmHi,
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 amAfter 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 amAnother question I have: does course on your parser refer to the heading (angle from the north)?
AndrewTosky
Apr 04, 2017 at 2:08 pmI’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
rue
Apr 10, 2017 at 4:21 pmHello,
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 🙂
fangy
Jul 01, 2017 at 12:21 pmThank 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 amSolved it – I just had to match all the baud rates. 🙂
AndrewTosky
Jul 03, 2017 at 7:59 amHi, sorry for my late reply! I’m glad you solved the problem.
Best
Andrea
fangy
Jul 03, 2017 at 8:15 amHi 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
chewyiching
Sep 27, 2017 at 5:19 pmthis GPS module can connect with arduino uno?
AndrewTosky
Sep 28, 2017 at 8:25 amYou 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 amThx 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 pmMainly 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
vergleich lebens versicherung
Aug 24, 2018 at 1:31 pmAw, 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.
Nicola
Jan 07, 2019 at 10:27 pmHi 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!
Jino
Jan 07, 2019 at 11:19 pmHi Andrew,
Thanks much for sharing the code. Whether this code can be used for SAM-M8Q?
donald
Apr 17, 2019 at 2:49 amThis 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.
Hashem Shahsavani
Jun 04, 2019 at 3:53 pmHi, Dear. Unfortunately your code does not work! and give just 0,0,0,0
Gyoosuhn
Aug 03, 2020 at 3:04 amVery useful and exact information about Ublox M8N.
Thanks alot!
Anc
Jul 02, 2021 at 9:05 amHi i cant find the sketch nor your gitub page to download it.
AndrewTosky
Sep 15, 2021 at 8:26 amIt’s here https://github.com/toskyRocker/Arduino_Parser_Ublox_Neo_M8N as written at the beginning of the post 🙂
QAMAR HASSAN
Jun 23, 2023 at 12:30 pmHi, I’m using NEO-M8T-0-01 module and want to set time pulse 10MHZ at tp5 what should be the hex command for it ?