GPS Location INVALID

I need HELP. My GPS isn't working, but it was working fine yesterday and I have a big project coming up. Im trying to make a system were when a car accident is detected the gps location is found and sent to a number. The accident is being detected but the GPS location just keeps on coming invalid in the serial monitor this is the code im using.

FINAL_CODE.ino (8.81 KB)

What did you do, between yesterday and today? Which code did you post? Today's or yesterday's?

So the GPS and program was working fine yesterday ?

So what changes have you made since then to either the hardware or software or location ?

Re-assure us that the GPS is located outdoors with a good view of the sky ?

@srnet
I'm using a GPS, NEO-6M with external antenna based device and it works fine indoors, even some 10 meters into to body of armed concrete walls, floor and ceiling.

@OP
Are You using breadbord to connect the stuff? If so, check for loose wires.

Railroader:
@srnet
I'm using a GPS, NEO-6M with external antenna based device and it works fine indoors, even some 10 meters into to body of armed concrete walls, floor and ceiling.

That would be after already obtaining and storing an almanac. I highly doubt that you would be able to do a cold booted satellite lock there.

@aarg
Upon Your reply I just powered up the device, some 6-7 meters down into the apartment and it boots up! It shows date, time, altitude…. okey.
All development and starting up has been done indoors, one meter inside the walls.
Star ting up from cold has never been any problem in numerous other Indoors situations.
May pure steel wall and steel roof buildings are difficult but that remains to be tested!

Railroader:
@anon57585045
Upon Your reply I just powered up the device, some 6-7 meters down into the apartment and it boots up! It shows date, time, altitude…. okey.
All development and starting up has been done indoors, one meter inside the walls.
Star ting up from cold has never been any problem in numerous other Indoors situations.
May pure steel wall and steel roof buildings are difficult but that remains to be tested!

That is not typical. I don't think you are really starting from cold... you have to radically change location or disconnect the backup battery cell for that. I think it's working for you because it did boot once and update its ephemeris (which it keeps in NV RAM).

The device has been disconnected from its battory for weeks. If I closed it down at the present location, I can't tell. I'll take it out for a trip, power it up, and down, at another location. Interesting question!
I have noticed that the starting up takes more time if the unit is moved being powered down and then started up.

Railroader:
The device has been disconnected from its battory for weeks. If I closed it down at the present location, I can't tell. I'll take it out for a trip, power it up, and down, at another location. Interesting question!
I have noticed that the starting up takes more time if the unit is moved being powered down and then started up.

I doubt that we're talking about the same battery. Are you talking about a GPS map device, like a Garmin, instead of a module? If you look on a GPS module, you will always find a tiny coin cell. That is what I am referring to.

Railroader:
@srnet
I'm using a GPS, NEO-6M with external antenna based device and it works fine indoors, even some 10 meters into to body of armed concrete walls, floor and ceiling.

Then I suggest you hang onto it, its a very rare GPS that will work reliably indoors.

I have lots of different GPSs here, and whilst they work indoors, sometimes, its not at all reliable.

Out of interest, if you start this GPS from cold, no backup etc, how long does it take to get its first location fix when its 'some 10 meters into to body of armed concrete walls, floor and ceiling' ?

In some way I seem to have a friendly situation. Both the UNO/NEO-6M, powered by a 5 volt powerpack, and the Garmin Zumo 590 starts up and work indoors without any noticed faults. As I live on the top floor, having like one foot of reinforced concrete above my head and on top of that wood and asfalt I wonder if the sattellite signals manage to penetrate it. Or the windows are leeking signals.
It is interesting to make the circumstances harder for those 2 units and find out.
The Zumo is of cource blinded from satellites during underground tunnels and uses some other technic to indicate movement forward.
Anyway, being indoors is clearly not hopeless.

Railroader:
It is interesting to make the circumstances harder for those 2 units and find out.

GPS receivers typically provide a satellite status message that includes the signal power of the satellites being tracked and their azimuth and elevation data. If it's possible to move the receiver outside with a clear sky view, one can get a baseline signal strength for all visible satellites and then move it inside to get some quantitative measure of the attenuation due to looking through the roof.

I've also see a GPS receiver positioned near a window or next to a building see satellites in the more or less unblocked directions and not so much in the blocked directions. In general, counting on GPS to work indoors isn't a great idea, but sometimes it does work well enough.

Sure. If it works, be happy. If not, use places were it works.

@aarg
I note Your remark with NV-RAM in #6. Observing the start ups, I've guessed it propably does like that. From my "test start" in #5 the UNO/NEO-6M found/senced 9 satellites. That can't be coming fron NV I think.

Railroader:
Sure. If it works, be happy. If not, use places were it works.

@anon57585045
I note Your remark with NV-RAM in #6. Observing the start ups, I've guessed it propably does like that. From my "test start" in #5 the UNO/NEO-6M found/senced 9 satellites. That can't be coming fron NV I think.

The NV stores the location and time. From that, the GPS receiver consults an ephemeris that tells it what satellites to expect at that location and current time. When the NV and RTC is blank, the GPS doesn't know where it is on the planet, or what time it is. Therefore it has to start a random search for a beacon signature. The signals are so weak that the correlation for that takes a really long time. Once it locks onto the beacon, it can identify the satellite and get the time and location, and update the ephemeris. Obviously, once it stores that information, a start up is nearly instantaneous. I don't know what your "test start" is, but I don't think it wipes the NV.

@aarg
Thanks for the lessons, the insight into GSM functionality. It all makes sence and corresponds with my observations during some 2 years.
Driving away a good distance without using the Garmin and then turning it on, it takes a number of minutes for it to capture enough number of satellites to give a reliable reading. The same applies to my UNO/NEO-6M portable speedometer.
Both units works poorly when the position is surrounded, both sideways and upwards, by trees, especially whet trees so I know well that GPSs can be shadowed.
The UNO/NEO-6M is used to check some poorly working train speed indicators and awaiting clear sky is highly preferable in order to "calibrate" the train.

By "test start" I refer to #5, powering the unit up knowing it had not been used for weeks, not knowing the last place of using it.
As You say, NV is there helping during start up in order to speed it up. I did not time the start up, gave it maybe 10 minutes and checked it for "life". Only wanted to verify that the unit did get in contact with satellites.

You know what happens. Someone orders their Neo-6m from China. They write a War-and-Peace length sketch and then scratch their heads when they hook it up and nothing works - oh no! "I must have made a mistake in my code...". Time to post the encyclopaedic sketch on the Arduino forum (without code tags). Said Neo-6M is sitting inside a concrete classroom somewhere, desperately trying to lock on something because its last coordinates were in Shenzhen, China. RTC might also be dead because the battery is so tiny, it's a rechargeable usually, and depends on periods of applied power to keep a charge - dead after sitting in a warehouse for several months or years.

First thing I do with any GPS module is power it on and just leave it by a window for a few hours. Only after that, do I attempt to use it. Usually you can see the PPS LED going after a while.

A worst case cold boot can take up to 15 minutes, under a clear sky.

Ansh Ramani,

The physical construction of your device is just as important as your sketch with regards to troubleshooting.

Can you post a couple of photos of your device, please?

You should check the voltage at the GPS VCC pin. There will be a threshold below which it will under perform.

A good first step in troubleshooting a GPS device is to read the NMEA sentences without using an Arduino board and sketch. That can tell you a lot.

Good luck.

John.

OOPS, lots of factors unknown to me. Anyway, I've been using that device for 2 years so I think it has settled down is some way.

Railroader:
The device has been disconnected from its battory for weeks. If I closed it down at the present location, I can't tell. I'll take it out for a trip, power it up, and down, at another location. Interesting question!
I have noticed that the starting up takes more time if the unit is moved being powered down and then started up.

The u-center software from u-blox allows you to force the GPS receiver into a cold, warm or hot start. A cold start makes it start without using the ephemeris and almanac data, saved in its memory. So it has to get those two data sets afresh from the satellites.

John.

@OP
Sorry I contributed to "speculating experts". The question, what change did You make that turned Your stuff from working to not working awaits Your reply.