Log ping 2 data with GPS

I do some trial for hardware integration with Arduino Mega (2 serial port)
The goal is to log position (gps) and depth ( ping 2)
I have got this

Lat ; lon ; time ; depth ; confidence
-7.822731;110.411600;03:33:01.609;19429;1 
-7.822731;110.411600;03:33:03.609;21085;1 
-7.822729;110.411600;03:33:04.609;28995;1 
-7.822725;110.411590;03:33:06.609;516;0 
-7.822724;110.411580;03:33:07.609;580;0 

Then I saw big error…
Why this can not get 100% confidence…
The depth read totally.wrong

How to solve this ??
I use arduino mega for data logger

Hi @caris, welcome to the forum :slight_smile:

A sensor cannot know for sure that it is measuring the quantity it is supposed to be. Our Ping Sonar can use its profile data to estimate the distance to a reflective surface, but sometimes the data it’s measuring isn’t consistent enough for it to know whether there is in fact a surface to detect, or how far away it is if there is one.

I would recommend reading through

  1. this thread to understand how an echosounder works, and the factors which influence its measurements,
  2. this comment to better understand the distance estimation process, and
  3. this thread to get a better understanding of the confidence value

From there, feel free to ask any follow-up questions that you may have :slight_smile: