Pages: [1]   Go Down
Author Topic: GPS Not Working  (Read 515 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
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
Quote
Simple TinyGPS library v. 13
by Mikal Hart

 CHARS=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
« Last Edit: September 17, 2013, 12:09:10 am by tecno40 » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8842
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looks like you are receiving a lot of CHARS but none that look like SENTENCES.  My guess would be a baud rate mismatch.  Try using the Arduino as a USB-to-Serial adapter (jumper Reset to Ground and hook the GPS to pins 0 and 1) to see what baud rate on Serial Monitor gets you clear messages.  Then you can adjust the baud rate in your sketch to match the GPS.

Sentences start with "$" (usually "$GP" if they come from a GPS) and end with a Carriage Return and New Line.  The contents are mostly numbers separated by commas.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Full Member
***
Karma: 1
Posts: 131
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i had the same prob come to find out mine was running at 57600bps. (LS20031) have you used the sketches to run the the mini gps config software at SFE's website? SFE also shows 57600 in there example sketch.
https://www.sparkfun.com/tutorials/176
NOTE: make sure to make a logic level shifter or use an IC for it if you plan on config the GPS as the GPS is 3.3v logic you will take the chance of frying it.Arduino seens 3.3v as logic HIGH so it can REC the data just fine at 3.3v.
got to Ebay and put in 5v 3.3v logic convert for some verry cost effective units.
i use TXB0108's i got from TI. http://www.ti.com/product/txb0108

« Last Edit: September 17, 2013, 09:45:13 am by Cyric » Logged

Chicago
Offline Offline
Sr. Member
****
Karma: 5
Posts: 456
With every answer comes more questions.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree w/ Cyric. It's likely your logic voltage level.

Per the data sheet -
Quote
High Level Input Voltage
LS20031
Min  = 2.0V
Max = 3.6V


Low Level Input Voltage
LS20031
Min = -0.3V
Max = 0.8V


High Level Output Voltage
LS20031
2.4V

Low Level Output Voltage
LS20031
0.4V

Arduino UNO uses 5V. Need to use some kind of level converter.
I've used this one with success -
http://www.adafruit.com/products/735
And, instead of some random eBay seller, it helps support one of the largest open-source hardware/software proponents whom offer excellent quality & support. (Bonus!)
...and it's still just $1.50  smiley
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Adafruit and Sparkfun is a Ripoff and that's why people buy from random eBay seller.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Adafruit and Sparkfun is a Ripoff and that's why people buy from random eBay seller.
And, they get what they pay for, and nothing else. And, frankly, don't deserve support here. Buy from places that support the Arduino team, at least indirectly, if you want help here. Just my personal opinion.
Logged

Pages: [1]   Go Up
Jump to: