HELP: gps not talking?

Hi all, I am putting myself down as a newbie for now.

I have been playing around with my Arduinos for about a month now.

I have managed to get a couple of projects type tested and sort of working.

The local Amateur Radio club that I am a member has asked me if I could make a GPS locked clock for the next field day, I said yes its in March the 19th - 20th.

I have some lovely large 7 segment displays size of them is 180mm x 230mm, could read the clock from 100 paces, lol.

Now on to my problem, its going to be a simple error on my part but I have been trying to get a stupid GPS to talk to an Arduino now for 5 days, and are starting to lose it…

Now I have tested the GPS unit, its a ublox unit that outputs data at 9600 bps and needs to be inverted and buffered to correct rs232 levels for a PC to read it, this is no problem works fine.

Talking about rs232 data into the cpu, correct me if wrong the voltage swing for the TTL GPS data should it be 0v - 5v signal or 5v to 0v I have tried it all and the input pin should be the pin 3 on the area marked PWM, right?

The Arduinos are the mega ones 1x 1280 , 1x 2560, I have a really big project latter on thats going to need some space

With the IDE there is a couple of demos, TimeGPS, now with a little code change from 4800 to 9600 it should read the GPS and output the data via the serial port display to right in front of me, NOTHING, zip, narder.

I have check everything at least ten times now and I am ready to say sorry no I am not doing it, plus the talk on these micros no, I normally give very good talks on what ever I am explaining at levels the people can understand.

I was hoping some one might be able to point out what I have done wrong.

If is really the start to many projects that require a gps not only for UTC time but location and height.

I am looking forward to any help, I am to young to have Grey hairs…

Cheers

Paul

Paul,

First: Inhale deeply :slight_smile:

Second: You’re probably not too young for gray hair. I believe I’ve had some gray hair longer than I’ve had a university degree, and I was the youngest in my class.

Third: Exhale slowly.

Now, on to what you asked:

  1. For us to provide you with specific help (and there’s an excellent chance one or more of us will try), it’s useful for you to provide specific information. For example, a link to the datasheet for the GPS unit might well lead to an answer. There are lots of different communications protocols that can be converted to RS232, but I’m not going to guess which one your GPS is using. On a related note, what did you use to do the conversion to RS232?

  2. If all else fails, use an oscilloscope (or a signal analyzer, if that’s handier) to watch the output of the GPS. That should tell you, at least, what the voltage and clock speed are.

  3. There’s no way to tell if you’re using the correct input pin on the Arduino without seeing your code. There are lots of pins suitable for reading digital inputs, but different ones are set up (both in software and hardware) for different purposes. If a pin was specified in a sample sketch, what communications protocol does the GPS for which that sketch was written use?

Happy Hunting,

Eric

If the GPS is outputting TTL serial, and you are connecting it to the Arduino, you don’t need an inversion. If both run on the same voltage (either 3.3V or 5V), just connect the serial out from the GPS to the serial in to the Arduino.

If you are trying to connect the TTL serial from the GPS to a PC or other true RS232 level device, just use a MAX232 or MAX3232 level shifter to do the conversion.

The inversion confusion comes from the fact that a 0 is 0V in TTL and +3 to +15V in RS232. A 1 is close to VCC (3.3 or 5V) in TTL, and -3 to -15V in RS232. The MAX232 or similiar takes care of all of the translations.

I would start by cutting the problem in half. Get a level shifter, and connect the GPS to your PC. This will let you see if it is working and configured correctly. You can then take the level shifter and connect it instead between the PC and Arduino to debug that side of the code.

/mike

HI there all,

thanks for the replies,

the GPS is a ublox ANTARIS 4 GPS module model number of the unit I have is TIM-4H the standard speed on the nmea port is 9600 with heaps of strings IE:GGA, RMC,GSA,GSV,GLL,VTG,ZDA. if I put it on 4800 I only get 2 strings GGA, RMC I know a lot of data and heaps will not be used.

Datasheet for GPS http://www.alphamicro.net/resources/u-b … 107%29.pdf

This unit takes 60 seconds from cold to full lock.

