Hello together,
I started an Arduino Uno (R3) based project in which I need to get GPS-Coordinates.
So I decided to buy a Neo-6M (from AZ-Delivery).
It's the first time I'm using GPS in a project so my knowledge is based on datasheets and google.
I already looked into many forum posts and tried several approaches but none of them can solve my problem.
I've connected the GPS Module to the Arduino
VCC -> 5V
GND -> GND
Tx -> Pin6
I'm using TinyGPS+ (already tried TinyGPS with no change) and SoftwareSerial.
The Arduino Uno is connected to the PC via USB 2.
When I connect the Tx of the Module to the Tx (Pin 1) of the Arduino and Connect Reset to GND, I get Data, which looks (in my opinion) nearly correct.
By viewing this Data it looks like the Module can't get satelite lock:
$GPRMC,,V,,,,,,,,,,N*53
$GPVTG,,,,,,,,,N*30
$GPGGA,,,,,,0,00,99.99,,,,,,*48
$GPGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*30
$GPGSV,1,1,01,17,,,21*7D
$GPGLL,,,,,,V,N*64
When I run the sketch on the Arduino I got this Output:
Start
Data: 36
Data: 80
Data: 77
Data: 44
Data: 86
Data: 44
Data: 44
Data: 44
Data: 44
Data: 44
Data: 42
Data: 51
Data: 10
Data: 71
Data: 86
Data: 71
Data: 44
Data: 44
Data: 44
Data: 44
Data: 78
Data: 51
Data: 13
Data: 36
Data: 80
Data: 71
Data: 44
Data: 44
Data: 44
Data: 48
Data: 48
Data: 44
End
It looks like TiniGPS+ cant't encode the Data it get's from the Module.
I've written the GPS part of my program based on many Codesnippets I've found while googling.
Here's my smallest piece of Code to reproduce the Error:
#define Debug
#ifdef Debug
#define DebugInit(speed) Serial.begin(speed);
#define DebugPrintLn(txt) Serial.println(txt);
#define DebugPrint(txt) Serial.print(F(txt));
#define DebugPrintValueDecimal(val) Serial.print(val, DEC);
#define DebugValuePrintLn(txt, val) Serial.print(F(txt)); Serial.print(F(": ")); Serial.println(val);
#else
#define DebugInit(speed)
#define DebugPrinLn(txt)
#define DebugValuePrintLn(txt, val)
#endif
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
uint32_t gpsBaud = 9600;
SoftwareSerial swsrl(6, 255);
TinyGPSPlus gps;
void setup()
{
Serial.begin(9600);
swsrl.begin(gpsBaud);
}
void loop()
{
GpsReceiver();
}
void GpsReceiver()
{
DebugPrintLn("Start");
while(swsrl.available() > 0)
{
Serial.print("Data: ");
Serial.println(swsrl.read());
if(gps.encode(swsrl.read()))
{
Serial.println("True");
float lat, lon;
lat = gps.location.lat();
lon = gps.location.lng();
Serial.print(lat);
Serial.print(" ");
Serial.println(lon);
}
}
DebugPrintLn("End");
delay(3000);
}
And I know that the macro isn't necessary here but for my entire code it is.
I've made sure that the Serial Monitor of the IDE runs on 9600 Baud.
Is it possible that this error occurs because of the missing GPS lock?
Or is there something wrong in my code?
I'm not sure why the Module doesn't lock.
I've bought it a few days ago.
The LED of the Module isn't flashing either so I think it also has a problem.
Just to say before someone asks:
Yes it had direct view to the sky for the last 6 hours. (I was sitting in the garden.)
Edit:
My Error is now solved.
I've bought a new Neo-6M GPS Modul.
At first I got the same wrong Data that can't be encoded by TinyGPS.
But as soon as the Module got response from GPS, the encoding worked and the Data looks alright.
So thanks for your advices and help.
