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
AnthonyJun 13, 2015 at 2:06 pm
Thank you! Very useful post
thanapongJul 31, 2016 at 2:16 pm
JoseAug 08, 2016 at 9:45 am
This post is what I was waiting for! Thx!
sadaivSep 22, 2016 at 4:48 pm
can i configure neom8n to send only GNRMC message ?
AndrewToskySep 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.
sonnyNov 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 😉
AndrewToskyNov 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
WinfriedJan 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.
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)?!
AndrewToskyJan 14, 2017 at 3:31 pm
Dear 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.
JaiDec 20, 2018 at 11:51 pm
Can you share your software serial modified code for Arduino uno or nano?
TanguiJan 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 ?
AndrewToskyJan 19, 2017 at 12:06 am
What’s exactly your problem?
I know that SoftwareSerial’s baud limitation is 38400.
Maybe it’s not enough to handle GPS’s output 🙁
WinfriedJan 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.
Victor JohansenFeb 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
AndrewToskyFeb 16, 2017 at 11:25 pm
which part of the tutorial is not clear?
JoeMar 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?
AndrewToskyMar 25, 2017 at 2:20 pm
have you checked on U-Center you can actually receive GPS data?
JoeMar 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.
AndrewToskyMar 28, 2017 at 12:13 pm
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.
JoeMar 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.
JoeMar 31, 2017 at 10:09 am
Another question I have: does course on your parser refer to the heading (angle from the north)?
AndrewToskyApr 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):
rueApr 10, 2017 at 4:21 pm
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 🙂
fangyJul 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.
fangyJul 02, 2017 at 11:10 am
Solved it – I just had to match all the baud rates. 🙂
AndrewToskyJul 03, 2017 at 7:59 am
Hi, sorry for my late reply! I’m glad you solved the problem.
fangyJul 03, 2017 at 8:15 am
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)
chewyichingSep 27, 2017 at 5:19 pm
this GPS module can connect with arduino uno?
AndrewToskySep 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 chingSep 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 ?
AndrewToskySep 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.
vergleich lebens versicherungAug 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.
NicolaJan 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?
JinoJan 07, 2019 at 11:19 pm
Thanks much for sharing the code. Whether this code can be used for SAM-M8Q?
donaldApr 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++?
Hashem ShahsavaniJun 04, 2019 at 3:53 pm
Hi, Dear. Unfortunately your code does not work! and give just 0,0,0,0
GyoosuhnAug 03, 2020 at 3:04 am
Very useful and exact information about Ublox M8N.
AncJul 02, 2021 at 9:05 am
Hi i cant find the sketch nor your gitub page to download it.
AndrewToskySep 15, 2021 at 8:26 am
It’s here https://github.com/toskyRocker/Arduino_Parser_Ublox_Neo_M8N as written at the beginning of the post 🙂