BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[SOLVED] Gps stream (Not displaying full 6 decimal points)

Hi, I have problem with my GPS stream project. If I use this code:

BLYNK_WRITE(V1) {
  GpsParam gps(param);
  // Print 6 decimal places for Lat
  Serial.println(gps.getLat(), 7);
  Serial.println(gps.getLon(), 7);

  Serial.println(gps.getAltitude(), 2);
  Serial.println(gps.getSpeed(), 2);
}

In my serial port print value latitude, longitude correctly with 6 decimal places
but if I try with this code:

BLYNK_WRITE(V1) {
  float latitude = param[0].asFloat(); 
  float longitude = param[1].asFloat();
  float altitude = param[2].asFloat();
  float speed = param[3].asFloat();
}

or combine with this:

BLYNK_WRITE(V1) {
  GpsParam gps(param);
  float latitude = (gps.getLat(), 7); 
  float longitude = (gps.getLon(), 7);
}

I have value with only two decimal places. Whyyyy? I need six or although four decimal places.

How are you displaying the data? Perhaps the display widget type is only showing up to 2 decimals. If using Labeled Value, make sure you use /pin/ - displays the value without formatting (i.e. 12.6789…)

http://docs.blynk.cc/#widgets-displays-labeled-value

https://www.arduino.cc/en/Reference/Float

Hi, for first I try display this value in serial monitor but no results (only two decimal). Next I want send this data to thingspeak becouse blynk GPS trriger still doesn`t work for me. I try with thingspeak Gps trriger and works pretty well, but I have only two decimal places :frowning:

@Mekada take a look at this thread (GPS) Loss of precision in decimals (double)

@Mekada

Try this… I get full 8 decimal point resolution (in Lat and Long) with strings.

BLYNK_WRITE(V39) {
  GpsParam gps(param);
  Blynk.virtualWrite(V41, param[0].asString()); 
  Blynk.virtualWrite(V42, param[1].asString());
  Blynk.virtualWrite(V43, param[2].asString());
  Blynk.virtualWrite(V44, param[3].asString());
}

2 Likes

Thanks for help it`s work with string function, but I have only 7 decimal point resolution. :slight_smile:

@Mekada is your GPS sensor able to provide more than 7 decimal places with any level of accuracy?

@Costas Yes

Are you going to the moon?

What is the range in CM between 7 and 8 dp?

Maybe :smiley:
With Blynk I can go everywhere

1 Like

Have you calculated this?

Nope

Depends on your proximity to the equator / poles but I believe around 0.1m.

Must be working on a military weapons system if you have hardware that has that level of accuracy. Civilian GPS is only accurate to around 3m and normally you should work to the expected tolerance of 8m.

8 dp give me 1 cm
1 degree = 111196,672 m
0,00000001 = 1,11196672 mm
0,00000009 = 1cm
Topic is close

0.1cm (1mm) not 0.1m from 7 to 8 dp

From Wiki at https://en.wikipedia.org/wiki/Decimal_degrees nice handy lookup table.

Why not use param[0].asDouble() ???

1 Like

I think that is normal… I don’t know how or why my phone (Nexus 6) kicks out 8 points once in awhile, but normally it is “only” 7… poor me :stuck_out_tongue_winking_eye:

I hadn’t tried that yet myself… I guess that would be better if doing any calculations with the data… like the aforementioned moon shot :wink:

Hey Guys
Thanks For Your Reference.
It Is The Problem Of Serial.Print();
Serial print only take two decimal.
so You Have To Define Exact Decimal.

Example:

BLYNK_WRITE(V2) {
GpsParam gps(param);
gpsLat = (gps.getLat());
Serial.println(gpsLat,7);
gpsLong = (gps.getLon());
Serial.println(gpsLong,7);
}