As I said earlier it is running at 9600 bps, I know the data is correct as I am capturing it on the PC, on the output of the gps I am getting just under 3 volts on the data signal, I have it running through a max232 for the pc, in fact just using it as an inverter TTL buffer.

So I know the levels and speed is correct looking at the demo code supplied with the tinygps library standard it uses pin 3 for the data from the GPS correct?

As I also said I an learning this micro and I have heap of project to build, two of which (not including this one) require GPS data

Just to prove to myself, I have tried the signal straight from the gps and the inverted, zero data is being shown on the serial terminal. only thing is the Waiting for GPS time …, so at least I know the serial monitor works.

I have also tried a couple of other GPS units, a trimble ace3 unit , a generic gps, used it in my APRS tracker works perfect true rs 232 voltage output and the old handheld Magellan unit, All powered antennas mounted outside

Sorry to bore people but that is the setup at the moment, various test gear, HP CRo 54602b 4 Channel, and the normal test gear meters and so on.

Many Thanks for the people that are helping, means a lot.

NOW the demo code

paste

/*

  • TimeGPS.pde

  • example code illustrating time synced from a GPS

*/

#include <Time.h>

#include <TinyGPS.h> //http://arduiniana.org/libraries/TinyGPS/

#include <NewSoftSerial.h> //http://arduiniana.org/libraries/newsoftserial/

// GPS and NewSoftSerial libraries are the work of Mikal Hart

TinyGPS gps;

NewSoftSerial serial_gps = NewSoftSerial(3, 2); // receive on pin 3

const int offset = 1; // offset hours from gps time (UTC)

time_t prevDisplay = 0; // when the digital clock was displayed

void setup()

{

Serial.begin(9600);

serial_gps.begin(9600);

Serial.println("Waiting for GPS time … ");

setSyncProvider(gpsTimeSync);

}

void loop()

{

while (serial_gps.available())

{

gps.encode(serial_gps.read()); // process gps messages

}

if(timeStatus()!= timeNotSet)

{

if( now() != prevDisplay) //update the display only if the time has changed

{

prevDisplay = now();

digitalClockDisplay();

}

}

}

void digitalClockDisplay(){

// digital clock display of the time

Serial.print(hour());

printDigits(minute());

printDigits(second());

Serial.print(" ");

Serial.print(day());

Serial.print(" ");

Serial.print(month());

Serial.print(" ");

Serial.print(year());

Serial.println();

}

void printDigits(int digits){

// utility function for digital clock display: prints preceding colon and leading 0

Serial.print(“:”);

if(digits < 10)

Serial.print(‘0’);

Serial.print(digits);

}

time_t gpsTimeSync(){

// returns time if avail from gps, else returns 0

unsigned long fix_age = 0 ;

gps.get_datetime(NULL,NULL, &fix_age);

unsigned long time_since_last_fix;

if(fix_age < 1000)

return gpsTimeToArduinoTime(); // return time only if updated recently by gps

return 0;

}

time_t gpsTimeToArduinoTime(){

// returns time_t from gps date and time with the given offset hours

tmElements_t tm;

int year;

gps.crack_datetime(&year, &tm.Month, &tm.Day, &tm.Hour, &tm.Minute, &tm.Second, NULL, NULL);

tm.Year = year - 1970;

time_t time = makeTime™;

return time + (offset * SECS_PER_HOUR);

}

Stupid question #1: Are you using this outdoors with a view of the satelites? “All” GPS units will not work deep inside a building. Some may work at a window. Some will work under a tree. “All” will work in a wide open area with a clear view of the sky.

At the frequency of the GPS, anything with water in it will kill the signal. I have a GPS repeater at work (yes it is legal; registered with the FAA, FCC, and Coast Guard) that did not work when it rained. The outside randome would get a thin film of water on it and poof, no more signal.

Some window glasses (especialy tinted car glass) will also kill the signal.

Failed to see the sentence that you had an external antenna. Ignore stupid question #1. Although you would not believe how often it turns out the individual thinks they can get a GPS signal in the basement of a steel basement!

yes the antenna is outdoors is a clear area, with a level converter on the gps so it can talk to the PC at 9600 bps I get data, standard GPS nema not SiRF.

Now I have tried all the GPS modules I have and they all work on the pc, BUT not on the stupid arduinos.

I have informed the club members that I am having major problems with building a simple clock, they are all amazed that the simple things in life are just not working, I have given demos/talks on GPS technology, APRS uses in the amateur radio world and many others, even built a heap of projects for them.

So you might say I have been involved in electronics for a good part of 30 plus years.

So currently I have put all the bits outlay and built for the project in a big box the display is big.

Now remember that the gps was / is important to this project and is even more important to the next two projects, of which if I can not get a simple gps signal to pass through the arduino to its serial port, I give up, may be its time to hang up the soldering iron, pack up the test gear, put the computer back in its box, and do what 90% of the world does and veg out in front of the TV becoming brain dead.

If some one wants to see if they can help a fellow electronics nut out please do so, as I am so close to the edge it is not a laughing matter anymore.

Cheers

Paul

Stupid question #2

Do you have a common ground?

Stupid question #3

Do you have the Rx and Tx signals set right? There is not a standard way on how that stuff gets labeled. Is it Rx from the point of view of the device it is printed on or the other device.

Stupid question #4

Since you have all these level converters, can you get the Arduino to send data to the PC?

Stupid question #5

An Arduino Duemilanove has a native serial port on pins 0 and 1. My experience is if you use these, they conflict with the USB uart and something must be disconnected. If my memory serves me, I had to disconnect my level shifter on pins 0/1 if I want to reprogram.

If you are using the software uart, then check what pins it is configured for.

All is using a common ground, I would not be that stupid to forget basic electronics and electrical practices .

Because that output from the GPS is inverted as it normally would talk to a real computer via a max232 line level inverter, now the GPS’ (more than one) all work to the PC that is, now I know the max232 output on 232 is ±10 volts I know that this is the reason why I have an 74HC04 schimitt-trigger inverters one of these is from the output of the gps via the 7404 to the stupid arduino the max 232 is to the pc to allow me to see if all is well.

Now because I am now all worked up over nothing I have used other peoples demo programs to make sure the cpu still works, I am getting text data via the usb serial port monitor so I would say that is working, just that nothing parses the gps info, as I keep stating very important to me.

I understand that the arduinos on the data/pwm pin 0,1 is the usb uart I full understand that, when using over peoples code the first thing I look for is the speed they are talking / receiving data from the GPS unit (i need 9600) so that gets changed and the next to do is the port (pins used changed if need) make sure they are not being used, now from what I have seen using the CRO when the serial ports are enabled the TX port gets held high via a resistor in the chip , I believe, and the receive is some where near OV in voltage.

Now I have four GPS antennas to choose from.

one is on a table is the back yard in the clear, and two different types are on the sheds roof, of which directly under that is my radio shack / electronics butchery place, well thats what it is like at the moment

I gave up on the ardunios on the weekend and just threw them against the wall in the pile of all the stuff I have bought for the clock project.

Surely someone out there has made a GPS locked clocked that uses 4 7 segment displays that are multiplexed.

to me it sounds like basic clock 101.

cheers

Paul

Here’s an example of using a GPS to run a clock using arduino http://www.arduino.cc/cgi-bin/yabb2/YaB … 1246883781.

I’d start with a serial “pass through”-type sketch on the arduino. This is what the above link does - it has the GPS connected to a software-based serial port, and outputs the time on the hardware serial port. If you load that sketch, then hook it up like:

GPS --------> arduino (pins 8/9, anything but 0/1) ------> PC

Can you see the time output to the PC?

The datasheet for your GPS isn’t the clearest in regards to the serial port output protocol - it doesn’t seem to be true RS232 or TTL, or maybe I’m not reading it properly. Is that why you are using the inverter?

You could get a GPS module that is known to work well with the arduino, like the EM-406.

I have been thinking of this all day and night , I need to at least see some thing working before the people in the white suits go to take me away.

NOW doe the tinygps libary read and understand nema 0183 which is my understanding the true GPS standard OR does it use SiRF.

All my GPS units output nema 0183, I have one if I reprogram it will output Sirf, but I really dont want to cut the cable this is the one I use in the car when I am mapping / GISing.

I dont feel like getting everybody upset as I all ready am, tried, frustrated, upset and now not sleeping as my brain is just not switching off at night its thinking about the project.

Even to the point that my biggest hobby has taken a dive because for the ardunio gear is in front of me remiding me every time I come out here.

I look forward to the answers people have, I am just hoping that its not based on Sirf.

cheers Paul

Ok I have shoved the code into the IDe and complied it shoved it into the 1280 ardunio, gps wired up to the power pins and the output data from the gps is directly put to pin 9 on the PWM input.

GPS is outputing data happily the lock / second sync led if flashing, but still no one work of data out of the serial port.

I just do not understand it why not work?

Does this mean I have to buy one of those gps units from one of the online arduino sellers, I will be very upset if thats the case, brade new gps units and powered antennas going to waste.

Thats it I call it a night and going to stop banging my head against this wall and bench

cheers Paul

Once again, you do not need an inverter. Just connect the GPS directly to the Arduino. The GPS’s TXD1 connects to pin used for the soft UART’s receiver.

/mike

My question is,

the tinygps library or even the nema one

Does it need to be in SiRF fromat or NEMA 0183 Format.

This is what I think is the problem, the library info does not talk about standards of what it expects to hear they just say gps, well there is a couple of apples that work like that.

Simple is it looking for Sirf or good old nema 0183…

Many Thanks people, I am way to tried and frustrated tonight in fact I am playing around with the moon tonight doing some EME

cheers

PAul

NMEA.

Very few of the modules that typical hobbiests will be using with the arduino+tinyGPS libraries will use the Sirf protocol.

well if its nema 0183 thats it is looking for I am going to just give up right now, well all the ardurino gear and all my electronics, as I can not get these gps units talking.

I bet a kid still in high school can, but some one that has a heavy electronics and electrical back ground can not.

Bets me why, what do I have to buy every thing for these cpus from a dealer?

cheers

Paul

Paul-

Just to see where we are:

  • You connected your GPS through a MAX232 to your PC, and it worked.

  • You connected your Arduino to the PC, and can see serial output (ie, the "Waiting for GPS time … " message in your sample code

  • You connected your GPS directly to the Arduino, to the pins listed in the constructor “NewSoftSerial serial_gps = NewSoftSerial(3, 2); // receive on pin 3”, and ran the sample code, but did not see the time output.

Have you written code that simply takes whatever is received by serial_gps and output that on Serial, with the GPS connected to the Arduino, and the Arduino connected to the PC? If so, did you get anything? You should be seeing NMEA data. This will tell you if the data is making it to the Arduino; if it is, the problem is in the parsing or display of the data. If it isn’t, take your level shifter and connect it’s input to the GPS output, while the output is connected to the Arduino, so you can use it to “spy” on the signal.

Another test to do is to connect your MAX232 level shifter to the arduino instead of the GPS (make sure it’s output is connected to the pin that serial_gps is expecting its input on), run the passthrough program that just copies from serial_gps to Serial, and see if you can get that path working.

The whole trick is to break the problem down into smaller chunks, test each one, and figure out where the problem is. In this case, get serial output from the Arduino to the PC working so you have some way (other than by blinking LEDs) to debug. Then get the soft serial input working, get soft serial from the GPS working, and finally add the code to parse the NMEA strings.

/mike

Be warned if you are using the ‘NEW’ Arduino 1.0 that the TinyGPS and SoftwareSerial will throw a fit with the LS20031 GPS.

I did the direct GPS dump to the monitor (using pin 0) like it says to do in the LS20031 GPS Assembly Guide {http://www.sparkfun.com/tutorials/176}, and you get good clean GPS output (you can see this in my last example).

But using the following code >>

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

void setup()

{

Serial.begin(115200);// old 57600 New 115200

Serial.println(“Goodnight moon!”);

// set the data rate for the SoftwareSerial port

mySerial.begin(57600); // old 4800 new 57600

mySerial.println(“Hello, world?”);

}

void loop() // run over and over

{

if (mySerial.available()){

Serial.write(mySerial.read());

}

}

I get the extended characters mixed in with the GPS sentence when using SoftwareSerial >>

PG ‚6 A$GPGGA,182924.000,4751.6603,N,12142.3928,W,1,9,0.97,64.7,M,-16.9,M,*5B

$GPGLL,4751.6603,N,12142.3928,W,182924.000,A,A*4F

$GPG ‚6 A±$GPGGA,182924.200,4751.6603,N,12142.3928,W,1,9,0.97,64.7,M,-16.9,M,*59

$GPGLL,4751.6603,N,12142.3928,W,182924.200,A,A*4D

$GPG b¢r$GPGGA,182924.400,4751.6603,N,12142.3928,W,1,9,0.97,64.7,M,-16.9,M,*5F

$GPGLL,4751.6603,N,12142.3928,W,182924.400,A,A*4B

$GPG42“r±$GPGGA,182924.600,4751.6603,N,12142.3928,W,1,9,0.97,64.7,M,-16.9,M,*5D

$GPGLL,4751.6603,N,12142.3928,W,182924.600,A,A*49

$GPG 5ºAr$GPGGA,182924.800,4751.6603,N,12142.3928,W,1,9,0.97,64.7,M,-16.9,M,*53

$GPGLL,4751.6603,N,1214™—¦’&'éŊ’ʒ¢r†‚‚b

That is even before TinyGPS get’s a hold of the GPS sentences.

I have tried changing the baud rate both in the Arduino code, and for the serial monitor and still I get these “, &Rb¢*” characters in the stream.

I know the baud rate is not the problem because if you get it wrong you get nonsense. You don’t even get what you see up above.

Here is what it’s supposed to look like using the following code –

void setup() {

Serial.begin(57600);

}

void loop() {

if (Serial.available()) {

#if ARDUINO >= 100 //For Arduino v1.0+

Serial.write(Serial.read());

#else //For Arduino v0023 or earlier

Serial.print(Serial.read(), BYTE);

#endif

}

}

---- >>

$GPGSA,A,3,03,18,06,19,22,27,3.38,2.24,2.53*0B

$GPGSV,3,1,12,18,69,061,37,22,63,252,45,06,52,253,42,21,51,114,21*7F

$GPGSV,3,2,12,03,46,270,46,48,33,195,29,15,30,051,21,19,29,311,35*71

$GPGSV,3,3,12,14,19,186,16,27,16,069,22,09,13,095,16,05,246,16*70

$GPRMC,183446.800,A,4751.6605,N,12142.3934,W,0.01,241.74,140212,A*72

$GPVTG,241.74,T,M,0.01,N,0.03,K,A*3B

$GPGGA,183447.000,4751.6605,N,12142.3934,W,1,6,2.24,63.6,M,-16.9,M,*5A

$GPGLL,4751.6605,N,12142.3934,W,183447.000,A,A*4D

$GPGSA,A,3,03,18,06,19,22,27,3.38,2.24,2.53*0B

$GPGSV,3,1,12,18,69,061,37,22,63,252,45,06,52,253,42,21,51,114,21*7F

$GPGSV,3,2,12,03,46,270,46,48,33,195,29,15,30,051,21,19,29,311,35*71

$GPGSV,3,3,12,14,19,186,16,27,16,069,22,09,13,095,16,05,246,16*70

$GPRMC,183447.000,A,4751.6605,N,12142.3934,W,0.01,241.74,140212,A*7B

$GPVTG,241.74,T,M,0.01,N,0.02,K,A*3A

So I am at lost what the problem is.

One note- SoftwareSerial – is the library that comes with the NEW Arduino 1.0 IDE. That’s the library that used to be call NewSoftSerial.

What kills me is I got his OLD tinyGPS to work with the Arduino .22 IDE.

I believe the problem is that the buffer size used to hold received characters in SoftwareSerial was reduced in Arduino 1.0. For some background on this, see my post at:

https://sites.google.com/site/waynehold … g-with-gps

Wayne

Thanks Wayne,

Changing the buffer size in SoftwareSerial.h from 64 to 128 fixed the problem for me as explained in the above post:

#define _SS_MAX_RX_BUFF 64 // RX buffer size

to

#define _SS_MAX_RX_BUFF 128 // RX buffer size