Pages: [1] 2   Go Down
Author Topic: 2 months with the same problem GPS give rubbish with Arduino Uno.  (Read 2951 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello brave sparkies
I should better cut the long story short. So, I interfaced the GPS with the arduino Uno using the serial port (0, 1). my goal is to reveice data from GPS.

I wrote a few codes with the help of www.arduino.cc but I face the same problem at the end.
I do receive data but the problem is they are all rubbish. here is the code I used for the last one, which is not mine... I just copy from http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1280535694

#include <NewSoftSerial.h>
NewSoftSerial nss (0,1);

void setup() {
  Serial.begin(115200);
  nss.begin(57600);
}

void loop() {
  if(nss.available()) {
    Serial.print(nss.read(),BYTE);
  }
}

What I received on the serial monitor is something close to ÆÑÙÝ-àÆÆÆ-ÉÎü,ÿÿÆÆññÆÆÆ
and bunches of different rubbish.

With the same GPS reciever I get this on the hyper terminal on the computer.

$GPGSV,1,1,01,09,00,000,20*43
$GPRMC,184045.000,V,0000.0000,N,00000.0000,E,000.0,000.0,010411,,,N*7F
$GPVTG,000.0,T,,M,000.0,N,000.0,K,N*02
$GPGGA,184046.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,0.0,M,,0000*62
$GPGSA,A,1,,,,,,,,,,,,,0.0,0.0,0.0*30

beside I have a second GPS receiver that behave exactly like the first one on the arduino UNO and on the hyper terminal (for those of you who has Window XP).

I investigated for quite sometime now (at least 2 months) and I think I do not have a clue of what do next anymore.
I tried to change the parity, stop bit and data lenght and different stuff with no avail.

at the end I suspected that the code I wrote was not correct so I used someone else code that worked (the one up there). it gives me exactly the same rubbish like any other algorithm.

from the troubleshooting I have done so far, I know for sure that the problem is from the microcontroller atmega328 (arduino). is it the programming? is it the parity, stop bit, data length?

can anyone provide me a code to set up the parity, stop bit and data lenght. I have done it but I am not certain that it was the right way.

should one point me in the right direction, it will be desperately appreciate.
Logged

Scotland
Offline Offline
God Member
*****
Karma: 11
Posts: 988
Have you had your Arduino fix today?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What port speed are you using on hyper terminal?
Logged

Drew.
http://www.uk-pcb.co.uk - My UK Based PCB Fab & Assembly Company
Design work undertaken
SMD & Thru-Hole assembly

SF Bay Area (USA)
Online Online
Tesla Member
***
Karma: 106
Posts: 6369
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
With the same GPS reciever I get this on the hyper terminal on the computer.
What hardware and configuration are you using to read from the receiver on the computer?
(A "serial port" designed to connect to the 9-pin connector on most PCs and USB/Serial converter modules is NOT suitable for connecting directly to Arduino.  You need an "rs232 level converter" or similar.)
(and I though the "standard" speed for GPS things was 4800bps.)
(either of those issues would cause pretty much exactly the symptoms you are seeing.)
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I investigated for quite sometime now (at least 2 months) and I think I do not have a clue of what do next anymore.
I tried to change the parity, stop bit and data lenght and different stuff with no avail.
Everything except the baud rate....

It looks like it may be another 2 months before he checks back here for an answer.  Maybe he's checking the cross-posts.


Don
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 178
Posts: 8064
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <NewSoftSerial.h>
NewSoftSerial nss (0,1);

That's your mistake.  You can't run NewSoftSerial AND hardware serial on the same two pins!

Pick two OTHER pins for NewSoftSerial.
Logged

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24317
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Multiple cross-posts.
Another one for the blacklist
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

Thank you for your answers...

That's your mistake.  You can't run NewSoftSerial AND hardware serial on the same two pins!

Pick two OTHER pins for NewSoftSerial.

I changed the port but I get exactly the same rubbish
Logged

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

Spycathcer
The GPS receiver I use is defaulted to 9600. and can use the 115200 baud rate and some more. I checked the datasheet. so on the hyper terminal it was set on 9600.
Logged

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

Hello Westfw

I am using the max232 with the GPS S1315R. the GPS work with 9600bps which I used on the hyper terminal. in fact when I connect to the hyper terminal it does not do through the arduino and the result is great. I get the format I want. but through the arduino it is just something else... pretty much nonsense....

since everything work well with the hyper terminal... the conclusion is that there is no problem with the connections.
Logged

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

sorry to disappoint you, the baud rate was ok... during investigation that's the reason I have not mention it
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24317
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
in fact when I connect to the hyper terminal it does not do through the arduino and the result is great
These Google translations aren't great - could you maybe get someone who speaks English to help you?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 178
Posts: 8064
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your symptom looks like a baud rate mismatch.

How does the GPS determine what baud rate to use?

Logged

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24317
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Your symptom looks like a baud rate mismatch
Quote
I am using the max232 with the GPS S1315R

Sounds more like the max232 is still in-circuit to me.

Maybe the OP will enlighten us.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

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

see below the code I normally use to do get the information from the GPS.

The way you guys mention about the baud rate I feel like Serial.begin(9600); is not enough of a initialisation of a baud rate...?

what else should I do then if it is the case?

the code is a bit different that the first one.

void setup()
 {
   lcd.begin(16, 4);           
   pinMode(rxPin, INPUT);
   Serial.begin(9600); 
 }       


 }       

 void loop()
 {
if (Serial.available() > 0)
  {
      // read the incoming data:
  incomingdata = Serial.read();

if (incomingdata)
{
  j = 0;
  dataRead[j] = incomingdata;  //  include each char read to the array

     dataRead[j+1] = '\0';
     Serial.print(dataRead[j]);
     j++;
      }
  }
  else
  {
  Serial.print("Not found \n");
  delay(1000);
  }
 
  }

Logged

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

There is a small mistake of } on the last message I posted... pls disregard.
Logged

Pages: [1] 2   Go Up
Jump to: