Hi Rayb,
That is probably the 3.3V vs 5V voltage difference introducing errors into the data. Please test it again when you have your level shifter.
Best wishes,
Paul
Hi Rayb,
That is probably the 3.3V vs 5V voltage difference introducing errors into the data. Please test it again when you have your level shifter.
Best wishes,
Paul
Hello Paul,PaulZC:
@ Rayb,I still recommend using a level-shifter. The Mega IO pins are 5V. The Serial1/2/3 TX and RX pins will output 5V and expect 5V signals. Likewise the I2C SCL and SDA pins will output 5V and expect 5V. The NEO-M9N is a 3.3V board. A direct connection may work, but it will not be reliable and could cause damage.
There is a Great Circle Distance example here:
https://github.com/sparkfun/SparkFun_u- … stance.ino
Many of the examples show how to read SIV - Satellites In View. Although that name is not quite correct. The u-blox modules output the number of satellites used in the position calculation, which is not quite the same thing.
https://github.com/sparkfun/SparkFun_u- … sition.ino
Best,
Paul
I added the level-shifters for the TX & Rx pins. Verified the baud rate of 38400 bps. I am getting errors from the M9N GPS. The following is a list of errors I received. The error is an ACK and a checksum error. I hope you can shed some light on these errors.
Sending: CLS:CFG ID:0x8B Len: 0x8 Payload: 0 0 0 0 1 0 73 10
sendCommand: Waiting for ACK response
process: incoming “automatic” message: Class: 0x2 ID: 0x14
processUBX: incoming “automatic” message: Class: 0x2 ID: 0x14
Incoming: Size: 116 Received: CLS:0x2 ID:0x14 Len: 0x74 Payload: 1 0 0 0 60 9A 5 0 60 9A 5 0 60 9A 5 0 60 9A 5 0 60 9A 5 0 FF FF FF FF FF FF FF FF FF FF 3 0 0 0 0 0 0 0 0 0 0 11 15 1 8D EB FF FF 82 EA FF FF 98 3 A2 3 78 CE 1C 0 0 1B 0 0 0 1F 7 1 62 51 0 0 88 55 0 0 BF 3 8E 3 9F 6 1E 0 0 20 0 0 0 1 6 1 D1 AA FF FF 79 A6 FF FF A7 3 83 3 59 46 1D 0 0 21 0 0
packetCfg now valid
process: incoming “automatic” message: Class: 0x1 ID: 0x7
Checksum failed: checksumA: 0 checksumB: 242 rollingChecksumA: 33 rollingChecksumB: 247
waitForACKResponse: TIMEOUT after 1100 msec.
getVal: sendCommand returned: Timeout
begin: isConnected - second attempt
getVal key: 0x1
Sending: CLS:CFG ID:0x8B Len: 0x8 Payload: 0 0 0 0 1 0 73 10
sendCommand: Waiting for ACK response
waitForACKResponse: TIMEOUT after 1100 msec.
getVal: sendCommand returned: Timeout
begin: isConnected - third attempt
getVal key: 0x1
Sending: CLS:CFG ID:0x8B Len: 0x8 Payload: 0 0 0 0 1 0 73 10
sendCommand: Waiting for ACK response
waitForACKResponse: TIMEOUT after 1100 msec.
getVal: sendCommand returned: Timeout
GNSS not working createFileBuffer: Warning. fileBufferSize is zero. Data logging is not possible.
getVal key: 0x1
Sending: CLS:CFG ID:0x8B Len: 0x8 Payload: 0 0 0 0 1 0 73 10
sendCommand: Waiting for ACK response
waitForACKResponse: TIMEOUT after 1100 msec.
getVal: sendCommand returned: Timeout
begin: isConnected - second attempt
getVal key: 0x1
Thanks you,
Rayb
Hi Rayb,
Can you please post details of your level shifter? A photo of the connections to your Mega and NEO boards would help. So would a sketch of the connections. I suspect you haven’t connected it correctly - and you are still seeing errors in the serial data as a result.
Also, you seem to have enabled the UBX-RXM-MEASX (0x02 0x14) message? I suggest resetting your NEO back to the factory defaults using u-center just in case.
Best wishes,
Paul
PaulZC:
Hi Rayb,Can you please post details of your level shifter? A photo of the connections to your Mega and NEO boards would help. So would a sketch of the connections. I suspect you haven’t connected it correctly - and you are still seeing errors in the serial data as a result.
Also, you seem to have enabled the UBX-RXM-MEASX (0x02 0x14) message? I suggest resetting your NEO back to the factory defaults using u-center just in case.[/imp]
Best wishes,
Paul
[/quote]
Hello Paul,Thanks for getting back to me. I think I attached the image of the level shifter. I attached the sketches i am using for the Arduino and M9N GPS ( main, GPS, waypoint, startup and Bluetooth ( Bluetooth is really nRF24L01). I reset the M9N GPS back to factory spec. ( I think) and commented out UBX-RXM-MEASX (0x02 0x14). Now my sketch will compile and run but the position data is very slow (Lat & Lon update every 3 minutes). I need an update at 1hz. Confused why the update for Lat & Lon are so slow, I guess it could be my code. I appreciate your help.
Thanks you,
Rayb
2 questions:
I was using the NEO 7M model from China. I thought when I purchased the M9N that I would directly replace the Neo 7M using the same code. WHY (GNSS , TinyGPSPlus)
What can I do to get my GPS module perform at 2 meter accuracy. ( antenna, different module, w/out RTK )
SPARK_main.txt (6.92 KB)
Go_Waypoint.txt (3.06 KB)
Bluetooth.txt (1010 Bytes)
Hi Rayb,
I can’t see / find the level-shifter image. Can you try sending it again?
It is really difficult for me to follow your code. I can’t tell if you are using the SparkFun library to read the position, or TinyGPSPlus. I think you’re trying to use TinyGPSPlus, but I can’t see where you are calling gps.encode. You didn’t attach the source for getGPS. I think there is a limit on how many attachments you can attach to a post here - you might need to post it again.
It would be much easier for me if you could please try an example from our library and only modify it to use Serial2 (pins 16 and 17). Please look again at this post: https://forum.sparkfun.com/viewtopic.ph … 86#p240986
“NEO 7M model from China”. Sorry. You’re on your own there. We get our modules from u-blox in Switzerland.
You should be getting close to 2m accuracy when the NEO has a clear view of the sky and is using multiple constellations.
Best wishes,
Paul
Hello Paul,PaulZC:
Hi Rayb,I can’t see / find the level-shifter image. Can you try sending it again?
It is really difficult for me to follow your code. I can’t tell if you are using the SparkFun library to read the position, or TinyGPSPlus. I think you’re trying to use TinyGPSPlus, but I can’t see where you are calling gps.encode. You didn’t attach the source for getGPS. I think there is a limit on how many attachments you can attach to a post here - you might need to post it again.
It would be much easier for me if you could please try an example from our library and only modify it to use Serial2 (pins 16 and 17). Please look again at this post: https://forum.sparkfun.com/viewtopic.ph … 86#p240986
“NEO 7M model from China”. Sorry. You’re on your own there. We get our modules from u-blox in Switzerland.
You should be getting close to 2m accuracy when the NEO has a clear view of the sky and is using multiple constellations.
Best wishes,
Paul
This time the jpeg file is sent. Paul I can compile and run your (SFE_UBLOX_GNSS_SERIAL uses Serial (UART) sketch with no issues. I am attaching my Sparkgps.txt file that shows the ( gps.encode(serial2.read()); ) I think this can only be used with the TinyGPSPlus header. NOTE my sketch does compile and run but the position data is slow every 3 minutes (??? because the module is stationary and updates only there is a change in position ).
Thanks for your patience,
Rayb
Spark-gps.txt (5.05 KB)

Hi Rayb,
Thank you for the sketch diagram. That will work nicely. You do not really need the 3.3V regulator as there is one on the NEO board. You could connect 5V from the Mega to the 5V pin on the NEO board. Then connect the 3V3 pin on the NEO board back to the LV pin on the level shifter. The level shifter will draw very little current. But what you have is perfectly OK.
Looking at your code, you have TinyGPSPlus and the SparkFun library fighting each other. gps.encode is commented out. You are reading the GNSS serial data with the SparkFun library using myGNSS.getPVT. getPVT will ‘absorb’ all of the GNSS data. TinyGPSPlus is not getting any data since you are not calling gps.encode, so gps.location will never change.
The good news is that there is a way to ‘pipe’ the NMEA data from the SparkFun library to TinyGPSPlus - if you want to. Example2 was written for MicroNMEA, but you could adapt it for TinyGPSPlus. In processNMEA, change nmea.process(incoming); to gps.encode(incoming); and it should work.
https://github.com/sparkfun/SparkFun_u- … arsing.ino
Best wishes,
Paul
PaulZC:
Hi Rayb,Thank you for the sketch diagram. That will work nicely. You do not really need the 3.3V regulator as there is one on the NEO board. You could connect 5V from the Mega to the 5V pin on the NEO board. Then connect the 3V3 pin on the NEO board back to the LV pin on the level shifter. The level shifter will draw very little current. But what you have is perfectly OK.
Looking at your code, you have TinyGPSPlus and the SparkFun library fighting each other. gps.encode is commented out. You are reading the GNSS serial data with the SparkFun library using myGNSS.getPVT. getPVT will ‘absorb’ all of the GNSS data. TinyGPSPlus is not getting any data since you are not calling gps.encode, so gps.location will never change.
The good news is that there is a way to ‘pipe’ the NMEA data from the SparkFun library to TinyGPSPlus - if you want to. Example2 was written for MicroNMEA, but you could adapt it for TinyGPSPlus. In processNMEA, change nmea.process(incoming); to gps.encode(incoming); and it should work.
https://github.com/sparkfun/SparkFun_u- … arsing.ino
Best wishes,
Paul
Hello Paul,PaulZC:
Hi Rayb,Thank you for the sketch diagram. That will work nicely. You do not really need the 3.3V regulator as there is one on the NEO board. You could connect 5V from the Mega to the 5V pin on the NEO board. Then connect the 3V3 pin on the NEO board back to the LV pin on the level shifter. The level shifter will draw very little current. But what you have is perfectly OK.
Looking at your code, you have TinyGPSPlus and the SparkFun library fighting each other. gps.encode is commented out. You are reading the GNSS serial data with the SparkFun library using myGNSS.getPVT. getPVT will ‘absorb’ all of the GNSS data. TinyGPSPlus is not getting any data since you are not calling gps.encode, so gps.location will never change.
The good news is that there is a way to ‘pipe’ the NMEA data from the SparkFun library to TinyGPSPlus - if you want to. Example2 was written for MicroNMEA, but you could adapt it for TinyGPSPlus. In processNMEA, change nmea.process(incoming); to gps.encode(incoming); and it should work.
https://github.com/sparkfun/SparkFun_u- … arsing.ino
Best wishes,
Paul
Thanks, I was able to get the robot main sketch working completely with your help of course. I looked for the above NMEA data and only found one for an Mega bd. I am using a Nano but I could not locate it in https://github.com/sparkfun/SparkFun_u- … les/Basics. Do you know if there is a sketch for the Nano or the Micro for the NMEA data from Spark to the TinyGPSPlus. I will try to attach my sketch, I changed the baud rate, commented gps.encode and changed from Serial to I2C in my transmitter sketch. The only thing different is, I am using SoftwareSerial, maybe its too slow.
Thanks, you are the best.
Rayb
GPS_Trans.txt (1.17 KB)
Hi Rayb,
Here’s the same example in the v2 library:
https://github.com/sparkfun/SparkFun_u- … arsing.ino
Software Serial is always problematic. It works best at lower baud rates, and if you are using an interrupt-capable pin for RX (pin 2 or 3 if you are using a ATmega328P). You could try setting the NEO’s baud rate to 9600 with u-center and save the settings into memory (with CFG-CFG).
Good luck with your project - looks like fun!
Paul
Hey Paul,PaulZC:
Hi Rayb,Here’s the same example in the v2 library:
https://github.com/sparkfun/SparkFun_u- … arsing.ino
Software Serial is always problematic. It works best at lower baud rates, and if you are using an interrupt-capable pin for RX (pin 2 or 3 if you are using a ATmega328P). You could try setting the NEO’s baud rate to 9600 with u-center and save the settings into memory (with CFG-CFG).
Good luck with your project - looks like fun!
Paul
How do I change the baud rate on my NEO M9N module? I would like to change the baud from 38400 to 19200. I am using u-center version V22.05, will this version work?
Thank you,
Rayb
Hi Rayb,
Open u-center. (I always recommend u-center, not u-center2.)
Connect the module using USB.
Select the correct COM port.
Change the baud rate to 38400 if needed - but this doesn’t apply for u-blox USB. (If you connect to UART1 using an FTDI Serial-USB adapter, you need to select the correct baud rate.)
Once connected, you should see the position and satellite signal strengths being displayed - if the antenna has a view of the sky.
Open View \ Messages View.
Select UBX-CFG-PRT from the message tree.
Select UART1 as the target. Select 9600 / 19200 as the baud rate. Make sure Protocol In and Protocol Out are set to UBX+NMEA. The SparkFun library needs UBX. TinyGPSPlus needs NMEA.
Click Send at the bottom left corner of the window.
Select UBX-CFG-CFG from the message tree. Select “Save current configuration”. Click Send again.
If you need to restore the module back to its default settings, select"Revert to default configuration" and click Send. Then also Save the settings.
Best,
Paul