Read data from ping1d with FT232RL UART - USB, but it not work

i have BUART, but i want connect and read data from ping1d with other - FT232RL UART-USB, because i scare BUART broken, i oder it from foreign, take a long time.
I connect pin true, but it no have data in Hercules SETUP utility

Hi @XuanTrieu, welcome to the forum :slight_smile:

I’m not sure what you mean by this - I don’t know what “Hercules SETUP utility” is, or why it would be relevant.
Have you tried seeing if the sonar connects as expected to our Ping Viewer software?

If that’s not working, can you provide some more information about your setup (e.g. a photo / detailed description) and how you’re trying to communicate with the sonar?

1 Like

Hercules SETUP utility is useful serial port terminal (RS-485 or RS-232 terminal).
Hercules SETUP utility | HW-group.com
data sensor transmit will display in Hercules.

My setup

Ok, but the sensor communicates via ping protocol, and it only sends data when it’s asked to. If you’re connecting to the port with Hercules but not sending any messages then the sensor will just sit there waiting for requests.

A few questions/suggestions:

  1. Does the device get detected when you open Ping Viewer, or does it just search for devices and not find any?
  2. Is it showing up at a port in Windows Device Manager?
  3. Your power wiring looks correct, but the data wires aren’t clear - if the device is showing up at a COM port but not connecting properly then it might be worth swapping RX and TX to in case they’re the wrong way around.

how can i sent mensenger? i read ping1d messages but i don’t understand it.

  1. yes, but it look like not true. Must Ping1d be in water and depth min is 50 cm?

  2. it is Serial port USB(COM8)

  3. I think i connect true.

It’s possible to use in air, but you’ll need to turn on debug mode to be able to set the speed of sound to an appropriate value for air (outside of debug mode Ping Viewer restricts the speed of sound to values that make sense for water).

In water, yes. In air the minimum detectable distance is more like 35 cm.

The technical details outline the supported serial baud rates, the message protocol, the message subsets from the protocol, and link the three different code library implementations that allow you to construct, send, and receive Ping messages:

If you’re wanting to send messages directly (via your own program instead of Ping Viewer) then I’d recommend using one of the provided libraries :slight_smile:

Given it’s working in Ping Viewer, the connections should be fine :slight_smile:

after 1 day read document, i understand like this. is it correct.
Q1. i don’t see requesr_id and check_sum in code. it not necesscary?
Q2. Can i send message “0x42, 0x52, 0x02, 0x00, 0x04BB, 0x00, 0x00” to ping1d through the Hercules.

As per the protocol specification

In general, a checksum is a verification metric, used to help ensure a message has arrived without errors/modification.

Similarly to the documented negotiation example, if you wish to request a ping1d_distance_simple (1211) message from the sonar, you can send a general_request (6) to do so. The components for that would be

Value (HEX) Value (decimal) Type Name Notes Send Bytes
0x42 66 u8 start1 ASCII ‘B’ 0x42
0x52 82 u8 start2 ASCII ‘R’ 0x52
0x0002 2 u16 payload_length 0x02, 0x00
0x0006 6 u16 message_id general_request 0x06, 0x00
0x00 0 u8 src_device_id 0x00
0x00 0 u8 dst_device_id 0x00
0x04BB 1211 u8[2] payload requested_id 0xBB 0x04
0x015B 347 u16 checksum 0x5B 0x01

Note that the checksum is the sum of individual bytes, so for example 0x04BB becomes 0x04 + 0xBB = 0xBF.

Noting the little-endian format, the correct bytes sequence for that request message is
0x42, 0x52, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, 0xBB, 0x04, 0x5B, 0x01


when i try it in vitualBox ubuntu 20.04, i search USB i connect to Ping1D, but it not working.

Is your virtual machine set up to connect to USB devices?

When I run Parallels on my Mac I generally need to select which machine gets access to each device that I plug in, and also need to give explicit permission for the virtual machine to access external hardware/ports. I’m unsure whether there are similar constraints/requirements on Windows with VirtualBox.

i try write program in orangpi in armbian with NANO GNU:

from brping import Ping1D
p = Ping1D()
p.connect_serial(' /dev/ttyUSB0', 115200)
data = p.get_distance()
print("Distance: %s\tConfidence: %s%%" % (data["distance"], data["confidence"]))

when i try python3 pingtest.py , it error not in connect_serial(). i run with example of ping–python, it run good.

There shouldn’t be a space in the '/dev/ttyUSB0' string.

If that’s not the cause of the issue, please specify the error message that you’re getting :slight_smile: