Gravity GNSS positioning system V1.0 not working correctly!
Hi there,
Just set up my new Gravity GNSS positioning system V1.0, everything seems fine except latitude and longitude direction appears to be reversed.
longitude degrees and latitude degrees are correct.
The code below prints correctly but notice I had to swap direction variables.
Serial.print("latitude = ");
Serial.print(lat.latitudeDegree,6);
Serial.print(" degrees ");
Serial.println((char)lon.lonDirection);
Serial.print("longitude = ");
Serial.print(lon.lonitudeDegree,6);
Serial.print(" degrees ");
Serial.println((char)lat.latDirection);
Below is the print out.
Also what is gnss.setRgbOn();? and why is “ Course over ground = 198.36” when it is not moving?
Thank you
Vaughn
Hi Jenna,
Below is the example code from the DFrobot GNSS library ‘getGNSS’
[code]/*! * @file getGNSS.ino * @brief Get gnss simple data * @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) * @license The MIT License (MIT) * @author ZhixinLiu([email protected]) * @version V1.0 * @date 2023-03-07 * @url https://github.com/dfrobot/DFRobot_GNSS */
#include "DFRobot_GNSS.h"
#define I2C_COMMUNICATION //use I2C for communication, but use the serial port for communication if the line of codes were masked
#ifdef I2C_COMMUNICATION DFRobot_GNSS_I2C gnss(&Wire ,GNSS_DEVICE_ADDR);#else/* ---------------------------------------------------------------------------------------------------------------------* board | MCU | Leonardo/Mega2560/M0 | UNO | ESP8266 | ESP32 | microbit | m0 |* VCC | 3.3V/5V | VCC | VCC | VCC | VCC | X | vcc |* GND | GND | GND | GND | GND | GND | X | gnd |* RX | TX | Serial1 TX1 | 5 | 5/D6 | D2 | X | tx1 |* TX | RX | Serial1 RX1 | 4 | 4/D7 | D3 | X | rx1 |* ----------------------------------------------------------------------------------------------------------------------*//* Baud rate cannot be changed */ #if defined(ARDUINO_AVR_UNO) || defined(ESP8266) SoftwareSerial mySerial(4, 5); DFRobot_GNSS_UART gnss(&mySerial ,9600); #elif defined(ESP32) DFRobot_GNSS_UART gnss(&Serial1 ,9600 ,/*rx*/D2 ,/*tx*/D3); #else DFRobot_GNSS_UART gnss(&Serial1 ,9600); #endif#endif
void setup(){ Serial.begin(115200); while(!gnss.begin()){ Serial.println("NO Deivces !"); delay(1000); }
gnss.enablePower(); // Enable gnss power
/** Set GNSS to be used * eGPS use gps* eBeiDou use beidou* eGPS_BeiDou use gps + beidou* eGLONASS use glonass* eGPS_GLONASS use gps + glonass* eBeiDou_GLONASS use beidou +glonass* eGPS_BeiDou_GLONASS use gps + beidou + glonass*/ gnss.setGnss(eGPS_BeiDou_GLONASS);
// gnss.setRgbOff(); gnss.setRgbOn(); // gnss.disablePower(); // Disable GNSS, the data will not be refreshed after disabling }
void loop(){ sTim_t utc = gnss.getUTC(); sTim_t date = gnss.getDate(); sLonLat_t lat = gnss.getLat(); sLonLat_t lon = gnss.getLon(); double high = gnss.getAlt(); uint8_t starUserd = gnss.getNumSatUsed(); double sog = gnss.getSog(); double cog = gnss.getCog();
Serial.println(""); Serial.print(date.year); Serial.print("/"); Serial.print(date.month); Serial.print("/"); Serial.print(date.date); Serial.print("/"); Serial.print(utc.hour); Serial.print(":"); Serial.print(utc.minute); Serial.print(":"); Serial.print(utc.second); Serial.println(); Serial.print("latitude Direction "); Serial.println((char)lat.latDirection); Serial.print("longitude Direction "); Serial.println((char)lon.lonDirection); // Serial.print("lat DDMM.MMMMM = "); // Serial.println(lat.latitude, 5); // Serial.print(" lon DDDMM.MMMMM = "); // Serial.println(lon.lonitude, 5); Serial.print("lat degree = "); Serial.println(lat.latitudeDegree,6); Serial.print("lon degree = "); Serial.println(lon.lonitudeDegree,6);
Serial.print("star userd = "); Serial.println(starUserd); Serial.print("alt high = "); Serial.println(high); Serial.print("sog = "); Serial.println(sog); Serial.print("cog = "); Serial.println(cog); Serial.print("gnss mode = "); Serial.println(gnss.getGnssMode()); delay(30000);}[/code]
The two Serial.print statements in bold have been added to make the output more readable.
Below is the output.
London UK is 51.5072° N, 0.1276° W
I am 120Miles NW of London so I cant be 2.24 degrees N i.e. 2.24 degrees above the equator!!
Either the library is in error or the device is.
VeeBeeHi!
Sorry for the late reply.
We had fixed this issue and updated the library. pls try downloading the library and adding it to Arduino IDE.
Hi!
1.setRgbOn( )
2.Course over ground
The course over ground of the GNSS module is the angle corresponding to the direction of an object, starting from a reference direction (usually true north or magnetic north) and moving clockwise. The heading is expressed in degrees, ranging from 0 to 360.
jenna
I have seen the code for Rgb. I was asking what it was for, but I have found out already!
I know what “course over ground” means. It says it is calculated from two positions separated by time. If the position does not change it should be no course.
The main purpose of my post has not been addressed. Lat.direction returns the longitude direction and visa-versa.
I live at 52 degrees north of the equator i.e. my latitude is 52 N. The device says 52 W it is wrong.