Go Down

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

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?

#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

Thanks Cyric, it really helped

I changed the code for the 38400 baud rate, but I only get something when I put the baud rate in the serial monitor in 28800 baud rate...
When I put it in 38400 I get some random characters....
These are images of what I got and of how my jumpers are connected


Ayone can see what´s wrong that I don´t get what I should on serial monitor?

PaulS

Quote
I changed the code for the 38400 baud rate, but I only get something when I put the baud rate in the serial monitor in 28800 baud rate...

The baud rate you use to talk to the serial monitor has nothing to do with the baud rate you use to talk to the GPS.

You made some code changes; you need to post the new code.

Thanks PaulS, I didn´t knew that....I´m such a newbie in arduino programming

This is the code I´m using:

Code: [Select]
#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(38400);
 
  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);
}

PaulS

Code: [Select]
SoftwareSerial ss(3, 2);
Do you have an ss attached to these pins? Or, do you have a GPS attached? If it really is a GPS, why doesn't the instance name reflect that?

Quote
This is the code I´m using:

Then, setting the Serial Monitor to 28800 makes no sense. Please explain what this code is doing, when the serial monitor is set at 115200.

I attach the GPS shield to the arduino and I make jumpers like the image I posted above

When I set to the 115200 rate , I get nothing

PaulS

Quote
I attach the GPS shield to the arduino and I make jumpers like the image I posted above

Then, take it off and run the sketch. If you still get nothing when the Arduino is sending at 115200 and the Serial Monitor is receiving at 115200, then either your Arduino or your PC are broken.

Go Up