Topic: GPS Accuracy
(Read 1 time)
Apr 28, 2017, 10:02 am
does anyone here knows how to improve the gps accuracy? right now im using arduino and sim808 and implementation source code from
…/SIM8…/GPRS/GSM_Shield_SKU:_TEL0097. everything works fine except the gps accuracy. i need few more decimal places so that i can get full gps accuracy because right now it gives me several kilometer inaccurate.
i want to parse the number up to 6 decimal digit. it is possible?
part of the source code:
// Parse a (potentially negative) number with up to 2 decimal digits -xxxx.yy
int32_t DFRobot_SIM808::parseDecimal(const char *term)
bool negative = *term == '-';
if (negative) ++term;
int32_t ret = 100 * (int32_t)atol(term);
while (isdigit(*term)) ++term;
if (*term == '.' && isdigit(term))
ret += 10 * (term - '0');
ret += term - '0';
return negative ? -ret : ret;
does anyone here would like to help? im really appreciate it.
Re: GPS Accuracy
Apr 28, 2017, 02:07 pm
Are you using float/double values for Latitude and Longitude? On an Arduino, the float/double types can only express between 6 and 7 significant digits. If you need more significant digits you will need to work in integers (probably long integers).
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp
See who has no social life:
No dash, just slash
No, it's "/dev".
Re: GPS Accuracy
Apr 28, 2017, 02:16 pm
: Apr 28, 2017, 02:17 pm by -dev
There's no way to fix that code, because it is returning the integer XXXXYY instead of XXXX.YY. The caller of this routine expects the scaled-by-100 integer. If you try to add extra digits, you have to change the scaling factor to 10000... and then you have to change all the code that calls
It would probably be easier to switch to a better library. There are several SIM808 libraries that you could combine that a GPS library. My
is smaller, faster and more accurate than all other libraries. It provides 10 significant digits (7 decimals). Other libraries only provide ~7 digits (4 or 5 decimals).
Here's an untested sketch
that uses AT commands to control the SIM808. It also uses NeoGPS to parse the GPS stream when the SIM808 is emitting the GPS NMEA sentences.
Really, I used to be /dev.