slashdevin / neogps Goto Github PK
View Code? Open in Web Editor NEWNMEA and ublox GPS parser for Arduino, configurable to use as few as 10 bytes of RAM
License: GNU General Public License v3.0
NMEA and ublox GPS parser for Arduino, configurable to use as few as 10 bytes of RAM
License: GNU General Public License v3.0
Hello
I'm trying to create a GPS tracker, which store the current location to a SD card (when moving) and send it to my server when on WIFI.
It seems to work, but the timestamp seems to be in the 1970'. Am I doing something wrong?
15548742,8,5x.xx,9.xx,1.14
15548767,7,5x.xx,9.xx,1.24
$ date -d @15548767
tir jun 30 00:06:07 CET 1970
The hardware is a NodeMCU v3 (esp8266) and a GV-NEO6MV2, and software wise I'm using NeoGPS 4.1.7 and Arduino ESP8266 v2.3.0.
The code is as following:
/*
SD card datalogger
This example shows how to log data from three analog sensors
to an SD card using the SD library.
The circuit:
* analog sensors on analog ins 0, 1, and 2
* SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)
created 24 Nov 2010
modified 9 Apr 2012
by Tom Igoe
This example code is in the public domain.
*/
// https://forum.arduino.cc/index.php?topic=46900.0
//#define DEBUG
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <SD.h>
#include <NMEAGPS.h>
NMEAGPS gps;
#include <SoftwareSerial.h>
SoftwareSerial serialGPS(D1, 0);
void setup() {
// https://github.com/esp8266/Arduino/blob/d46d742db1c066eb36ef2d4d0706e0faba1f2c23/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino#L29
WiFi.mode(WIFI_STA);
WiFi.begin("xxx", "xxx");
#ifdef DEBUG
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Initializing SD card...");
#endif
// see if the card is present and can be initialized:
if (!SD.begin(SS)) {
ESP.restart();
#ifdef DEBUG
Serial.println("Card failed, or not present");
#endif
} else {
#ifdef DEBUG
Serial.println("card initialized.");
#endif
}
}
bool sendData() {
if (WiFi.status() == WL_CONNECTED) {
#ifdef DEBUG
Serial.println("wifi connected");
Serial.printf("heap size: %u\n", ESP.getFreeHeap());
#endif
// https://github.com/wiieva/examples/blob/59e7e7fc40df6460a1d1918d7bb47cd681898249/wiieva-intro/wiieva-intro.cpp
File dataFile = SD.open("datalog.txt", FILE_READ);
#ifdef DEBUG
Serial.printf("dataFile.size: %u\n", dataFile.size());
#endif
if (dataFile.size() > 0) {
HTTPClient http;
http.begin("http://xx.xx.xx.xx:8082/");
int httpCode = http.sendRequest ("POST", &dataFile, dataFile.size());
http.end();
#ifdef DEBUG
Serial.printf("httpCode: %u\n", httpCode);
#endif
// Memory leak :/
delay(10000);
if (httpCode == 200) {
SD.remove("datalog.txt");
return true;
}
return false;
}
return true;
}
return false;
}
void loop() {
/*if(serialGPS.available()){
Serial.write(serialGPS.read());
}*/
//Serial.println(gps.available( serialGPS ));
sendData();
while (gps.available( serialGPS )) {
sendData();
gps_fix fix = gps.read();
String dataString = "";
//Serial.println(fix.speed_kph());
if (fix.valid.speed && fix.speed_kph() > 1 && fix.valid.location && fix.valid.altitude) {
dataString += String(fix.dateTime) + ",";
dataString += String(fix.satellites) + ",";
// https://github.com/SlashDevin/NeoGPS/blob/master/extras/doc/Data%20Model.md#data-model
// "~7 significant digits"
// https://github.com/SlashDevin/NeoGPS/blob/master/extras/doc/Data%20Model.md#precision
// "32-bit ints have 10 significant digits, so you can detect very"
dataString += String(fix.latitude(), 10) + ",";
dataString += String(fix.longitude(), 10) + ",";
dataString += String(fix.speed_kph());
dataString += "\n";
File dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
dataFile.print(dataString);
dataFile.close();
}
#ifdef DEBUG
Serial.print(dataString);
#endif
delay(10000);
}
}
}
-- Kristian
Is it possible to configure the library without editing files downloaded by library manager? Is this library even usable with Arduino IDE?
Hey SlashDevin
i have not tested this code but i have one query and hoping you will help me with that
Query is : i need Long , Lat and HDOP data cont. from GPS within minium time like 1uh (microsecond) so is there a way that we can use your library and we get all those data is less time ?
Think I figured out the issue based on your comments in issue #11. Since I am running the ublox.ino example it uses the ubxGPS.cpp to parse the UBX messages (I can it commands previously) so I checked the ubxCFG file and ubxGPS.h/.cpp and there is no parsing option for the UBX-NAV-DOP message that contains those fields
(before I begin, I know the answer is almost certainly going to be "write a new parser for it", and I probably will, but)
I got a ublox neo 6m and ran NMEAdiagnostic.ino: the ublox is transmitting on 9600, and in the test I see the sentences coming through, but it's $GPTXT
, which isn't one of the default message types, so the code continued to scan.
Since this is an out-of-the-box thing I got from Amazon I was surprised that there was something that wasn't supported (since ublox is specifically). Like I said, I know I can make NeoGPS accept anything, but has it already been done by someone? (not that I could tell from searching) If I wrote it, would you consider a PR to add it? Or does this mean I got a malfunctioning ublox?
Hello SlashDevin, using an ESP8266 MCU...
I only have one hardware serial port. I am using it for the GPS. I have a physical switch to disable GPS & enable uploading of newly compiled code changes, or if the switch was removed I could also upload such firmware updates via a ESP8266 webserver. This system works perfectly - I have been using it with TinyGPS++, so I know my wiring and code around this is sound.
I do all my debug & monitoring using telnet thanks to: https://github.com/JoaoLopesF/ESP8266-RemoteDebug-Telnet
My issue is that I can't seem to get NeoGPS working showing satellites with fix when using Serial, even though the light on the GPS indicates it has a valid fix.
Not including all the wifi, lorawan, webserver & standard stuff It looks roughly like:
#include <NMEAGPS.h>
#include <RemoteDebug.h>
RemoteDebug Debug;
#define gpsPort Serial
NMEAGPS gps;
gps_fix fix;
void setup(void) {
Debug.printf("GPS port init \n");
gpsPort.begin(9600, SERIAL_8N1);
}
void loop(void) {
fix = gps.read();
Debug.printf("Satellites with fix: %u \n", fix.satellites);
}
I have tried using the great new tabular example Tabular.ino rather than just displaying the number of satellites as in the example above, but it seems to continue the tradition of using the only hardware serial port for debug messages & general output rather than allowing me to use it for the GPS... my modifications to it to send to the RemoteDebug library don't seem to result in any data either, though this might be due to the added complexity of your print feature.
My thought is just that I could use NeoHWSerial with interrupt support on the sole hardware serial where a GPS is connected. Once I get just Serial working, I'll move onto using NeoHWSerial.
Would you have a tip?
Hi man,
Thank you so much for your nice packages.
I've arduino sim900 + Neo-6m-0-001 + Arduino Uno.
I can successfully send GPS data (lat, lng, spd , ...etc ) via sms to a number.
Now I have an http web server, I want to send these data to it,
x.x.x.x/getData.
Please could you give me a code how to setup my url, gprs ?
Thanks.
Using IDE 1.8.5 and TD1.40 I tried compiling a program I have using NeoGPS and I received the following warning message:
Programs\arduino-1.8.5\hardware\teensy\avr\cores\teensy3/WString.h:33:0,
from C:\Local Programs\arduino-1.8.5\hardware\teensy\avr\cores\teensy3/Print.h:38,
from C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS\src\DMS.cpp:20:
C:\Local Programs\arduino-1.8.5\hardware\teensy\avr\cores\teensy3/avr/pgmspace.h:113:0: warning: "pgm_read_ptr" redefined
#define pgm_read_ptr(addr) ({ \
^
In file included from C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS\src\DMS.h:21:0,
from C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS\src\DMS.cpp:18:
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS\src\NeoGPS_cfg.h:106:0: note: this is the location of the previous definition
#define pgm_read_ptr(addr) (*(const void **)(addr))
^
I reported this as an issue in Teensy core-libs and Paul identified the problem as in NEOGPS as associated with:
//------------------------------------------------------------------------
// The PROGMEM definitions are not correct for Zero and MKR1000
#if !defined(__AVR__)
// TODO: use the Zero/MKR1000-specific symbols
#undef pgm_read_ptr
#define pgm_read_ptr(addr) (*(const void **)(addr))
#endif
Guess easy fix would be:
#if !defined(__AVR__) to #if !defined(__AVR__) or !defined(__TEENSYDUINO__)
Thanks
Mike
While trying to run the tabular example in the library I ran into the following error:
Tabular: In function 'const __FlashStringHelper* compassDir(uint16_t)': Tabular:200: error: 'pgm_read_ptr' was not declared in this scope return (const __FlashStringHelper *) pgm_read_ptr( &dirStrings[ dir ] );
I am using Arduino IDE 1.8.4 with the latest version of the Teensyduino (1.39 beta 1) and compiling for a Teensy 3.5.
Do not know how to fix this one.
Thanks
Mike
Hey, thank you so much for all the work! Great library (even kind of usable for me as a total beginner;)!
But i have two questions:
i cannot find a simple way to get the traveled distance. Is there anything already implemented in the library, what i could use to realize some kind of odometer?
I am working right now with the example file NMEASDLog.ino. It workes wonderfully, i changed a little bit, that i directly outputs gpx files, so nothing special. But here is the question: if i not only want to write down anything to SD card, but also display it on an lcd, where would i put the additional code?
to be a little bit more clear: i have basically these lines added to the example file NMEASDLog.ino: `#include <UTFT.h>
UTFT myGLCD(ILI9341_16, 38, 39, 40, 41);in the setup routine are these two lines new:
myGLCD.InitLCD();
myGLCD.setFont(GroteskBold16x32 ); and the very last line before the last } is:
myGLCD.print("TEST", 0, 0);
}But it is not working at all. (it simply does not show anything). also when adding a:
DEBUG_PORT.println( F("DEBUGTEST") );` it does not show up.
Is there any reason, that commands in loop() are not dealt with?
Thanks a lot!,
Pcace
It would be nice if the library were available for installation through the Arduino Library Manager. Here is the page about getting a library hosted on github into the list.
#include <NeoTeeStream.h> and #include <NeoSWSerial.h> are both not in the download and therefor not working. Where can i find these libs, or can they be uploaded with the rest. This will help me a lot, cause i cant seem to configure my TINY RTK neo m8p through u-blox. Many thanks.
p.s. forgot to say it was about example rate.
Hi,
Using Visual Micro Arduino IDE for visual studio community edition 2017,
Your library isn't recognized.
When installed from zip or from the library manager.
#include <NMEAGPS.h>
results in 'cannot open source file'
even though the library manager shows NeoGPS is installed.
I can't select it in the list of installed libraries, it doesn't show.
It is recognized in the Arduino compiler 1.8.2
Let me know if I need to push this to Visual Micro.
Cheers,
X
When Serial.println(fix.dateTime.day);
is used, it only prints the second character. For instance today is 27/09/2016 but only "7" gets printed.
However Serial.println(fix.dateTime.year); prints 16 as expected.
This issue also occurs when passing the fix.dateTime.day value into a variable, not just with serial.print
how to set gps to 10ghz and set baud rate 115200 without input r0 sir ?
Hi,
First I just want to say great library and its been fun learning how to use it. The forum helped a lot. I am running windows 10 64bit, IDE 1.6.11 and teensyduino 1.30 beta 3. Receiving following errors when I try using the Teensy3.2 using the NEMAcoherent sketch. It does work fine for the Mega 2560.
Arduino: 1.6.10 (Windows 10), TD: 1.30-beta3, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimize speed (overclock), US English"
Build options changed, rebuilding all
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseGSV(char)':C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:800:68: error: cannot bind packed field '((NMEAGPS_)this)->NMEAGPS::satellites[((int)((NMEAGPS_)this)->NMEAGPS::sat_count)].NMEAGPS::satellite_view_t::azimuth' to 'uint16_t& {aka short unsigned int&}'
parseInt( satellites[sat_count].azimuth, chr ); ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseLat(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1269:9: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::location.NeoGPS::Location_t::_lat' to 'int32_t& {aka long int&}'
); ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseLon(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1308:9: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::location.NeoGPS::Location_t::_lon' to 'int32_t& {aka long int&}'
); ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseHDOP(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1417:40: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::hdop' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.hdop, chr, 3 )) ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseVDOP(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1432:40: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::vdop' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.vdop, chr, 3 )) ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parsePDOP(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1447:40: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::pdop' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.pdop, chr, 3 )) ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parse_lat_err(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1462:46: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::lat_err_cm' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.lat_err_cm, chr, 2 )) ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parse_lon_err(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1477:46: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::lon_err_cm' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.lon_err_cm, chr, 2 )) ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp: In member function 'bool NMEAGPS::parse_alt_err(char)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\NMEAGPS.cpp:1492:46: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::alt_err_cm' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.alt_err_cm, chr, 2 ))
^
Error compiling for board Teensy 3.2 / 3.1.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hello,
Very impressed with the library, but it doesn't quite cover everything I need. Using a Ublox GPS and I need most of the data from the PUBX_00 message, but have been unable to get the vertical velocity. Have tried going through the various .h and .cpp files to add a "GPS_FIX_VERT_VEL" and "parseVVel()", but have been unsuccessful. Can this be easily done? Is there a set of steps I should follow to incorporate this? Brand new to GitHub so my apologies if this isn't the right forum/format.
I can get every other specific data from gps_fix except latitude and longitude in DMS.
static gps_fix fix_data;
Serial.print(fix_data.latitudeDMS.degrees);
gets me compile error:
NMEA:117: error: 'class gps_fix' has no member named 'latitudeDMS'
Thanks for help.
Hi SlashDevin!
I would like to know, how to get the SBAS(WASS, EGNO...) information. I haven't being able to find a way to do it in your libraries.
Thanks in advance
I have the impression that fix.lon_err_cm and fix.alt_err_cm / fix.lon_err() and fix.alt_err() are swaped by the parser.
Hi, so i tried to compile one of the examples to work with a nodeMCU ESP8266 board, but it failed. Is there a way to make this lib compatibile with this board?
Hi SlashDevin,
I am trying to map the current satellite configuration to a reached precision level. Hence, I used the "full" configuration of NeoGPS to generate the required data based on a SainSmart Ublox NEO-6M module. But I realized that the "Satellite Array" included up to 16 satellites. I believe to know, that more than 12 satellites should never be visible from a specific point.
The documentation of gps.satellies[] mentions that : "There is additional information that is not related to a fix." Does the satellite array collects and stores the satellite parameters in a specific way? Are these information suitable for my project?
Best wishes
Sebastian
how to add fix.latitude sprintf ? I try
char tanggalDanJam[100];
sprintf(tanggalDanJam,%.6f, (fix.latitude(), 6)
output is
?
how to show adjust date & time in LCD 5110 ?
I try not show in LCD 5110
while (gps.available( gpsPort )) {
fix = gps.read();
if (fix.valid.time && fix.valid.date) {
adjustTime( fix.dateTime );
display << fix.dateTime;
}
display.display();
}
Hi, Devin,
Current version is not working in my DUE.
Do you have Auduino/DUE version for this NeoGPS?
Thanks
I try on mega2560 with uncomment
#define gpsPort Serial1
#define GPS_PORT_NAME "Serial1"
#define DEBUG_PORT Serial
in GPSport.h but I can't show coordinat. I am try with NMEAsimple.ino
Hey,
I have another questions. I simply want to connect my uBlox GPS serial port to my adruino uno and read in NMEA sentences as well as RAW messages(RAWX, SFRBX,MEASX) and then store them to a microSD card (with openLog).
It works fine so far for storing NMEA sentences. However if I want to store RAW messages my code has some problems.....
Thats why I want to ask how can be determined the ("end of line for raw messages?") or how can I use NEOGPS to simply print all the incoming data from the serial port of my gps module.
My code so far was:
String inData;
void setup() {
Serial.begin(38400);
}
void loop() {
while (Serial.available() > 0)
{
char recieved = Serial.read();
inData += recieved;
// Process message when new line character is recieved
if (recieved == '\n')
{
//Serial.print("Arduino Received: ");
Serial.print(inData);
inData = ""; // Clear recieved buffer
}
}
}
I mean if I connect my Serial Port of my gps module with a serial to usb converter and have a look at the data with RealTerm then all the linebrakes and so on is managed fine.
My goal is to store NMEA data and RAW data on an microSD card so that this file can afterwards be opened by uCenter and when playing it it will recognice the RAW messages as well.
Everything with serial.print will be written to my sd card.
Thanks! :)
Is there any way I can use this library to shift the GPS into low power mode?
There is no global mention of the license for this project.
Some files contain an LGPL header but since this is targeted at embedded systems without any shared library functionality that doesn't really make sense.
Trying to send a cold start request to a UBlox 7m device using the UBX protocol.
I figured this should work:
static const uint8_t gps_cold[] __PROGMEM = { ublox::UBX_CFG, ublox::UBX_CFG_RST, sizeof(ublox::cfg_reset_t), 0, 0xff, 0xff, 0x02, 0x00};
static const ublox::cfg_reset_t *cfg_cold_P = (const ublox::cfg_reset_t *) &gps_cold[0];
void gpsColdStart(void) {
gps.send_request_P(*cfg_cold_P);
However, I do not get any response/reply on this command? ๐ข
Hi, thanks so much for this code! But if you can i need a simple thing, i wish use your library in my project but i don't understand as i can read the data from the GPS (the example NMEA work and i can read the data) like Serial.print(GPS.lat) can i use the data in this simple way? Can you make me a simple example?! Many thanks!
We are investigating how to use our GPS Neo6m module to be as least time-consuming as possible in the following situation..
Our GPS is used for the following:
This GPS functionality is part of a larger project of sensors (timed and interrupt driver) and activators, so every ms we spare on te GPS handling is welcome. We are wondering what would be the best way to achieve this, effectively ignoring all the data the gps is sending between "polling" intervals.
We though about using the interrupts mode of NeoGPS but wouldn't the interrupt handling still take time to process messages from the GPS when we are not really interested in the results?
Any advice is welcome!
how to set 10hz neo m8n ?
Am I correct in thinking that the distance measuring function can only work to calculate the distance from the current to a location setup in the variable declared before void setup? I'd like to "save" a location at some point in my program, and then at a later stage measure the distance traveled from that point. This location will be changed by the user multiple times. And I'm sorry if this shouldn't be requested here, but I can't find a help or ask a question button anywhere.
Firstly, let me say you that this is a great library for GPS and UBX protocol!
I try to work with your ublox.ino pure UBX example, but I only need 2 new messages. I'm working with extra UBX functions (UBX only) in the M8U, this is a UDR with 3D IMU sensors, and a Teensy 3.2 board.
This new messages are NAV-ODO (0x01 0x09) and HNR-PVT(x028 0x00) .
I add this, following your DOP code as reference, in ubxGPS.cpp
:
bool ubloxGPS::parseNavODO ( uint8_t chr )
{
bool ok = true;
//if (chrCount == 0) Serial.print( F( "dop ") );
#ifdef UBLOX_PARSE_ODO
switch (chrCount) {
case 4: case 5: case 6: case 7:
ok = parseTOW( chr );
break;
#ifdef GPS_FIX_ODO_DISTANCE
case 8: case 9: case 10: case 11:
NMEAGPS_INVALIDATE( distance );
((uint32_t *)&m_fix.distance) [ chrCount-6] = chr;
m_fix.valid.distance = true;
break;
#endif
#ifdef GPS_FIX_ODO_TOTAL_DISTANCE
case 12: case 13: case 14: case 15:
NMEAGPS_INVALIDATE( total_distance );
((uint32_t *)&m_fix.total_distance) [ chrCount-12] = chr;
m_fix.valid.total_distance = true;
break;
#endif
#ifdef GPS_FIX_ODO_DISTANCE_STD
case 16: case 17: case 18: case 19:
NMEAGPS_INVALIDATE( distanceSTD );
((uint32_t *)&m_fix.distanceSTD) [ chrCount-16] = chr;
m_fix.valid.distanceSTD = true;
break;
#endif
}
#endif
return ok;
} // parseNavODO
And add UBX_NAV_ODO
case in ubloxGPS::parseField
function and bool parseNavODO ( uint8_t chr );' in 'ubx.GPS.h.
I checked that It parses ODO message (0x01 0x09) correctly, but I don't know how receive into <Streamers.h>
or my sketch directly (as 'if (fix.valid.distance) Serial.print( fix.distance / 1000 );'
Would be great if you can explain/example us how can I try to check this data and how HNR-PVT could be implemented.
Thanks again,
Best regards!
Hi,
I am trying to use Neo-6m module with Arduino Uno, but unfortunately I have not been able to get the data from the module. I have attached a screen-shot of the raw data recieved with NMEA.ino example.
I am using AltSoftSerial in the GPSport.h, for communication and connected my GPS TX line to pin 8 and GPS RX line to pin 9 of arduino. I have been through almost all the GPS libraries availaible online for arduino but none seem to work. Can anyone help me?
Hi @SlashDevin
Me again. I decided to move away from tinygps++ and incorporate a version of NEMACoherent into my obstacle avoidance sketch (https://github.com/mjs513/Dagu-Rover-5-Obstacle-Avoidance-Testbed/tree/master/DaguRover5AutoNavv5). I first tested a standalone where I hard coded the gps port as serial2 and it worked fine (here is the standalone code):
#include <Arduino.h>
#include "NMEAGPS.h"
#include <Streaming.h>
//======================================================================
// Program: NMEAcoherent.ino
//
// Prerequisites:
// 1) NMEA.ino works with your device
// 2) At least one NMEA sentence has been enabled in NMEAGPS_cfg.h
// 3) NMEAGPS_COHERENT is enabled in NMEAGPS_cfg.h
// 3) Explicit or Implicit merging is enabled in NMEAGPS_cfg.h
//
// Description: This program guarantees coherency in the fix data.
// When a sentence is received with a new time interval,
// the 'coherent' fix will start with just that new data.
// All data from the previous interval is replaced or deleted.
// As new sentences are received, data from this new interval
// are merged into the 'coherent' fix.
//
// This program also shows how to 'poll' for a specific message
// if it is not sent by default.
//
// Serial is for debug output to the Serial Monitor window.
//
//======================================================================
#define gps_port Serial2
#define DEBUG_PORT Serial
//------------------------------------------------------------
// Check that the config files are set up properly
#if !defined( NMEAGPS_PARSE_GGA ) & !defined( NMEAGPS_PARSE_GLL ) & \
!defined( NMEAGPS_PARSE_GSA ) & !defined( NMEAGPS_PARSE_GSV ) & \
!defined( NMEAGPS_PARSE_RMC ) & !defined( NMEAGPS_PARSE_VTG ) & \
!defined( NMEAGPS_PARSE_ZDA ) & !defined( NMEAGPS_PARSE_GST ) & \
!defined( NMEAGPS_RECOGNIZE_ALL )
#error No NMEA sentences enabled
#endif
#ifndef NMEAGPS_COHERENT
#error You must define NMEAGPS_COHERENT in NMEAGPS_cfg.h!
#endif
#ifdef NMEAGPS_NO_MERGING
#error You must define EXPLICIT or IMPLICIT merging in NMEAGPS_cfg.h!
#endif
#ifdef NMEAGPS_INTERRUPT_PROCESSING
#error You must *NOT* define NMEAGPS_INTERRUPT_PROCESSING in NMEAGPS_cfg.h!
#endif
//------------------------------------------------------------
static NMEAGPS gps;
static gps_fix coherent;
NeoGPS::Location_t madrid( 407746670L, -738146590L );
//----------------------------------------------------------------
static void doSomeWork( const gps_fix & fix )
{
// Print all the things!
//trace_all( DEBUG_PORT, gps, fix );
DEBUG_PORT << coherent.hdop << ", " << coherent.pdop << ", " << coherent.speed() << ", " ;
DEBUG_PORT << coherent.heading() << ", " << coherent.latitudeL() << ", " ;
DEBUG_PORT << coherent.longitudeL() << ", " << coherent.satellites << ", ";
DEBUG_PORT << coherent.dateTime << "." << coherent.dateTime_cs <<", " << coherent.valid.location;
DEBUG_PORT << endl;
float dist = NeoGPS::Location_t::DistanceKm( coherent.location, madrid );
float bearing = NeoGPS::Location_t::BearingToDegrees( coherent.location, madrid );
DEBUG_PORT << dist*1000. << ", " << bearing;
DEBUG_PORT << endl;
#ifdef NMEAGPS_PARSE_GST
// Now is a good time to ask for a GST. Most GPS devices
// do not send GST, and some GPS devices may not even
// respond to this poll. Other may let you request
// these messages once per second by sending a
// configuration command in setup().
gps.poll( &gps_port, NMEAGPS::NMEA_GST );
#endif
} // doSomeWork
//------------------------------------
static void GPSloop()
{
while (gps.available( gps_port )) {
coherent = gps.read();
doSomeWork( coherent );
}
} // GPSloop
//--------------------------
void setup()
{
// Start the normal trace output
DEBUG_PORT.begin(115200);
while (!DEBUG_PORT)
;
DEBUG_PORT.print( F("NMEAcoherent: started\n") );
DEBUG_PORT.print( F("fix object size = ") );
DEBUG_PORT.println( sizeof(gps.fix()) );
DEBUG_PORT.print( F("NMEAGPS object size = ") );
DEBUG_PORT.println( sizeof(gps) );
DEBUG_PORT.println( F("Looking for GPS device on " ) );
// Check configuration
#if !defined( NMEAGPS_PARSE_GGA ) & !defined( NMEAGPS_PARSE_GLL ) & \
!defined( NMEAGPS_PARSE_GSA ) & !defined( NMEAGPS_PARSE_GSV ) & \
!defined( NMEAGPS_PARSE_RMC ) & !defined( NMEAGPS_PARSE_VTG ) & \
!defined( NMEAGPS_PARSE_ZDA ) & !defined( NMEAGPS_PARSE_GST ) & \
defined( NMEAGPS_RECOGNIZE_ALL )
DEBUG_PORT.println( F("\nWARNING: No NMEA sentences are enabled: no fix data will be displayed.") );
#endif
//trace_header( DEBUG_PORT );
DEBUG_PORT.flush();
// Start the UART for the GPS device
gps_port.begin(115200);
#ifdef NMEAGPS_PARSE_GST
gps.poll( &gps_port, NMEAGPS::NMEA_GST );
#endif
}
//--------------------------
void loop()
{
GPSloop();
}
Unfortunately no data is ever returned. The primary modified files were in the DaguRover5v5.ino and the gpsready() in the sensor_read.ino files. It is like the port is never really being read. Not sure what the problem is - any help would be appreciated.
MIke
This is almost definitely me overlooking something really dumb.
char ffNS = (fix.latitudeDMS.NS);
I get "error: cannot convert 'DMS_t::NS' from type 'char (DMS_t::)() const' to type 'char'"
I also get an error if I try using it in a memcpy:
memcpy(fix.latitudeDMS.NS, &NMEALat[7], 1);
"error: invalid use of non-static member function"
Sorry for the probably noobish question!
Hey,
For analysing purposes, I would like to use NeoGPS on a Windows environment to read in NMEA messages send per serial to my windows laptop. Then I would like to use NeoGPS to write e.g. all the values of only the GPGGA message sentence in different columns of a .txt file.
I will later use this file and copy its values into a exel file and then I hope I will be able to plot these values.
Is it possible to use NeoGPS just on Windows?
Thanks for your help.
neogps support with stm32?
I can't find any reference to using an i2c in the documentation or code. Is the feature implemented? if so how should I start?
I get compilation errors if I try to compile the NMEAtest script on a 32 bit platform (with IDE1.6.5).
The first error is:
In file included from C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS/NMEAGPS.h:25:0,
from NMEAtest.ino:21:
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS/NMEAGPS_cfg.h:155:2: error: #error You must define NMEAGPS_DERIVED_TYPES in NMEAGPS.h in order to parse Talker and/or Mfr IDs
#error You must define NMEAGPS_DERIVED_TYPES in NMEAGPS.h in order to parse Talker and/or Mfr IDs
^
If I comment this one, I get the next error:
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseLat(char)':
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp:807:32: error: cannot bind packed field '((NMEAGPS_)this)->NMEAGPS::m_fix.gps_fix::lat' to 'int32_t& {aka long int&}'
parseDDDMM( m_fix.lat, chr );
^
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseLon(char)':
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp:828:32: error: cannot bind packed field '((NMEAGPS_)this)->NMEAGPS::m_fix.gps_fix::lon' to 'int32_t& {aka long int&}'
parseDDDMM( m_fix.lon, chr );
^
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp: In member function 'bool NMEAGPS::parseHDOP(char)':
C:\Users\Andreas\Dropbox\ASP\Arduino\Sketches\libraries\NeoGPS\NMEAGPS.cpp:897:38: error: cannot bind packed field '((NMEAGPS*)this)->NMEAGPS::m_fix.gps_fix::hdop' to 'uint16_t& {aka short unsigned int&}'
if (parseFloat( m_fix.hdop, chr, 3 ))
^
Error compiling.
I would like to use your great library on a 32 bit platform because of speed, double precison, and many serial connections.
Hi!
I use Arduino UNO and Neo m8n clone and like to control my scrolling clock with NMEAtimezone code. But when I want to see Daylight Savings Time added in real time I can't see it. For this I open NMEAtimezone.ino and uncomment <AltSoftSerial.h> and change my zone_hours and changeover time. First I noticed I must set changeover time in UTC and not by my local clock. But when I watch Serial Monitor and time passes my changeover time - nothing happening, time just ticking forward. Change in hours occur after Arduino reset. Somehow in my case zone_hours++ not processed without reloading whole code. What I must change here?
Getting the following errors during compile:
Arduino: 1.6.10 (Windows 10), TD: 1.30-beta3, Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\ubxGPS.cpp: In member function 'bool ubloxGPS::parseNavPosLLH(uint8_t)':
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\ubxGPS.cpp:597:11: error: 'U1' was not declared in this scope
U1[ chrCount-20 ] = chr; ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\ubxGPS.cpp:599:31: error: 'U4' was not declared in this scope
uint16_t err_cm = U4/100; ^
C:\Users\CyberPalin\Documents\Arduino\libraries\NeoGPS-master\ubxGPS.cpp:620:32: error: 'U4' was not declared in this scope
m_fix.alt_err_cm = U4/100; ^
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Not sure if it is me or there is an error in the lib. I did change the beginning part of the sketch since I am using Serial2
#include <Arduino.h>
#include "ubxGPS.h"
//======================================================================
// Program: ublox.ino
//
// Prerequisites:
// 1) You have a ublox GPS device
// 2) PUBX.ino works with your device
// 3) You have installed the ubxGPS.* and ubxmsg.* files.
// 4) At least one UBX message has been enabled in ubxGPS.h.
// 5) Implicit Merging is disabled in NMEAGPS_cfg.h.
//
// Description: This program parses UBX binary protocal messages from
// ublox devices. It shows how to acquire the information necessary
// to use the GPS Time-Of-Week in many UBX messages. As an offset
// from midnight Sunday morning (GPS time), you also need the current
// UTC time (this is *not* GPS time) and the current number of GPS
// leap seconds.
//
// Serial is for debug output to the Serial Monitor window.
//
//======================================================================
#include <NeoHWSerial.h>
#include "Streamers.h"
#define DEBUG_PORT NeoSerial
#define gps_port NeoSerial2
//------------------------------------------------------------
// Check that the config files are set up properly
#if !defined(UBLOX_PARSE_STATUS) & !defined(UBLOX_PARSE_TIMEGPS) & \
!defined(UBLOX_PARSE_TIMEUTC) & !defined(UBLOX_PARSE_POSLLH) & \
!defined(UBLOX_PARSE_VELNED) & !defined(UBLOX_PARSE_SVINFO)
#error No UBX binary messages enabled: no fix data available for fusing.
#endif
//-----------------------------------------------------------------
// Derive a class to add the state machine for starting up:
// 1) The status must change to something other than NONE.
// 2) The GPS leap seconds must be received
// 3) The UTC time must be received
// 4) All configured messages are "requested"
// (i.e., "enabled" in the ublox device)
// Then, all configured messages are parsed and explicitly merged.
class MyGPS : public ubloxGPS
{
public:
enum
{
GETTING_STATUS,
GETTING_LEAP_SECONDS,
GETTING_UTC,
RUNNING
}
state NEOGPS_BF(8);
MyGPS( Stream *device ) : ubloxGPS( device )
{
state = GETTING_STATUS;
}
//--------------------------
void get_status()
{
static bool acquiring = false;
if (fix().status == gps_fix::STATUS_NONE) {
static uint32_t dotPrint;
bool requestNavStatus = false;
if (!acquiring) {
acquiring = true;
dotPrint = millis();
DEBUG_PORT.print( F("Acquiring...") );
requestNavStatus = true;
} else if (millis() - dotPrint > 1000UL) {
dotPrint = millis();
DEBUG_PORT << '.';
static uint8_t requestPeriod;
if ((++requestPeriod & 0x07) == 0)
requestNavStatus = true;
}
if (requestNavStatus)
// Turn on the UBX status message
enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_STATUS );
} else {
if (acquiring)
DEBUG_PORT << '\n';
DEBUG_PORT << F("Acquired status: ") << (uint8_t) fix().status << '\n';
#if defined(GPS_FIX_TIME) & defined(GPS_FIX_DATE) & \
defined(UBLOX_PARSE_TIMEGPS)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEGPS ))
DEBUG_PORT.print( F("enable TIMEGPS failed!\n") );
state = GETTING_LEAP_SECONDS;
#else
start_running();
state = RUNNING;
#endif
}
} // get_status
//--------------------------
void get_leap_seconds()
{
#if defined(GPS_FIX_TIME) & defined(GPS_FIX_DATE) & \
defined(UBLOX_PARSE_TIMEGPS)
if (GPSTime::leap_seconds != 0) {
DEBUG_PORT << F("Acquired leap seconds: ") << GPSTime::leap_seconds << '\n';
if (!disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEGPS ))
DEBUG_PORT.print( F("disable TIMEGPS failed!\n") );
#if defined(UBLOX_PARSE_TIMEUTC)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEUTC ))
DEBUG_PORT.print( F("enable TIMEUTC failed!\n") );
state = GETTING_UTC;
#else
start_running();
#endif
}
#endif
} // get_leap_seconds
//--------------------------
void get_utc()
{
#if defined(GPS_FIX_TIME) & defined(GPS_FIX_DATE) & \
defined(UBLOX_PARSE_TIMEUTC)
lock();
bool safe = is_safe();
NeoGPS::clock_t sow = GPSTime::start_of_week();
NeoGPS::time_t utc = fix().dateTime;
unlock();
if (safe && (sow != 0)) {
DEBUG_PORT << F("Acquired UTC: ") << utc << '\n';
DEBUG_PORT << F("Acquired Start-of-Week: ") << sow << '\n';
start_running();
}
#endif
} // get_utc
//--------------------------
void start_running()
{
bool enabled_msg_with_time = false;
#if (defined(GPS_FIX_LOCATION) | \
defined(GPS_FIX_LOCATION_DMS) | \
defined(GPS_FIX_ALTITUDE)) & \
defined(UBLOX_PARSE_POSLLH)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_POSLLH ))
DEBUG_PORT.print( F("enable POSLLH failed!\n") );
enabled_msg_with_time = true;
#endif
#if (defined(GPS_FIX_SPEED) | defined(GPS_FIX_HEADING)) & \
defined(UBLOX_PARSE_VELNED)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_VELNED ))
DEBUG_PORT.print( F("enable VELNED failed!\n") );
enabled_msg_with_time = true;
#endif
#if (defined(GPS_FIX_SATELLITES) | defined(NMEAGPS_PARSE_SATELLITES)) & \
defined(UBLOX_PARSE_SVINFO)
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_SVINFO ))
DEBUG_PORT << PSTR("enable SVINFO failed!\n");
enabled_msg_with_time = true;
#endif
#if defined(UBLOX_PARSE_TIMEUTC)
#if defined(GPS_FIX_TIME) & defined(GPS_FIX_DATE)
if (enabled_msg_with_time &&
!disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEUTC ))
DEBUG_PORT.print( F("disable TIMEUTC failed!\n") );
#elif defined(GPS_FIX_TIME) | defined(GPS_FIX_DATE)
// If both aren't defined, we can't convert TOW to UTC,
// so ask for the separate UTC message.
if (!enable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEUTC ))
DEBUG_PORT.print( F("enable TIMEUTC failed!\n") );
#endif
#endif
state = RUNNING;
trace_header( DEBUG_PORT );
} // start_running
//--------------------------
bool running()
{
switch (state) {
case GETTING_STATUS : get_status (); break;
case GETTING_LEAP_SECONDS: get_leap_seconds(); break;
case GETTING_UTC : get_utc (); break;
}
return (state == RUNNING);
} // running
} NEOGPS_PACKED;
// Construct the GPS object and hook it to the appropriate serial device
static MyGPS gps( &gps_port );
#ifdef NMEAGPS_INTERRUPT_PROCESSING
static void GPSisr( uint8_t c )
{
gps.handle( c );
}
#endif
//--------------------------
static void configNMEA( uint8_t rate )
{
for (uint8_t i=NMEAGPS::NMEA_FIRST_MSG; i<=NMEAGPS::NMEA_LAST_MSG; i++) {
ublox::configNMEA( gps, (NMEAGPS::nmea_msg_t) i, rate );
}
}
//--------------------------
static void disableUBX()
{
gps.disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEGPS );
gps.disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_TIMEUTC );
gps.disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_VELNED );
gps.disable_msg( ublox::UBX_NAV, ublox::UBX_NAV_POSLLH );
}
//--------------------------
void setup()
{
// Start the normal trace output
DEBUG_PORT.begin(9600);
while (!DEBUG_PORT)
;
DEBUG_PORT.print( F("ublox binary protocol example started.\n") );
DEBUG_PORT << F("fix object size = ") << sizeof(gps.fix()) << '\n';
DEBUG_PORT << F("ubloxGPS object size = ") << sizeof(ubloxGPS) << '\n';
DEBUG_PORT << F("MyGPS object size = ") << sizeof(gps) << '\n';
//DEBUG_PORT.println( F("Looking for GPS device on " USING_GPS_PORT) );
DEBUG_PORT.flush();
// Start the UART for the GPS device
#ifdef NMEAGPS_INTERRUPT_PROCESSING
gps_port.attachInterrupt( GPSisr );
#endif
gps_port.begin(9600);
// Turn off the preconfigured NMEA standard messages
configNMEA( 0 );
// Turn off things that may be left on by a previous build
disableUBX();
#if 0
// Test a Neo M8 message -- should be rejected by Neo-6 and Neo7
ublox::cfg_nmea_v1_t test;
test.always_output_pos = false; // invalid or failed
test.output_invalid_pos = false;
test.output_invalid_time= false;
test.output_invalid_date= false;
test.use_GPS_only = false;
test.output_heading = false; // even if frozen
test.__not_used__ = false;
test.nmea_version = ublox::cfg_nmea_v1_t::NMEA_V_4_0;
test.num_sats_per_talker_id = ublox::cfg_nmea_v1_t::SV_PER_TALKERID_UNLIMITED;
test.compatibility_mode = false;
test.considering_mode = true;
test.max_line_length_82 = false;
test.__not_used_1__ = 0;
test.filter_gps = false;
test.filter_sbas = false;
test.__not_used_2__= 0;
test.filter_qzss = false;
test.filter_glonass= false;
test.filter_beidou = false;
test.__not_used_3__= 0;
test.proprietary_sat_numbering = false;
test.main_talker_id = ublox::cfg_nmea_v1_t::MAIN_TALKER_ID_GP;
test.gsv_uses_main_talker_id = true;
test.beidou_talker_id[0] = 'G';
test.beidou_talker_id[1] = 'P';
DEBUG_PORT << F("CFG_NMEA result = ") << gps.send( test );
#endif
while (!gps.running())
if (gps.available( gps_port ))
gps.read();
}
//--------------------------
void loop()
{
if (gps.available( gps_port ))
trace_all( DEBUG_PORT, gps, gps.read() );
// If the user types something, reset the message configuration
// back to a normal set of NMEA messages. This makes it
// convenient to switch to another example program that
// expects a typical set of messages. This also saves
// putting those config messages in every other example.
if (Serial.available()) {
do { Serial.read(); } while (Serial.available());
DEBUG_PORT.println( F("Stopping...") );
configNMEA( 1 );
disableUBX();
gps_port.flush();
gps_port.end();
DEBUG_PORT.println( F("STOPPED.") );
for (;;);
}
}
Thanks again Mike
Hi,
Please how could I get course and hdop values from fix. ?
Hello, I have a Garmin LVC 18x GPS that I got working with an arduino Uno with an SD shield. Unfortunately, the Uno was not large enough for the program I am trying to eventually write, so I switched everything to a Mega 2560. The Mega however does not like software serial, which, is what TinyGPSPlus uses. So many forwarded me to NeoGPS. That being said, I have fixed many issues and errors that have popped up, and eventually upgraded the Arduino IDE to get all of them to finally go away. Now, my issue is not an error popping up, but nothing popping up.
I am using the basic NMEA.ino example.
My GPS is 4800 Baud rate (Which I have changed around line 145).
I have switched the RX and TX ports endlessly on 18 and 19 in case I got them mixed up
I tried the original GPSport.h, as well as commented out everything except
#define gpsPort Serial1
#define GPS_PORT_NAME "Serial1"
#define DEBUG_PORT Serial
And still all I get out of the serial window is
NMEA.INO: started
fix object size = 31
gps object size = 84
Looking for GPS device on Serial1
GPS quiet time is assumed to begin after a RMC sentence is received.
You should confirm this with NMEAorder.ino
Status,UTC Date/Time,Lat,Lon,Hdg,Spd,Alt,Sats,Rx ok,Rx err,Rx chars,
When running NMEAorder.ino, I get
No valid sentences, but characters are being received.
Check baud rate or device protocol configuration.
I know the GPS is working because I have just re-tested it on the Uno and it spits out NMEA sentences like $--GGA. The GPS has been sitting in the same spot, so it's not still warming up. I also tested it with NMEADiagnostics and it said the same thing "No valid sentences, but characters are being received" With no conclusion on baud rate (Specs say 4800 which works on Uno)
When I run a while(serial1.available) loop I get A LOT of numbers but no ascii like below
155
78
159
141
167
157
163
157
167
This goes on ad naseum.
I have no idea where else to go. Thank you.
EDIT: I am thinking I need to invert the signal logic? That is what I did with SoftwareSerial(rx,tx,1) but I have not found a way to do this on the Mega 2560 without a 232 shifter? Does this sound like it may be the problem?
Hello,
I've tried to compile NMEA.ino, NMEAdiagnostics.ino, NMEAtest.ino and ublox.ino but compilation fails with these errors:
In file included from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:22:0from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:29, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\examples\NMEA\NMEA.ino:2: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:137:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA float KM_PER_NMI = 1.852; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:137:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA float KM_PER_NMI = 1.852; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:140:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint16_t M_PER_NMI = 1852; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:140:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint16_t M_PER_NMI = 1852; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:143:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA float MI_PER_NMI = 1.150779; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:143:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA float MI_PER_NMI = 1.150779; ^ In file included from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:29:0, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\examples\NMEA\NMEA.ino:2: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h: In member function 'float gps_fix::speed_kph() const': C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:138:52: error: 'KM_PER_NMI' was not declared in this scope float speed_kph () const { return speed() * KM_PER_NMI; }; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h: In member function 'uint32_t gps_fix::speed_metersph() const': C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:141:59: error: 'M_PER_NMI' was not declared in this scope uint32_t speed_metersph() const { return (spd.whole * M_PER_NMI) + (spd.frac * M_PER_NMI)/1000; }; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h: In member function 'float gps_fix::speed_mph() const': C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:144:49: error: 'MI_PER_NMI' was not declared in this scope float speed_mph() const { return speed() * MI_PER_NMI; }; ^ In file included from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:22:0, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:29, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\examples\NMEA\NMEA.ino:2: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h: At global scope: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:96:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA nmea_msg_t NMEA_FIRST_MSG = (nmea_msg_t) (NMEA_UNKNOWN+1); ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:96:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA nmea_msg_t NMEA_FIRST_MSG = (nmea_msg_t) (NMEA_UNKNOWN+1); ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:97:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA nmea_msg_t NMEA_LAST_MSG = (nmea_msg_t) (NMEAMSG_END-1); ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:97:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA nmea_msg_t NMEA_LAST_MSG = (nmea_msg_t) (NMEAMSG_END-1); ^ In file included from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\examples\NMEA\NMEA.ino:2:0: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:290:41: error: 'NMEAGPS_KEEP_NEWEST_FIXES' was not declared in this scope static const bool keepNewestFixes = NMEAGPS_KEEP_NEWEST_FIXES; ^ In file included from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/GPSfix.h:22:0, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:29, from C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\examples\NMEA\NMEA.ino:2: C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:362:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint8_t NMEA_FIRST_STATE = NMEA_IDLE; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:362:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint8_t NMEA_FIRST_STATE = NMEA_IDLE; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: error: 'constexpr' does not name a type #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:363:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint8_t NMEA_LAST_STATE = NMEA_RECEIVING_CRC; ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NeoGPS_cfg.h:81:35: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11 #define CONST_CLASS_DATA static constexpr ^ C:\Users\****USER****\Documents\Arduino\libraries\NeoGPS\src/NMEAGPS.h:363:5: note: in expansion of macro 'CONST_CLASS_DATA' CONST_CLASS_DATA uint8_t NMEA_LAST_STATE = NMEA_RECEIVING_CRC; ^ exit status 1 Errore durante la compilazione per la scheda Arduino/Genuino Mega or Mega 2560.
But with Arduino Uno works fine...
Sorry for my bad English.
Hi man,
Thank you so much for this nice package !
I've imported your library and tested it on Arduino Uno (pinsRx =0, pinxTx = 1).
But I just receive a blank page :
Please what's the mistake ?
Here my program :
#include <NMEAGPS.h>
/*
This program sketch obtain and print the lati,logi,speed,date and time
It requires the use of SoftwareSerial, and assumes that you have a
9600-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
#include <NeoSWSerial.h>
static const int RXPin = 0, TXPin = 1;
NeoSWSerial gpsPort(RXPin, TXPin);
static const uint32_t GPSBaud = 9600;
NMEAGPS gps;
gps_fix fix;
uint8_t fixCount = 0;
void setup()
{
Serial.begin(9600);
gpsPort.begin(GPSBaud);
Serial.println(F("GPS LOADING....."));
Serial.println(F("Obtain and print lati,logi,speed,date and time"));
Serial.println(F("Testing by : "));
Serial.println(F("Billa"));
Serial.println();
}
void loop()
{
while (gps.available( gpsPort )) {
fix = gps.read();
// Once every 5 seconds...
if (++fixCount >= 5) {
displayInfo();
fixCount = 0;
}
}
if ((gps.statistics.chars < 10) && (millis() > 5000)) {
Serial.println( F("No GPS detected: check wiring.") );
while(true);
}
}
void displayInfo()
{
Serial.print(F("Location: "));
if (fix.valid.location) {
Serial.print( fix.latitude(), 5 );
Serial.print( ',' );
Serial.print( fix.longitude(), 5 );
} else {
Serial.print(F("INVALID"));
}
Serial.print(F(" Speed: "));
if (fix.valid.speed) {
Serial.print(fix.speed_kph());
Serial.print(F(" KMPH "));
} else {
Serial.print(F("INVALID"));
}
// Shift the date/time to local time
NeoGPS::clock_t localSeconds;
NeoGPS::time_t localTime;
if (fix.valid.date && fix.valid.time) {
using namespace NeoGPS; // save a little typing below...
localSeconds = (clock_t) fix.dateTime; // convert structure to a second count
localSeconds += 5 * SECONDS_PER_HOUR + 30 * SECONDS_PER_MINUTE; // shift timezone
localTime = localSeconds; // convert back to a structure
}
Serial.print(F(" Date : "));
if (fix.valid.date) {
Serial.print(fix.dateTime.month);
Serial.print('/');
Serial.print(fix.dateTime.date);
Serial.print('/');
Serial.print(fix.dateTime.year);
} else {
Serial.print(F("INVALID"));
}
Serial.print(F(" Time : "));
if (fix.valid.time) {
Serial.print(localTime.hours);
Serial.print(':');
if (localTime.minutes < 10) Serial.print('0');
Serial.print(localTime.minutes);
Serial.print(':');
if (localTime.seconds < 10) Serial.print(F("0"));
Serial.print(localTime.seconds);
} else {
Serial.print(F("INVALID"));
}
Serial.println();
}
Hello,
I am facing the issue while compiling on Arduino IDE. Here is exact error message >>
In file included from C:\Users\abc\Documents\Arduino\libraries\NeoGPS-master/GPSfix.h:34:0,
from C:\Users\abc\Documents\Arduino\libraries\NeoGPS-master/NMEAGPS.h:28,
from neogps_neoswserial.ino:1:
C:\Users\abc\Documents\Arduino\libraries\NeoGPS-master/Location.h:57:52: error: 'NeoGPS::Location_t::RAD_PER_DEG' cannot appear in a constant-expression
CONST_CLASS_DATA float DEG_PER_RAD = 1.0 / RAD_PER_DEG;
^
Error compiling.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.