i'm new to arduino stuff. I've recently bought this GPS shield and I cannot make it work. First of all the guy that sold me also gave me a PDF manual with specifications saying it works with 38400 baud rate.
I'm using Arduino UNO R2 board and GPS is set to communicate with RX = 4 and TX = 3.
Here is my code (which is a modified example):
#define RXPIN 3
#define TXPIN 4
SoftwareSerial ss = SoftwareSerial(RXPIN, TXPIN); // Aqui Ã© feito o instanciamento, ou seja, atribuimos a comunicaÃ§Ã£o serial denominada de ss (poderia ser gps, minhaporta ou qualquer outra palavra) para as portas 3 e 4.
Serial.begin(115200); // Aqui Ã© a velocidade de transmissÃ£o entre o Arduino e o PC Ã© de 115200 bps.
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version()); //sÃ³ perfumaria...e os devidos //crÃ©ditos do autor
Serial.println("by Mikal Hart");
void loop() //loop principal. Os comentÃ¡rios do autor ajudam a entender.
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;)
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;
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
gps.stats(&chars, &sentences, &failed);
Serial.print(" CSUM ERR=");
As you can see, i used 9600 baud rate from GPS to Arduino and 115200 from Arduino to PC. Altough the PDF said 38400, this (9600) was the only configuration that it seems to work. With 4800 and 38400 baud rates i get strange characters in screen. With this sample code the result is as follow:
Simple TinyGPS library v. 12
by Mikal Hart
$GPGSV,3,1,12,20,00,000,,10,00,000,,31,00,000,,2 CHARS=153 SENTENCES=0 CSUM ERR=0
$GPVTG,,T,,M,,N,,K* CHARS=516 SENTENCES=0 CSUM ERR=0
$GPVTG,,T,,M,,N,,K*4E CHARS=685 SENTENCES=0 CSUM ERR=0
No matter how much time it runs, it never gives me a good result.
The GPS shield came with the square antenna and it is correctly connected to it. Could this be a serial communication problem (once i heard that with arduino UNO the GPS shield only worked in pins 0 and 1 (used to exchange messages with PC))?
As it is receiving correct characters I imagine that is not an communication issue. Does anyone have any suggestion?