# How to get the Ping360 sensor data

**URL:** <https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636>\
**Category:** Ping Sonar Devices\
**Tags:** sonar, ping360\
**Created:** [August 1, 2022, 10:31am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636 "2022-08-01T10:31:46Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lin](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@Lin](https://discuss.bluerobotics.com/u/Lin)\
**Post date:** [August 1, 2022, 10:31am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/1 "2022-08-01T10:31:46Z")

</div>

Hello, I am using the STM32F407 development board to get the data of ping360 sonar, but I know that sonar needs to send a request from the host before returning data, but I do not know the specific request instructions, could you provide a PDF file about the communication protocol ? I just know the Request protocol version command, but I want to continue to get the ping360 sensor data, but I had not found relevant command.So I had to ask for help.

Thank you very much !

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 1, 2022, 11:06am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/2 "2022-08-01T11:06:25Z")

</div>

Hi @Lin,

As per the Ping360 section of [the Ping Protocol](https://docs.bluerobotics.com/ping-protocol/pingmessage-ping360/), you need to send `transducer` (2601) messages in order to receive `device_data` (2300) messages. There’s a proposed `auto_transmit` message that would allow requesting a scanned region between two angles, but it’s not included in the currently available Ping360 firmware.

If you haven’t already I would recommend taking a look at our [ping-cpp](https://github.com/bluerobotics/ping-cpp) library, including [the Ping360 `transducer` example](https://github.com/bluerobotics/ping-cpp/blob/master/test/test-device-ping360.cpp#L33-L50) 🙂

---

<div class="post-metadata">

**Author:** ![Lin](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@Lin](https://discuss.bluerobotics.com/u/Lin)\
**Post date:** [August 1, 2022, 12:02pm UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/4 "2022-08-01T12:02:54Z")

</div>

@EliotBR 非常感谢您的回答。但是我使用的是keil5 IDE开发，我使用的语言是C，ping-cpp库是否可以使用？

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 1, 2022, 8:16pm UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/5 "2022-08-01T20:16:52Z")

</div>

> [@Lin](#):
>
> Thanks a lot for your answer. But I use keil5 IDE to develop, the language I use is C, can the ping-cpp library be used?

Ping-cpp is a C++ library. There are a few different ways to use C++ from C, including using a C++ compiler, or potentially using a dynamic linked library (which may require modifying the ping-cpp code). It’s not something I have a lot of experience with, but it is possible at least in theory.

---

<div class="post-metadata">

**Author:** ![Lin](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@Lin](https://discuss.bluerobotics.com/u/Lin)\
**Post date:** [August 2, 2022, 1:49am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/7 "2022-08-02T01:49:48Z")

</div>

As you said, I looked at the protocol for 2601 transducer, but it’s not a hexadecimal instruction, and I want to get data by sending a hex instruction to Ping360, for example, like the get version protocol, sending 0x42, 0x52, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0xa1, 0x00

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 2, 2022, 7:12am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/8 "2022-08-02T07:12:02Z")

</div>

I find it easiest to interrogate and play by using an interactive Python terminal together with our [`ping-python`](https://github.com/bluerobotics/ping-python) library. In this case to find the hex values you’re after you could do something like

```python
>>> from brping import pingmessage, definitions
>>> m = pingmessage.PingMessage(definitions.PING360_TRANSDUCER)
>>> m.gain_setting = 0
>>> m.angle = 50
>>> m.transmit_duration = 11
>>> m.sample_period = 88
>>> m.transmit_frequency = 750
>>> m.number_of_samples = 400
>>> m.transmit = 1
>>> m.pack_msg_data()
bytearray(b'BR\x0e\x00)\n\x00\x00\x00\x002\x00\x0b\x00X\x00\xee\x02\x90\x01\x01\x00\xec\x02')
>>> m

--------------------------------------------------
ID: 2601 - transducer
Header: start_1: 66 start_2: 82 payload_length: 14 message_id: 2601 src_device_id: 0 dst_device_id: 0
Payload:
  - mode: 0
  - gain_setting: 0
  - angle: 50
  - transmit_duration: 11
  - sample_period: 88
  - transmit_frequency: 750
  - number_of_samples: 400
  - transmit: 1
  - reserved: 0
Checksum: 748 check: 748 pass: True
>>> print(*map(hex, m.msg_data))
0x42 0x52 0xe 0x0 0x29 0xa 0x0 0x0 0x0 0x0 0x32 0x0 0xb 0x0 0x58 0x0 0xee 0x2 0x90 0x1 0x1 0x0 0xec 0x2

```

which used the [ping360 control example](https://github.com/bluerobotics/ping-python/blob/78e0299f3bec1ef3feb8e35f5e1c93b21428d317/brping/ping360.py#L262) as a reference, and some of the default values from Ping Viewer for a 2m scan range (but with 400 samples, instead of the 1200 Ping Viewer uses).

---

<div class="post-metadata">

**Author:** ![Lin](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@Lin](https://discuss.bluerobotics.com/u/Lin)\
**Post date:** [September 25, 2022, 4:14pm UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/9 "2022-09-25T16:14:08Z")

</div>

I’m really sorry to bother you again. I would like to ask whether you have the sonar underwater detection data set. I would like to conduct the analysis of sonar image processing

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [September 26, 2022, 2:41am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/10 "2022-09-26T02:41:42Z")

</div>

> [@Lin](#):
>
> I’m really sorry to bother you again.

The forum is here for people to discuss marine robotics, so no need to apologise 🙂

> [@Lin](#):
>
> I would like to ask whether you have the sonar underwater detection data set. I would like to conduct the analysis of sonar image processing

I’m not certain what you’re asking for here. @btrue has graciously shared some data from his dives [here](https://discuss.bluerobotics.com/t/more-shipwrecks-at-lake-coeur-dalene/10467/5), which may be of interest, but if you’re after a dataset that includes object labels and positioning information or something then I’m not aware of any.

---

<div class="post-metadata">

**Author:** ![seaman](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@seaman](https://discuss.bluerobotics.com/u/seaman)\
**Post date:** [October 8, 2022, 1:29am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/11 "2022-10-08T01:29:58Z")

</div>

I am also using stm32 for development, but I have no response to send commands to Ping360 😟, can you please show me the code you use to send commands to Ping360?

---

<div class="post-metadata">

**Author:** ![raccoon](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@raccoon](https://discuss.bluerobotics.com/u/raccoon)\
**Post date:** [August 13, 2024, 5:55am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/12 "2024-08-13T05:55:07Z")

</div>

According to the method you provided, I successfully read the sonar data. But if I want to change the scan range to 2m, how can I modify the parameters?

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 13, 2024, 6:00am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/13 "2024-08-13T06:00:20Z")

</div>

Hi @raccoon, welcome to the forum 🙂

> [@raccoon](#):
>
> if I want to change the scan range to 2m, how can I modify the parameters?

The Ping360 doesn’t provide a direct method for setting the scan range - you’ll need to do the relevant calculations within your code.

[This thread](https://discuss.bluerobotics.com/t/changing-the-ping360-scan-distance/11762) was about that process, and should cover the relevant details. Feel free to follow up after going through that if some aspects aren’t clear 🙂

---

<div class="post-metadata">

**Author:** ![raccoon](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@raccoon](https://discuss.bluerobotics.com/u/raccoon)\
**Post date:** [August 20, 2024, 9:26am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/14 "2024-08-20T09:26:50Z")

</div>

After reading posts, I directly adjusted the values of “sample\_period” and “number\_of\_samples” based on the actual working conditions to change the scanning range. By using a while loop to read data from 0 to 360 degrees, I found that it takes 6-7 minutes to complete the reading, which is much longer than the time Ping Viewer software takes to scan a full circle. I am analyzing whether the software uses the auto\_transmit command protocol.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 20, 2024, 12:06pm UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/15 "2024-08-20T12:06:48Z")

</div>

> [@raccoon](#):
>
> By using a while loop to read data from 0 to 360 degrees, I found that it takes 6-7 minutes to complete the reading, which is much longer than the time Ping Viewer software takes to scan a full circle.

There’s some discussion on Python scanning speeds [here](https://discuss.bluerobotics.com/t/ping-360-time-info-split-image/8328/21), but it should definitely be much faster than that unless you’re either setting a variable incorrectly (e.g. if your scale is off by an order of magnitude or something), or having communication issues that mean several of your requests are timing out.

Have you checked whether you’re actually getting meaningful data from your requests?

> [@raccoon](#):
>
> I am analyzing whether the software uses the auto\_transmit command protocol.

Ping360’s `auto_*` functionality [is not yet meaningfully publicly available](https://discuss.bluerobotics.com/t/ping360-auto-transmit-update/16187), so if you’re trying to make use of it then you’re likely just getting a bunch of timeouts.

Ping Viewer is able to make use of it if the device supports it, but it’s highly unlikely your Ping360 has a supporting firmware installed, because we haven’t yet provided a Ping Viewer release that allows flashing on a new firmware.

---

<div class="post-metadata">

**Author:** ![raccoon](https://avatars.discourse-cdn.com/v4/letter/r/f19dbf/32.png) [@raccoon](https://discuss.bluerobotics.com/u/raccoon)\
**Post date:** [October 21, 2024, 12:59am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/16 "2024-10-21T00:59:19Z")

</div>

Thank you for your reply; it has been very helpful to me. I would also like to ask whether the Ping Viewer software has the functionality to retain historical scan data. If so, where can this data be accessed? We hope to integrate it into a sonar-equipped robotic system for display, and we plan to use historical data for testing first. Once again, thank you for your help.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [July 21, 2025, 2:26am UTC](https://discuss.bluerobotics.com/t/how-to-get-the-ping360-sensor-data/12636/17 "2025-07-21T02:26:26Z")

</div>

Hi @raccoon,

I’ve just seen this never got responded to - I hope you managed to resolve it at the time.

> [@raccoon](#):
>
> I would also like to ask whether the Ping Viewer software has the functionality to retain historical scan data.

Yes, it automatically records the data it receives, and [allows it to be replayed](https://docs.bluerobotics.com/ping-viewer/replay-data/).

> [@raccoon](#):
>
> We hope to integrate it into a sonar-equipped robotic system for display, and we plan to use historical data for testing first.

In case it is relevant, there is also [example code](https://github.com/bluerobotics/ping-viewer/tree/master/examples) for programmatically decoding the log files (and encoding your own / modified ones) 🙂

> [@EliotBR](#):
>
> we haven’t yet provided a Ping Viewer release that allows flashing on a new firmware.

Following up on this, [this is now available](https://discuss.bluerobotics.com/t/ping360-firmware-update/21023) (including the new firmware with the `auto_*` functionality!).
