Pages: [1]   Go Down
Author Topic: GPS on arduino Uno  (Read 659 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys

I´m using an Arduino Uno with this gps shield(http://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???
Logged

Offline Offline
God Member
*****
Karma: 16
Posts: 601
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

a working link would help  smiley-wink

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
Logged

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

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?
http://ftp://imall.iteadstudio.com/IM120417017_Arduino_GPS_shield/DS_IM120417017_ArduinoGPSshield.pdf is the shield in question yes?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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)...



* Jumpers.png (81.54 KB, 819x464 - viewed 37 times.)
« Last Edit: September 17, 2013, 11:04:08 pm by giuseppegk » Logged

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

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

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?


* Log 18-09-2013.png (54.73 KB, 1366x768 - viewed 30 times.)

* IMG_1932[1].JPG (273.7 KB, 960x720 - viewed 34 times.)
Logged

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

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

This is the code I´m using:

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(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);
}
Logged

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

Code:
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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.
Logged

Pages: [1]   Go Up
Jump to: