SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By hl3fx
#103420
Hi all,

Im having a bit of trouble getting the SUP500F receiver to work continually.

Its very strange in fact because it works sometimes, then it just stops working using the same code.

For instance, last night i was finally able to read the NMEA data stream using
http://www.sparkfun.com/tutorial/GPSQui ... ng_v12.pde.

I altered the code a bit as below and loaded it to the Arduino. After which i was not able to read the gps data at all, not even after loading the example code again. The strange thing is, when i woke up this morning the example code worked, then i loaded my code and it stopped working.
Code: Select all
#include <string.h>
#include <ctype.h>
#include <NewSoftSerial.h>
#include <TinyGPS.h>

#define RXPIN 3
#define TXPIN 2
#define GPSBAUD 9600

// analog inputs
int acc1 = 0;
int acc2 = 1;
int acc3 = 2;
int sensor1 = 3;
int sensor2 = 4;
int sensor3 = 5;

// digi
int ledPin1 = 13;
int ledPin2 = 12;

// vars
int ok = true;

// log format
// datetime,lat,long,altitude,direction(degrees),speed,acc_x,acc_y,acc_z,sensor1,sensor2,sensor3,vidFrame

TinyGPS gps;
NewSoftSerial nss(RXPIN, TXPIN);
void getgps(TinyGPS &gps);

void setup(){
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);  
  
  Serial.begin(115200);
  nss.begin(GPSBAUD);
  
}

void loop(){
  while(nss.available()){    // While there is data on the RX pin...
    
    // write gps data
    int c = nss.read();      
    if(gps.encode(c)){       
      getgps(gps);
      ok = true;      
    }
    else{
      fakeGPS();
      ok = false;
    }
    
    // write sensor data
    AnalogInputs();
    
    // video frame
    Serial.print("0");
    
    // linefeed
    Serial.println("");
    
    // toggle LED
    status_LED();
    
  }
}

void status_LED(){
  if(ok){
    digitalWrite(ledPin1, HIGH);
    digitalWrite(ledPin2, LOW);
  }
  else{
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin1, LOW);    
  }  
}

void fakeGPS(){
  // time
  Serial.print("2010");Serial.print("-");Serial.print("01");Serial.print("-");Serial.print("01");Serial.print(" ");
  Serial.print("12");Serial.print(":");Serial.print("01");Serial.print(":");Serial.print("01");Serial.print(".");Serial.print("01");Serial.print(",");
  
  // lat long
  Serial.print("0.0"); Serial.print(","); 
  Serial.print("0.0"); Serial.print(",");

  // altitude
  Serial.print("0.0"); Serial.print(",");
  
  // direction
  Serial.print("0.0"); Serial.print(",");
  
  // speed
  Serial.print("0"); Serial.print(",");  
  
}

void getgps(TinyGPS &gps){
  
  // get gps data
  // time format = '2007-03-04 01:14:19.47'
  float latitude, longitude;
  int year;
  byte month, day, hour, minute, second, hundredths;
  gps.f_get_position(&latitude, &longitude);
  gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths);
  
  // time
  Serial.print(year, DEC);Serial.print("-");Serial.print(month, DEC);Serial.print("-");Serial.print(day, DEC);Serial.print(" ");
  Serial.print(hour, DEC);Serial.print(":");Serial.print(minute, DEC);Serial.print(":");Serial.print(second, DEC);Serial.print(".");Serial.print(hundredths, DEC);Serial.print(",");
  
  // lat long
  Serial.print(latitude,5); Serial.print(","); 
  Serial.print(longitude,5); Serial.print(",");

  // altitude
  Serial.print(gps.f_altitude()); Serial.print(",");
  
  // direction
  Serial.print(gps.f_course()); Serial.print(",");
  
  // speed
  Serial.print(gps.f_speed_kmph()); Serial.print(",");
  
}

void AnalogInputs(){
  // accelerometers
  Serial.print(analogRead(acc1));Serial.print(",");
  Serial.print(analogRead(acc2));Serial.print(",");
  Serial.print(analogRead(acc3));Serial.print(",");

  // sensors
  Serial.print(analogRead(sensor1));Serial.print(",");
  Serial.print(analogRead(sensor2));Serial.print(",");
  Serial.print(analogRead(sensor3));Serial.print(",");  
  
}
below is the setup.
Image

any ideas or hints?
Thanks!!
By daryll
#103550
Well I'm using SUP500F reliably. I've used NSS at 9600 with no problem.

Your minimal program is:

NewSoftSerial nss(GPXRS, GPSTX);
nss.begin(9600);
while (nss.available())
Serial.print(nss.read())

If that works, you should see a bunch of NMEA sentances, GPGSA, GPRMC, GPGGA. It seems to take about 30 seconds for me to get a cold start to having a GPS lock. (In your GGA lines you'll see your lat and lng, and then a 0 or 1. 1 indicates a good lock)

Note that the Arduino 3.3v output is only rated to 50mA and I believe the SUP500F can draw up to 75mA at start up and 33mA running. With that said, I started doing exactly what you are doing on a perfboard and it worked fine. Once I started adding more gear to my circuit (and I see you've got some code for accelerometers in there) I got failures like you're seeing with some things working and others not, until I put a real 3.3v regulator and level shifter in place.

I hope that gives you a few ideas. Good luck.
By hl3fx
#103572
Hi, thanks for the replies!

I made the minimalist script per your suggestion and also made one other alteration with the following results.

I currently dont have any regulators or level shifters, although you had indicated that it should work without too much on the circuit. I changed my circuit a bit with this in mind.
arduino 5v -> GPS pin 4 (VDD)
arduino 3.3v -> GPS pin 5 (VBAT)
I didnt see a limit specified on the 5v pin in the arduino spec, so i imagine its based on the input current? It is currently being powered over USB plugged into a USB hub with its own power supply.

code:
Code: Select all
#include <NewSoftSerial.h>

#define GPXRS 3
#define GPSTX 2
#define GPSBAUD 9600

NewSoftSerial nss(GPXRS, GPSTX);

void setup(){
  nss.begin(GPSBAUD);
  Serial.begin(9600);
}


void loop(){
  while (nss.available()){
    Serial.print(nss.read());
  }  
}
The serial monitor is just picking up a string of numbers now, even after sitting for 2 mins in open sky.
Image

Could this be a power issue?
Is it possible i got a bad unit?

I wonder if somehow it got into a binary state, i read in another forum that it is possible to set these into a binary streaming mode. The unit did work at one point, then stopped with no obvious cause.

Thanks for any help!
By daryll
#103574
I didn't think about it from your picture, but you can't connect a 5v Arduino like that. The specs for the VDD on the GPS are 2.8v to 3.6v. Giving it 5v is a bad idea! Some devices are 5v tolerant, but this one isn't.

The easiest answer for you would be to pick up the SparkFun level shifter. The level shifter is cheap, so I'd suggest that. BOB-08745

The level shifter will require a 5v and a 3.3v source. You can pull from the 3.3v on the Arduino and it'll likely work just fine, but technically it isn't enough power. A better answer would be to pick up a 3.3 voltage regulator. COM-00526

So that's $4 worth of parts and about six more wires that will make your life so much easier.
By hl3fx
#103578
hmm,

i was going off the spec from the SUP500F description page that indicates its 3.0v 0 5.5v.
http://www.sparkfun.com/datasheets/GPS/ ... 00F_v3.pdf page 4

I will connect it to the 3.3v and work with your suggestions though.

To move forward without having to wait for the parts to arrive do you have any other suggestions or ideas on why im getting the string of digits? Or am i stuck until i can get the power regulated?
By follower
#103579
hl3fx wrote:
Code: Select all
    Serial.print(nss.read());
The serial monitor is just picking up a string of numbers now, even after sitting for 2 mins in open sky.
Ignoring the electrical side of things, I suspect you might get the result you're looking for if you replace the above line with:
Code: Select all
    Serial.print(nss.read(), BYTE);
What you're seeing is the ASCII values of the characters read.

--Philip;
By hl3fx
#103585
Brilliant!!!!

Thanks Philip!

daryll i have the parts on order, thank you as well for your help!

:mrgreen: :mrgreen: :mrgreen:

for reference, the final working example code i used is
Code: Select all
#include <NewSoftSerial.h>

#define GPXRS 3
#define GPSTX 2
#define GPSBAUD 9600

NewSoftSerial nss(GPXRS, GPSTX);

void setup(){
  nss.begin(GPSBAUD);
  Serial.begin(9600);
}


void loop(){
  while (nss.available()){
    Serial.print(nss.read(), BYTE);
  }  
}
By daryll
#103599
Good catch Phillip.

You're right. The SUP500F spec says it accepts 5v. It's the Venus spec that says 3.3v. It's possible they have a regulator in the SUP500F.

The SUP500F says 3.3v TTL. 3v should be enough to trigger a 5v TTL input. I'm not sure what happens if you send 5v when you're transmitting.

At least you're making progress.
By follower
#103683
hl3fx wrote:for reference, the final working example code i used is [snip]
Great, I'm glad you sorted it out. Thanks for taking the time to post the final working version of the code to help others.

--Philip;
By hl3fx
#103719
Ok, so im still having troubles.

First, i appreciate all the help i have received thus far.

For some reason the SUP500F will not lock on to any satellites, im hoping i might get a little more guidance.

The stream coming from the unit is as follows:

$GPGSV,1,1,01,17,00,000,36*4B
$GPRMC,021224.000,V,0000.0000,N,00000.0000,E,000.0,000.0,240610,,,N*70
$GPVTG,000.0,T,,M,000.0,N,000.0,K,N*02
$GPGGA,021225.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,0.0,M,,0000*6B
$GPGSA,A,1,,,,,,,,,,,,,0.0,0.0,0.0*30

To alleviate and power concerns i got a switchable power brick to supply the reciever @ 3.3v.

It is sitting in the middle of my yard and has been for the past 5 minutes with the above results. Last night i went for a drive in hopes that it would at some point lock on a signal. It was just connected to my laptop at this point via USB, no external power.

I wonder if maybe the unit is bad? :(

What else can i try at this point?
By SFE-Nate
#105675
We see SUP500 modules come through tech support fairly routinely that experience various issues. I'm not sure if the modules are lousy or buggy or what? Whatever it is, fresh SUP500 modules have been know to not get locks, stop getting locks all of a sudden, start up and get a lock exceptionally slowly, etc.

I've just stopped suggesting people buy them all together. We have a graveyard of SUP500 modules sitting here at SparkFun. We tried to get them taken off the website. It was concluded that some but not all can get them working so we continue to sell them. Really they are like a tease; 33mA draw at a update rate of 10Hz, 30 sec cold start plus 65 Channels all for the low low price of $59.95, how could you go wrong??!!

Anyways, if you want to drop a line to SFE Tech Support, we can chat about getting your module replaced or refunded.
By sponaugle
#106448
hl3fx wrote:Ok, so im still having troubles.

First, i appreciate all the help i have received thus far.

For some reason the SUP500F will not lock on to any satellites, im hoping i might get a little more guidance.

It is sitting in the middle of my yard and has been for the past 5 minutes with the above results. Last night i went for a drive in hopes that it would at some point lock on a signal. It was just connected to my laptop at this point via USB, no external power.

I wonder if maybe the unit is bad? :(

What else can i try at this point?
I recently got a SUP500F from Sparkfun and experienced the same thing. I thought perhaps the unit was bad, or that the power was insufficient.

I currently have the unit powered off 5V from an Arduino board, and am using the FTDI 5v TTL on the Arduino to interface to the GPS. The GPS TTL Serial is only 3V, but it works fine with the FTDI for input to the PC. I was not paying attention to the level and connected the serial output to the GPS as well (5V TTL) and to my surprise it worked fine.

I was able to use the Skytool to connect, see the position, download the AGPS data, change to binary, etc. Obviously I would not recommend this for a long term solution, but I suspect it might work as long as the VCC is also 5Vs. (you can imagine things might be worse if VCC were set at 3V but the TTL inputs driven at 5Vs).

I had the device up and running in my kitchen for about 20 mins with no go, I even took it outside for a few mins, and it could only get a few sats. The next morning I took it out to the back yard with a very clear sky and let it run for about 20 mins. It got 9 sats locked, and from that point on it has very fast resync. If I have used the unit in the last day or so, it typically gets first lock in 5 seconds or less.

I'm not sure why it took so long for it to correctly download the almanac and ephemeris, and thus find other sats. However after that first long init, it is working great.

Like Nate said, it has great features if you get it working. I'm using it in a HP rocket tracking system, so hopefully it will work under high acceleration.

Jeff Sponaugle
By sylvie369
#106457
sponaugle wrote:
hl3fx wrote:Like Nate said, it has great features if you get it working. I'm using it in a HP rocket tracking system, so hopefully it will work under high acceleration.
More importantly, hopefully it will reacquire lock quickly after losing it in your boost phase. I think that it's expected that you'll lose satellite lock on the way up - some of the GPS tracker manufacturers tell me that's normal. What you really want is to get the signal back quickly.

I flew yesterday with a Byonics GPS2-based tracker in a 4" rocket on a J500. Probably only about 400 miles an hour tops, relatively low acceleration. I lost track only briefly, and picked it up again quite quickly. Very satisfactory.

As I told you in my reply to your PM, though, I've given up on the SUP500F in my onboard tracker. A shame - the standard pin arrangement was very convenient.
By HardyG
#107922
Hi,
why don't you use a simple voltage devider like 330+680 Ohms on the TTL sender line?
Shouldn't that work either?

Kind regads,
Hardy