0

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:

Photo of GPS Receiver SKG13BL and Arduino

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

Greenonline
3,1527 gold badges36 silver badges48 bronze badges
asked Feb 25, 2016 at 20:56

2 Answers 2

1

Seems you are able to receive data properly (according to your the update.) I was using TinyGPS++, an advanced version of TinyGps (http://arduiniana.org/libraries/tinygpsplus/), maybe those can help you: Try

Serial.print("LAT="); Serial.println(gps.location.lat(), 6);
Serial.print("LONG="); Serial.println(gps.location.lng(), 6);

GPS cannot get any data indoors. Put your gps close to a window or better -directly outside. First of everything you will get a date&time data on the output, then number of satellites, then the Lat/lon data. But GPS has to receive data indoors. On some chips there is a LED starts blinking once it gets a fix from any satellite. Keep an eye on it.

I realized this small issue when my phone (used for "calibration") couldn't get a fix by its embedded GPS without any cell/network assistance. You should try if you get any signals where you put your device.

answered Feb 26, 2016 at 0:30
3
  • Hi Thank you for your response, Yeah I could see the Status LED starts blinking in green and the I kept the antenna outside of the window looking up to the sky. I believe I'm doing something wrong in the way I read the data.. or connecting the wires. Commented Feb 26, 2016 at 3:57
  • Check the answer :) I added some piece of code. I used tinyGPS++ but I guess these two are quite relevant. Commented Feb 27, 2016 at 13:46
  • Sorry about the late reply, Thanks a lot for your response, i will try with the tinygps++, Commented Mar 1, 2016 at 0:26
3

You are consuming the received characters with the debug print:

Serial.write(mySerial.read());
//gps.encode(mySerial.read());
if(gps.encode(mySerial.read()))

Instead, do this:

char c = mySerial.read();
Serial.write( c );
if (gps.encode( c ))

Also, SoftwareSerial is a real CPU-killer. Try NeoSWSerial instead. It's much more efficient and reliable. Sometimes other interrupts, like Serial.print, can cause SoftwareSerial to be unreliable. Echoing the received characters may be enough to cause characters to be lost. NeoSWSerial is not nearly as susceptible.

And while you're at it, take a look at another library I wrote, NeoGPS. It's the fastest and smallest library out there, especially when you configure it to only parse the fields and messages that you use. For example, if you only need lat/lon, disable all the other fields (time, alt, speed, sats, etc.) and all the other messages (just RMC, no GGA, no GSA, no GSV). Saves lots of RAM and CPU time!

answered Feb 26, 2016 at 15:58
2
  • Thank you , you nailed it down, i was loosing the information in the debug print, after correcting that able to get the lat and lan, posted the updated code. i will try with the NeoSWSerial as well, Commented Mar 1, 2016 at 0:28
  • 1
    @RamS: LOL, that green check is supposed to be for the answer that worked for you, so I'm not sure why you checked altinturk's answer. The up and down arrows can be used by anyone like a vote. The check is reserved for the Original Poster. Cheers! Commented Mar 1, 2016 at 3:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.