Here is my setup:
I'm trying to read the GPS data from SKG13BL which is connected to an Arduino Uno.
The GPS seems to be working fine as I could see the green status light blinks after a while (I think it takes time to fix the position).
I connected TTL of SKG13BL to UNO Digital pins 2 & 3 and connected the ground as well.
Here is the image of the connection:
I'm using the TinyGPS test with GPS device sketch to read the data. but I always get something like this,
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 30862 0 116
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 30885 0 116
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 30929 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 30952 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 30985 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 31019 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 31041 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 31086 0 117
**** **** ******* ******* **** ******* ******* **** ******* ****** ***** * 0 0.00 * 31109 0 117
I tried swapping the pins, using external power source instead of Arduino's 3.3, but there is no change in the result, any advice would greatly help.
Update 2/26
I changed the pin here to 10 & 11, and using this code
#include <SoftwareSerial.h>
#include <TinyGPS.h>
SoftwareSerial mySerial(10, 11); // RX, TX
TinyGPS gps; // create gps object
long lat,lon; // create variable for latitude and longitude object
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
//gps.encode(mySerial.read());
if(gps.encode(mySerial.read()))
{ // encode gps data
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: ");Serial.print(lat);Serial.print(" ");// print latitude
Serial.print("lon: ");Serial.println(lon); // print longitude
}
}
}
But this only displays the below, lon
and lat
not coming up in the feed even after waiting for an hour.
$GPRMC,043721.000,A,1301.6666,N,07740.9169,E,0.13,343.86,260216,,,D*61 $GPGGA,043722.000,1301.6666,N,07740.9169,E,2,7,1.36,902.9,M,-88.1,M,0000,0000*72 $GPGSA,A,3,10,31,18,11,193,14,22,,,,,,1.62,1.36,0.88*37 $GPGSV,4,1,13,41,73,157,43,31,72,187,37,10,47,048,33,14,41,003,28*71 $GPGSV,4,2,13,18,32,088,16,193,30,107,29,22,27,330,21,21,26,154,*46 $GPGSV,4,3,13,27,18,238,12,25,15,087,16,26,13,180,,08,11,268,*7A $GPGSV,4,4,13,11,09,311,20*43 $GPRMC,043722.000,A,1301.6666,N,07740.9169,E,0.26,343.86,260216,,,D*64 $GPGGA,043723.000,1301.6665,N,07740.9169,E,2,7,1.36,902.9,M,-88.1,M,0000,0000*70 $GPGSA,A,3,10,31,18,11,193,14,22,,,,,,1.62,1.36,0.88*37 $GPGSV,4,1,13,41,73,157,43,31,72,187,37,10,47,048,33,14,41,003,28*71 $GPGSV,4,2,13,18,32,088,16,193,30,107,29,22,27,330,21,21,26,154,*46 $GPGSV,4,3,13,27,18,238,12,25,15,087,16,26,13,180,,08,11,268,*7A $GPGSV,4,4,13,11,09,311,20*43 $GPRMC,043723.000,A,1301.6665,N,07740.9169,E,0.33,343.86,260216,,,D*62 $GPGGA,043724.000,1301.6664,N,07740.9170,E,2,7,1.36,902.9,M,-88.1,M,0000,0000*7E $GPGSA,A,3,10,31,18,11,193,14,22,,,,,,1.62,1.36,0.88*37 $GPGSV,4,1,13,41,73,157,43,31,72,187,37,10,47,048,33,14,41,003,28*71 $GPGSV,4,2,13,18,32,088,16,193,30,107,29,22,27,330,21,21,26,154,*46 $GPGSV,4,3,13,27,18,238,,25,15,087,16,26,13,180,,08,11,268,*79 $GPGSV,4,4,13,11,09,311,20*43
Updated code on 3/1
This one works perfectly and provides the latitude and longitude.
Thank you @slash-dev and @altinturk
#include <SoftwareSerial.h>
#include <TinyGPS.h>
SoftwareSerial mySerial(10, 11); // RX, TX
TinyGPS gps; // create gps object
long lat,lon; // create variable for latitude and longitude object
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
char c = mySerial.read();
Serial.write( c );
if (gps.encode( c ))
{ // encode gps data
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: ");Serial.print(lat);Serial.print(" ");// print latitude
Serial.print("lon: ");Serial.println(lon); // print longitude
}
}
}
Here is the output
$GPGSA,A,3,14,20,21,18,29,15,10,,,,,,2.59,1.13,2.33*0E $GPGSV,4,1,13,29,63,172,35,40,59,241,34,15,45,039,43,18,44,324,51*7A $GPGSV,4,2,13,21,42,350,46,10,27,284,46,24,27,116,19,14,25,209,17*76 $GPGSV,4,3,13,20,24,037,46,193,23,064,39,25,10,180,16,26,08,268,*44 $GPGSV,4,4,13,16,01,294,*42 $GPRMC,003218.000,A,1301.6703,N,07740.9225,E,0.02,0.00,010316,,,D*6D
Position: lat: 1******8 lon: 7*****42