Interpreting data from transmitAngle()

I’ve recently begun working with the Ping360 and have run into some problem interpreting the data it is returning. The way I am currently getting the data is by calling the transmitAngle() and saving the return of it to a value and then printing out that value to view it. My code is the following:

 p = Ping360()
 p.connect_serial("COM3", 115200)

 p.initialize()
 p.set_transmit_frequency(800)
 p.set_sample_period(80)
 p.set_number_of_samples(10)
 p.set_gain_setting(128)
 p.set_mode(0)
 p.set_transmit_duration(32)

 for x in range(400):
      d = p.transmitAngle(x)
      print(d)

The values that are printed out are in hexadecimal, my question is what exactly do these values mean? Are they the distance to an object/obstacle at a certain angle? I can’t seem to find anything on it on the fourms or documentation, though I could have missed something. Any help is greatly appreciated.

Hi @rsloven, welcome to the forum :slight_smile:

Feel free to follow up if there are additional aspects you want clarification on :slight_smile:

You specify the desired angle in your transmitAngle method call - it returns a profile from that angle[1], of echo response strength data


  1. Note that the sonar doesn’t know about its own or the vehicle’s orientation, so the angle is a body-frame orientation of the sonar transducer relative to the sonar device (e.g. x gradians from the penetrator), rather than a global / earth-frame / compass-aligned one. ↩︎

I think I understand it now. Essentially the data returned is the intensity of the signal returned, as such the higher the intensity the more likely there is an object/obstacle at that distance. Each index in the array of the data returned (this conversion needs to be done manually, at least for turning them into integers) with each index representing the intensity for a certain length. This length is determined by the function.

def meters_per_sample(ping_message, v_sound=1480):
    ##the 12.5e-9 is the sample_period time divided by two
    return v_sound * ping_message.sample_period * 12.5e-9

Essentially should I want to increase the distance that the Ping360 will pulse to I need to increase either the sample_period or increase the number of samples I take. With the exact distance I pulse being calculated as:

v_sound * ping_message.sample_period * 12.5e-9 * ping_message.number_of_samples

I do have some questions though, how exactly is the sonar scanning behind objects for lack of a better phrase. So if the sonar pings and returns a value of 255 at like 1 meter then how is it able to get a data value at that angle past the 1 meter distance? Shouldn’t the object present at 1 meter block the sonar from sensing anything past it?

Another question I have is related to the Ping360’s behavior in a glass tank, I seem to be getting weird values returned (often being very close to 250) throughout the returned array. Does glass interact weirdly with the Ping360 or is that the tank might just be too small and is messing with the data the Ping360 collects (signals bouncing back too earlier/interfering with other signals, ectera.)?

Thank you for your previous response I found it very helpful!

1 Like

Hi @rsloven -
An object will indeed block sound from passing beyond it - some may find a way around via reflections.
A small tank is likely causing your issues, not necessarily the glass- when used in large tanks the Ping360 will show the outline of the tank as seen from above!

1 Like

Correct :slight_smile:

It’s worth noting that:

  1. the sonar operates in 3D space
  2. the beams it transmits spread out to cover an area
    • rather than being a point, like a laser
  3. a wave changing medium typically involves a combination of reflection and transmittance
  4. the sensor only measures vibration intensity
    • it doesn’t actually know where the signal came from (although the transducer does have physical properties that make it much more likely for a strong response to be caused by a signal from directly in front of it)
    • more advanced sensors may transmit a more complex signal (e.g. a CHIRP / frequency sweep), which can help to filter out some “false” responses

Accordingly, while acoustic shadowing is definitely a phenomenon that needs to be considered, there are several ways that a sonar can respond to signals that are (or seem to be) past the first object in its beam path.

Breaking those effects down:

  1. As @tony-white mentioned, the transmitted beam can reflect around the first object, and literally echo back from other objects directly behind it
    • This may make those objects seem further away in the profile data than they really are, because the beam path to get to them is not straight
  2. A nearby object could reflect the part of the beam, and the rest could continue travelling and reflect off an object from farther away
  3. If the object is thin and does not have a large density difference from the water then much of the transmitted pulse may pass through, with only a small amount reflected back in the first echo
  4. If the sonar is in a confined space (like a small tank), the reflected signal may bounce back around/past the sonar and end up reflecting back off the original object again as a repeated echo, which the sonar just registers as a weaker response from further away
    • The pink signal is measured weakly because the sonar is most sensitive to signals from in front
    • The purple signal is weaker than the original orange echo, because the wave spreads out as it travels further, and some of the energy also gets absorbed as it travels

Glad to hear it! :slight_smile: