GPS module for Photon?

As suggested give the library a spin.
The sample provided with the lib uses D2/D3 as RX/TX.

@pranav292,

I worked on this same issue and published my results here. Hope it might be of some help.

Simple Sight Survey Tool. Used with Electron but would work with Photon as well.

Chip

1 Like

Hi pranav,

OK, got a wee bit more time.

First can I ask you to put a link to the exact module you have, for example were you bought it. If not a pic would be good.

There are lots of moudules out there, so knowing exactly which one you have would be nice. There have been lots of copys of Neo gps modules, the 8 in particular, got a knock off Neo8, myself. It took while getting the Neo8 working, as my main experiance had been with a genuine Neo6. So just bear in mind cheep can be nasty…

Do you have a serial to USB adaptor? There is an excellent Ublox utility for directly interfacing with the module directly from a PC/Laptop.

Were in the world are you? Typically I’d expect ot get a gps fix after about 10min, with a clear line of sight to the sky. Preferably with a good view to a large part of the sky. The lower floors of a tower block, surrounded by tower blocks is not a good location.

Below is my code I used to test my modules. You will need to include a legacy libary, TINYGPS.

It worked on both the core the photon and an electron. The Tx and Rx pins are in the written on the devices. Do not forget SERAIL pins go GPS TX to Core RX, GPS RX to Core TX. (Some times called a cross over connection).

Personally I’ve never actually ran two serial devices at the same time. Also I’ve had not problems using the modules 1 or 2 inch away from the core/photon/electron. But thats not to say they work better further apart. Just in not been a problem for me.

Liam

#include "TinyGPS/TinyGPS.h"


TinyGPS gps;
char szInfo[64];
// Every 15 minutes 
int sleep = 1 * 30 * 1000;

void setup(){
    Serial1.begin(9600);
    //Particle.variable("Counter", &count, INT);
    Particle.variable("GPS", szInfo);
}

void loop(){
    bool isValidGPS = false;
    
    for (unsigned long start = millis(); millis() - start < 1000;){
        // Check GPS data is available
        while (Serial1.available()){
            char c = Serial1.read();
            
            // parse GPS data
            if (gps.encode(c))
                isValidGPS = true;
        }
    }

    // If we have a valid GPS location then publish it
    if (isValidGPS){
        float lat, lon;
        unsigned long age;
    
        gps.f_get_position(&lat, &lon, &age);
        
        sprintf(szInfo, "%.6f,%.6f", (lat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : lat), (lon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : lon));
        Particle.publish("gpsloc", szInfo);
    }
    else{
        // Not a vlid GPS location, jsut pass 0.0,0.0
        // This is not correct because 0.0,0.0 is a valid GPS location, we have to pass a invalid GPS location
        // and check it at the client side
        sprintf(szInfo, "0.0,0.0");
    }
    
    //Particle.publish("gpsloc", szInfo);
    Serial.println(szInfo);
    //Serial.println(string(c);
    
    // Sleep for some time
    delay(sleep);
}