Go Down

Topic: GPS on arduino Uno (Read 693 times) previous topic - next topic

giuseppegk

Hi guys

I´m using an Arduino Uno with this gps shield(ftp://imall.iteadstudio.com/IM120417017_Arduino_GPS_shield/DS_IM120417017_ArduinoGPSshield.pdf) and using the code of the simple test, with this configuration exactly:

#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, 2);

void setup()
{
  Serial.begin(115200);
  ss.begin(4800);
 
  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);
}


with the jumpers going to the "hole" 3(abov the rx pins) and and rxd 3 and from the pin 2(between rx and tx) to the txd 2.

But I´m only getting this print:

Quote
Simple TinyGPS library v. 12
by Mikal Hart

CHARS=47 SENTENCES=0 CSUM ERR=0
CHARS=81 SENTENCES=0 CSUM ERR=0
CHARS=115 SENTENCES=0 CSUM ERR=0
CHARS=150 SENTENCES=0 CSUM ERR=0
CHARS=185 SENTENCES=0 CSUM ERR=0
CHARS=220 SENTENCES=0 CSUM ERR=0
CHARS=255 SENTENCES=0 CSUM ERR=0
CHARS=290 SENTENCES=0 CSUM ERR=0
CHARS=325 SENTENCES=0 CSUM ERR=0
CHARS=360 SENTENCES=0 CSUM ERR=0
CHARS=395 SENTENCES=0 CSUM ERR=0
CHARS=430 SENTENCES=0 CSUM ERR=0
CHARS=465 SENTENCES=0 CSUM ERR=0
CHARS=500 SENTENCES=0 CSUM ERR=0
CHARS=535 SENTENCES=0 CSUM ERR=0
CHARS=570 SENTENCES=0 CSUM ERR=0
CHARS=605 SENTENCES=0 CSUM ERR=0
CHARS=640 SENTENCES=0 CSUM ERR=0
CHARS=675 SENTENCES=0 CSUM ERR=0
CHARS=710 SENTENCES=0 CSUM ERR=0
CHARS=745 SENTENCES=0 CSUM ERR=0
CHARS=780 SENTENCES=0 CSUM ERR=0
CHARS=815 SENTENCES=0 CSUM ERR=0
CHARS=850 SENTENCES=0 CSUM ERR=0
CHARS=885 SENTENCES=0 CSUM ERR=0
CHARS=920 SENTENCES=0 CSUM ERR=0
CHARS=955 SENTENCES=0 CSUM ERR=0
CHARS=990 SENTENCES=0 CSUM ERR=0
CHARS=1025 SENTENCES=0 CSUM ERR=0


at 115200 baud rate.

Anyone has any idea what is wrong with my test???

alnath

a working link would help  ;)

Quote
The webpage at http://ftp//imall.iteadstudio.com/IM120417017_Arduino_GPS_shield/DS_IM120417017_ArduinoGPSshield.pdf might be temporarily down or it may have moved permanently to a new web address.
Error code: ERR_NAME_RESOLUTION_FAILED

Cyric

in the datasheet on Itead it shows the BPS rate for that shield being 38400. your code is at 4800.also the hardware is on the 0 1 pins so setting softserial to others wont help
unless you some how modified the shield or changed some jumpers etc. can you describe how you have it hooked up?
ftp://imall.iteadstudio.com/IM120417017_Arduino_GPS_shield/DS_IM120417017_ArduinoGPSshield.pdf is the shield in question yes?

giuseppegk

#3
Sep 18, 2013, 05:23 am Last Edit: Sep 18, 2013, 06:04 am by giuseppegk Reason: 1
Sorry for the broken link, the gps is this one:

https://sites.google.com/site/arduinosolucionatica/home/itead-studio-gps-shield

I´m using the jumpers as this images(the black rectangles)...


Cyric

still seems to me like 38400 is default baud rate. but i could be wrong

Go Up