I am having problems getting the sainsmart gps to show anything when i try to run the “simple_test” sketch from the TinyGPS library. Even when I uncomment the Serial.write(c); portion, I still don’t see anything other than CHARS=0 SENTENCES=0 CSUM ERR=0. If I connect it to pin 0, 1 and run a blank sketch i can get data from the gps but the moment i try to run a sketch it doesn’t work.
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 3(rx) and 4(tx).
*/
TinyGPS gps;
SoftwareSerial ss(3, 4);
void setup()
{
Serial.begin(115200);
ss.begin(9600);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println("by Mikal Hart");
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
char c = ss.read();
// Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
}
I have been messing with it on and off for a few weeks and I am out of ideas. Any help is very appreciated!
The most probable source of your problem is that you've wired it incorrectly. GND has to be connected to Arduino GND, 3V3 goes the the equally named pin on the Arduino, TX goes to pin 3 while RX goes to pin 4 on the Arduino. Can you make a picture of your wiring and post it?
Hi All. I’m having some trouble with the same setup. Uno R3, Sainsmart GPS & using TinyGPS (v12). Using the example library code Simple_test or Test_with_gps_device I only get back Chars RX & Checksum Fail values. No actual GPS data come through. Of course I’ve tested it outside in different locations. To ensure a reliable GPS signal was a present I tested the areas with my phone to find the best locations but still no GPS data came through.
Pins are: 3.3v to 3.3v, grnd to grnd, RX to Pin 4, TX to Pin 3.
One thing to try is to switch the TX and RX lines. There are two schools of thought as to what transmit and receive mean, depending on whether you are sending data or receiving it. It’s possible that the GPS has a different interpretation as to what send and receive mean than what the Arduino has.
I’d suggest that, in the future, when you are looking to buy something, and the documentation tab is blank, keep looking.
Thanks Paul. I've tried switching the RX & TX but it didn't help. When switch the RX output I was getting stopped and restarted once the wires were put back so I think it's hooked up right.
hello guys im having problem with my gps skylab skm53 because everything is working perfect but when i open the serial mornitor it juist show me ********* instead of values of the lat and long pls can anyone help me