[Solved] Need very accurate GPS lat/long data

I've been trying for many months to come up with a viable solution to receive very accurate GPS data, but can't seem to cut it.

BLUF: - I want to use the GPS lat/long to implement a waypoint based autopilot for a custom arduino RC plane - The GPS data should have an update frequency of no less than 1Hz - The GPS data should have an accuracy of no worse than 10 meters

Things I've already tried: - Tried using an Adafruid Ultimate GPS module, but it is difficult to get a satellite fix and when I do, the lat/long values are literally miles off - Tried using an Android phone using the app "BlueNMEA" to send NMEA strings to the arduino via bluetooth. It works, but lat/long data is still about 3,000ft off.

As frustrating as this is, I don't want to spend $200 for a dedicated handheld GPS unit to interface with.

Does anybody have any ideas? Has anyone else been able to get such accurate GPS lat/long before?

Thanks!

A waypoint based autopilot is quite an advanced application, how much experience do you have with Arduino and GPS stuff ?

You must be doing something fundamentally wrong with the GPSs as even a cheap $10 ebay GPS should give results in the 20M accuracy range.

If the GPS is showing its 'miles off' are you sure you are not misreading the data it is giving you ?

And whilst even a simple GPS should give reasonable results, you are very unlikely to get a GPS that will always be within 10M, unless you use one of the more specialist devices.

With a clear view of the sky and a good satellite fix, just about any GPS module will give you typically +/- 3 m accuracy or better at an update rate of 1 Hz.

How are you interpreting the GPS data fields?

Keep in mind that Arduino supports only 32 bit floats, which is not good enough for accurate GPS coordinates or distance calculations.

Try NeoGPS. It's smaller, faster and more accurate than all other libraries. One of the problems with the Adafruit_GPS is that it does not verify the NMEA checksum. This can cause it to provide bad lat/lon data.

The NMEAloc.ino example shows how to get 10 significant digits (7 decimals) for the lat/lon reported by your GPS. The NeoGPS distance calculations preserve this accuracy, resulting in very accurate distances and bearings. Other libraries calculations can be off by 40% at small offset, because they use the float type.

While the NeoGPS locations are accurate to about 1cm (vs. 1m for other libraries), you're really limited by the accuracy of your GPS device. Accuracy can be affected by many factors, including power supply stability/noise, antenna placement and performance, satellite positions and weather conditions.

On the best day, you'd be lucky to get 3m accuracy. 10m or more is not unusual. Adding an IMU and compass and filtering software can help, but this is an advanced topic. For example, the compass can be affected by the airframe; it may require calibrated offsets, or it may not be usable.

Let's see your code, though. Many things can prevent you from getting good values.

Cheers, /dev

P.S. There's a simple waypoint sketch over here.

"If the GPS is showing its 'miles off' are you sure you are not misreading the data it is giving you ?"

That is more likely. I was parsing data from a GPS and putting it into google maps to see if it was tracking correctly. The GPS was giving 4236.7054, -7352.8753 Google maps wanted this kind of format, 42.367054, -73.528753

I didn't break it up quite right and the location I got in google maps was always ~7 miles southeast. I was trying to enter something like 42 36.7054, -73 52.8753 which is valid, but not the same.

So I did a little more research and it turns out that the NMEA over bluetooth actually gave me quite accurate data - just what I was looking for.

What I was doing to check the data accuracy was printing the raw NMEA strings to the monitor and then try putting the lat and long into google maps and see if it gives my current location. Turns out I was inputting them to google maps incorrectly. Whoops.

Thanks anyway!

srnet: A waypoint based autopilot is quite an advanced application, how much experience do you have with Arduino and GPS stuff ?

I don't think the question is germane, but I will say I don't have much experience with waypoint based autopilots - that's why I'm trying it out. I know this will be very difficult to implement, but I'm willing to learn. As a senior undergrad in EE, I want to do specialized work in flight control systems and autonomous control later in my career.

Crossroads: I was trying to enter something like 42 36.7054, -73 52.8753

NMEA sends a latitude as DDMM.mmmm. That's whole degrees (1, 2 or 3 digits) and a floating-point minutes. To convert this to the degrees that Google Maps wants, you don't just move the decimal point. You must divide the the minutes by 60 and then add that to the degrees:

    degrees = atoi( "42" );
    minutes = atof( "36.7054" );
    degrees += (minutes / 60.0);

The number you should be entering into Google Maps is 42.611757.

I will say I don't have much experience with waypoint based autopilots

You really need an independent method of detecting your vehicle's current heading for navigation, because GPS waypoints and position updates don't give you that to any useful degree of accuracy.

GPS waypoints and position updates will lead to the [u]desired[/u] heading, which you need to compare with the [u]current[/u] heading for steering. For autonomous vehicles I recommend a 9 DOF IMU (e.g. BNO055 works very well) for PID steering between waypoints.

I will have several other sensor onboard in addition to the GPS receiver to include an IMU with a magnetometer.

This thread was meant to focus on achieving accurate data, but I do appreciate your advice about the processing and interpretation.

Power_Broker: I don't think the question is germane, but I will say I don't have much experience with waypoint based autopilots

You will see all sorts of extremly inexperienced newbies posting on here wanting to build 'drones' a lot clearly do not have the experience or skills to design and build a 'drone' safely.

'drones' are dangerous things in the hands of the inexperienced, they will cut you, or worse someonne else, to bits if they colide with human flesh.

So its entirly appropriate that questions of experiece and skills are asked.

Now reflect on your issue with the GPS, most of us with a reasonable amount of experience in this area would know that GPSs will not be 'miles out' ergo its obvious there is a lack of experience in this area, and possibly in 'drone' building too.

And to depricate myself, although I have a small amount of experience in electronics (40years) and building RC electric planes (30years), whilst I am in process of building a 'drone' it will be flown under direct RC control. Autonomous drones raise a whole series of additional safety isues that are a very significant challenge to manage. Not sure if they would be legal either.

srnet: You will see all sorts of extremly inexperienced newbies posting on here wanting to build 'drones' a lot clearly do not have the experience or skills to design and build a 'drone' safely.

'drones' are dangerous things in the hands of the inexperienced, they will cut you, or worse someonne else, to bits if they colide with human flesh.

Absolutely; I agree 100%. I never plan on flying anywhere near bystanders or buildings. Safety is my number 1 priority.

srnet: Now reflect on your issue with the GPS, most of us with a reasonable amount of experience in this area would know that GPSs will not be 'miles out' ergo its obvious there is a lack of experience in this area, and possibly in 'drone' building too.

Yes, but we all have to start somewhere.

srnet: And to depricate myself, although I have a small amount of experience in electronics (40years) and building RC electric planes (30years), whilst I am in process of building a 'drone' it will be flown under direct RC control.

I have no doubt that you are fantastic engineer (as so many members of the forum are). I hope to gain as much experience and skills throughout the years as you have. One of the best ways to do this is to work hard at implementing difficult embedded projects such as this.

Not that it matters much, but my RC system is an airplane, not a quad/hex copter (just in case there is any confusion).

srnet: Autonomous drones raise a whole series of additional safety isues that are a very significant challenge to manage. Not sure if they would be legal either.

True again. I constantly take safety, robustness, and reliability into account when developing this system. I also will be doing extensive testing before any maiden voyage.

Also, it is legal where I operate.

Power_Broker: Not that it matters much, but my RC system is an airplane, not a quad/hex copter (just in case there is any confusion).

Good choice, a great deal safer.

And if it all goes wrong, not difficult to arrange for it to go into fail safe mode with a gentle low speed glide.

This is what is possible;