We have been using a GT-U7 GPS with an Arduino MEGA2560 for our project, but when we test the GPS with the TinyGPS++ it just returns the following:
The code we have been using is as follows, and should be working:
#include <TinyGPS++.h>
TinyGPSPlus gps;
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
while (Serial1.available() > 0) {
gps.encode(Serial1.read());
Serial.print("LAT="); Serial.println(gps.location.lat(), 6);
Serial.print("LONG="); Serial.println(gps.location.lng(), 6);
Serial.print("ALT="); Serial.println(gps.altitude.feet());
Serial.print("SPEED="); Serial.println(gps.speed.mph());
}
}
Any feedback would be greatly appreciated!
srnet
May 7, 2021, 3:06pm
#2
You have the GPS outside with a good view of the Sky ?
Yes, we have the GPS in clear view of the sky and the NMEA data is all correct, but we're having issues with the TinyGPS++ Library returning values of 0.0000
And you’re not just off the coast of Africa in the Atlantic Ocean?
a7
srnet
May 7, 2021, 3:17pm
#5
There is some instructions on troubleshooting a GPS here, including a short program that will copy the GPS output to the Serial monitor so you can see what is going on;
On public forums, such as Arduino, I see a great many posts along the lines of ‘My GPS does not work’. Most often constructors connect a GPS to an Arduino on their bench indoors, load up a complete application and find it does not work in that there...
21qhaverstick:
void loop() {
while (Serial1.available() > 0) {
gps.encode(Serial1.read());
Serial.print(“LAT=”); Serial.println(gps.location.lat(), 6);
Serial.print(“LONG=”); Serial.println(gps.location.lng(), 6);
Serial.print(“ALT=”); Serial.println(gps.altitude.feet());
Serial.print(“SPEED=”); Serial.println(gps.speed.mph());
}
With this bit of code, every time you read a single character from the GPS, you print a great big pile of stuff to the serial monitor, so likley missing essential characters from the GPS in the process.
Where did the 'code' come from ?
Have you tried the examples from the library ?
system
Closed
September 4, 2021, 3:17pm
#6
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.