I’m trying to connect a GPS to my arduino UNO, but it doesnt seem to be working even with the demo codes. Here’s what I have so far. Does anyone have an idea of what might be wrong?
Using Outside: Yes
GPS: LS20031 https://www.sparkfun.com/datasheets/GPS/Modules/LS20030~3_datasheet_v1.0.pdf
Code
#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(4,3);
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);
}
NOTE
-I’ve tried 4800 and 9600 for ss.begin()
Output
Simple TinyGPS library v. 13
by Mikal HartCHARS=426 SENTENCES=0 CSUM ERR=0
CHARS=822 SENTENCES=0 CSUM ERR=0
CHARS=1218 SENTENCES=0 CSUM ERR=0
CHARS=1614 SENTENCES=0 CSUM ERR=0
CHARS=2076 SENTENCES=0 CSUM ERR=0
CHARS=2472 SENTENCES=0 CSUM ERR=0
CHARS=2868 SENTENCES=0 CSUM ERR=1
CHARS=3264 SENTENCES=0 CSUM ERR=1
CHARS=3660 SENTENCES=0 CSUM ERR=1
CHARS=4056 SENTENCES=0 CSUM ERR=1
CHARS=4518 SENTENCES=0 CSUM ERR=1
CHARS=4914 SENTENCES=0 CSUM ERR=1
CHARS=5310 SENTENCES=0 CSUM ERR=1
CHARS=5706 SENTENCES=0 CSUM ERR=1
CHARS=6102 SENTENCES=0 CSUM ERR=1
CHARS=6498 SENTENCES=0 CSUM ERR=1
CHARS=6960 SENTENCES=0 CSUM ERR=1
CHARS=7356 SENTENCES=0 CSUM ERR=1
CHARS=7752 SENTENCES=0 CSUM ERR=1
CHARS=8148 SENTENCES=0 CSUM ERR=1
CHARS=8544 SENTENCES=0 CSUM ERR=1
CHARS=9006 SENTENCES=0 CSUM ERR=1
CHARS=9402 SENTENCES=0 CSUM ERR=1
CHARS=9798 SENTENCES=0 CSUM ERR=1
CHARS=10194 SENTENCES=0 CSUM ERR=1
CHARS=10590 SENTENCES=0 CSUM ERR=1
CHARS=10986 SENTENCES=0 CSUM ERR=1
CHARS=11448 SENTENCES=0 CSUM ERR=1
CHARS=11844 SENTENCES=0 CSUM ERR=1
CHARS=12240 SENTENCES=0 CSUM ERR=1
CHARS=12636 SENTENCES=0 CSUM ERR=1
CHARS=13032 SENTENCES=0 CSUM ERR=1
CHARS=13428 SENTENCES=0 CSUM ERR=1
CHARS=13890 SENTENCES=0 CSUM ERR=1
CHARS=14286 SENTENCES=0 CSUM ERR=1
CHARS=14682 SENTENCES=0 CSUM ERR=1
CHARS=15078 SENTENCES=0 CSUM ERR=1
CHARS=15474 SENTENCES=0 CSUM ERR=1
CHARS=15936 SENTENCES=0 CSUM ERR=1
CHARS=16332 SENTENCES=0 CSUM ERR=1
CHARS=16728 SENTENCES=0 CSUM ERR=1
CHARS=17124 SENTENCES=0 CSUM ERR=2
CHARS=17520 SENTENCES=0 CSUM ERR=2
CHARS=17916 SENTENCES=0 CSUM ERR=2
CHARS=18378 SENTENCES=0 CSUM ERR=2
CHARS=18774 SENTENCES=0 CSUM ERR=2
CHARS=19170 SENTENCES=0 CSUM ERR=2
CHARS=19566 SENTENCES=0 CSUM ERR=2
CHARS=19962 SENTENCES=0 CSUM ERR=2
CHARS=20358 SENTENCES=0 CSUM ERR=2
CHARS=20819 SENTENCES=0 CSUM ERR=2
CHARS=21215 SENTENCES=0 CSUM ERR=2
CHARS=21611 SENTENCES=0 CSUM ERR=2
CHARS=22007 SENTENCES=0 CSUM ERR=2
CHARS=22403 SENTENCES=0 CSUM ERR=2
CHARS=22799 SENTENCES=0 CSUM ERR=2
CHARS=23258 SENTENCES=0 CSUM ERR=2
CHARS=23654 SENTENCES=0 CSUM ERR=2
CHARS=24050 SENTENCES=0 CSUM ERR=2
CHARS=24446 SENTENCES=0 CSUM ERR=2
CHARS=24908 SENTENCES=0 CSUM ERR=2
CHARS=25304 SENTENCES=0 CSUM ERR=2
CHARS=25700 SENTENCES=0 CSUM ERR=2
CHARS=26096 SENTENCES=0 CSUM ERR=2
CHARS=26492 SENTENCES=0 CSUM ERR=2
CHARS=26888 SENTENCES=0 CSUM ERR=2
CHARS=27350 SENTENCES=0 CSUM ERR=2
CHARS=27746 SENTENCES=0 CSUM ERR=2
CHARS=28142 SENTENCES=0 CSUM ERR=2
CHARS=28538 SENTENCES=0 CSUM ERR=2
CHARS=28934 SENTENCES=0 CSUM ERR=2
CHARS=29330 SENTENCES=0 CSUM ERR=2
CHARS=29792 SENTENCES=0 CSUM ERR=2
CHARS=30188 SENTENCES=0 CSUM ERR=2
CHARS=30584 SENTENCES=0 CSUM ERR=2
CHARS=30980 SENTENCES=0 CSUM ERR=2
CHARS=31376 SENTENCES=0 CSUM ERR=2
CHARS=31772 SENTENCES=0 CSUM ERR=2
CHARS=32234 SENTENCES=0 CSUM ERR=2
CHARS=32630 SENTENCES=0 CSUM ERR=3
CHARS=33026 SENTENCES=0 CSUM ERR=3
CHARS=33422 SENTENCES=0 CSUM ERR=3
CHARS=33818 SENTENCES=0 CSUM ERR=3
CHARS=34214 SENTENCES=0 CSUM ERR=3
CHARS=34676 SENTENCES=0 CSUM ERR=3
CHARS=35072 SENTENCES=0 CSUM ERR=3
CHARS=35468 SENTENCES=0 CSUM ERR=3
CHARS=35864 SENTENCES=0 CSUM ERR=3
CHARS=36260 SENTENCES=0 CSUM ERR=3
CHARS=36656 SENTENCES=0 CSUM ERR=3
CHARS=37052 SENTENCES=0 CSUM ERR=3
CHARS=37448 SENTENCES=0 CSUM ERR=3
CHARS=37910 SENTENCES=0 CSUM ERR=3
CHARS=38306 SENTENCES=0 CSUM ERR=3
CHARS=38702 SENTENCES=0 CSUM ERR=3
CHARS=39098 SENTENCES=0 CSUM ERR=3
CHARS=39494 SENTENCES=0 CSUM ERR=3
CHARS=39890 SENTENCES=0 CSUM ERR=3
CHARS=40286 SENTENCES=0 CSUM ERR=3
CHARS=40682 SENTENCES=0 CSUM ERR=3
CHARS=41143 SENTENCES=0 CSUM ERR=3
CHARS=41539 SENTENCES=0 CSUM ERR=3
CHARS=41935 SENTENCES=0 CSUM ERR=3
CHARS=42331 SENTENCES=0 CSUM ERR=3
CHARS=42727 SENTENCES=0 CSUM ERR=3
CHARS=43123 SENTENCES=0 CSUM ERR=3
CHARS=43519 SENTENCES=0 CSUM ERR=3
CHARS=43915 SENTENCES=0 CSUM ERR=3
CHARS=44377 SENTENCES=0 CSUM ERR=3
CHARS=44773 SENTENCES=0 CSUM ERR=3
CHARS=45169 SENTENCES=0 CSUM ERR=3
CHARS=45565 SENTENCES=0 CSUM ERR=3
CHARS=45961 SENTENCES=0 CSUM ERR=3
CHARS=46357 SENTENCES=0 CSUM ERR=3
CHARS=46753 SENTENCES=0 CSUM ERR=3
CHARS=47149 SENTENCES=0 CSUM ERR=3
CHARS=47611 SENTENCES=0 CSUM ERR=3
CHARS=48007 SENTENCES=0 CSUM ERR=3
CHARS=48403 SENTENCES=0 CSUM ERR=3
CHARS=48799 SENTENCES=0 CSUM ERR=3
CHARS=49195 SENTENCES=0 CSUM ERR=3
CHARS=49591 SENTENCES=0 CSUM ERR=3
CHARS=49987 SENTENCES=0 CSUM ERR=3
CHARS=50383 SENTENCES=0 CSUM ERR=3
CHARS=50845 SENTENCES=0 CSUM ERR=3
CHARS=51241 SENTENCES=0 CSUM ERR=3
CHARS=51637 SENTENCES=0 CSUM ERR=3
CHARS=52033 SENTENCES=0 CSUM ERR=3
CHARS=52429 SENTENCES=0 CSUM ERR=3
CHARS=52825 SENTENCES=0 CSUM ERR=3
CHARS=53221 SENTENCES=0 CSUM ERR=3
CHARS=53617 SENTENCES=0 CSUM ERR=3
CHARS=54076 SENTENCES=0 CSUM ERR=3
CHARS=54472 SENTENCES=0 CSUM ERR=3
CHARS=54868 SENTENCES=0 CSUM ERR=3
CHARS=55264 SENTENCES=0 CSUM ERR=3
CHARS=55660 SENTENCES=0 CSUM ERR=3
CHARS=56056 SENTENCES=0 CSUM ERR=3
CHARS=56518 SENTENCES=0 CSUM ERR=3
CHARS=56914 SENTENCES=0 CSUM ERR=3
CHARS=57310 SENTENCES=0 CSUM ERR=3
CHARS=57706 SENTENCES=0 CSUM ERR=3
CHARS=58102 SENTENCES=0 CSUM ERR=3
CHARS=58498 SENTENCES=0 CSUM ERR=3
CHARS=58960 SENTENCES=0 CSUM ERR=4
CHARS=59356 SENTENCES=0 CSUM ERR=4
CHARS=59752 SENTENCES=0 CSUM ERR=4
CHARS=60148 SENTENCES=0 CSUM ERR=4
CHARS=60544 SENTENCES=0 CSUM ERR=4
CHARS=61006 SENTENCES=0 CSUM ERR=4
CHARS=61402 SENTENCES=0 CSUM ERR=4
CHARS=61864 SENTENCES=0 CSUM ERR=4