Ping360 returns None value

Hi, i have a ping360 device and i try to get some data array which i was able to get before using the recommended code below

from brping import Ping360

connect to and initialize device

p = Ping360()
p.connect_serial(‘/dev/ttyUSB0’, 115200)
print(f’{p.initialize() = ')

set some settings

print(p.set_number_of_samples(200))
print(p.set_gain_setting(1))

get some data, full revolution in steps of 10 gradians (9 degrees)

for gradians in range(0, 400, 10):
print(p.transmitAngle(gradians))

but for some reason i get None values this time can you help me with it?
P.S. I’m using jetson Nano and i got the recommended libraries downloaded.Check the usbport with lsusb to see whether my device is recognising the sonar and it is.I dont no what to do next.

This string is missing a closing curly brace, which should be a syntax error. I’d recommend posting code in code blocks in future - see the How to Use the Blue Robotics Forum post for how to do that :slight_smile:

More generally, did the initialisation work? If not, are you sure the device is actually at /dev/ttyUSB0? If initialisation fails then none of the other interactions with the sonar will work either.

Thank you for the code advice I’ll try to do that on further posts.
The code that i posted was from an earlier post and it send me through this forum by you (i suggest you correct that one as well) and i corrected that one but somehow i just forget to correct it again while i was posting this recent post. And i am positive that it is connected to /dev/ttyUSB0 i checked it with lsusb and also got some info via serial.What else can i do?

This was the code from that post, which already has the relevant closing brace. I haven’t edited that since I wrote it, so presumably it was just a copying error :slight_smile:

If you managed to get some info then perhaps the connection is fine? Again, did the initialisation work?

If the device isn’t connecting or initialising as expected, but you know that the port is correct, it may help to

  • ensure you’re using a suitable power supply for the Ping360 (11-25V, >5W capacity)
  • update to the latest version of the library
  • restart the Ping360
  • unplug and re-plug the connection to the Jetson Nano
  • restart the Jetson Nano

Hi I’d like to confirm that that the power supply should be greater than 5W? cause in ,im running into this exact same problem and the datasheet says max power supply=5W so right now i have it set to 12V 0.4 A, the output is 12V 0.08A

ive connected it to my ground station laptop

Also another thing is that im testing it from a benchtop setup, so i havent put it in water or anything, not sure if thats the problem

@tony-white @patrickelectric @EliotBR

Hi @axppxsky -
Operating it on the bench, dry, shouldn’t cause an issue.
The Ping360 should be fine at 12V with a .4 A power supply limit, unless you see the voltage dropping and that limit being hit.
I’m assuming you don’t hear the rotation start when you run the code?
Have you been able to use the unit normally with your computer and PingViewer, via the direct USB connection?
If not, it may be worth opening the unit, confirming it is dry and plugged in correctly, with the expected LED activity during use?

You’re right. I dont hear any rotation start when i run the code.
However the initialised line does return true.

No i havent been able to use pingviewer, due to system compatibility issues. but that shouldnt be the necessary right? as i could test it with the code too?

Also yes i have connected it via direct USB to the laptop.

Is opening the unit the only way? I know the Sonar hasnt been underwater for more than a year now, so i would assume it should be dry?

followup: i just tested it right now again and i confirm i hear the rotation start.

but i see all values except initialize printing none

Hi @axppxsky -
If it’s rotating ok, the data it returns could be 0 if the unit is in air?
What OS are you using that Pingviewer is not compatible with? It is the best way to confirm the hardware is functional easily, even in air.

unfortunately I only have a linux system with ubuntu 20.04 on it right now. afaik it needs >ubuntu 22.04.

i could try putting the unit in water to see if it returns any value but right now, in air, its returning none.

also as per this post Is the Ping360 sonar signal harmful to humans? - #2 by EliotBR it cannot work in air? im not sure what that means

Hi @axppxsky -
By cannot work in air, Eliot means you will not collect any data when the unit is in air, as the sound waves are ultrasonic and transitioning from the oil-filled housing to a medium of different density (air instead of water.)
I would recommend trying another computer or updating your OS to verify the hardware works. Or putting the device in water, yes. Best of luck!

I installed pingviewer and these are the readings i get when ive connected it, how can i verify if its working? it shows this screen the entire time

Hi @axppxsky -
Before you saw that screen, you should have seen a connection screen where detected Ping devices are listed. Was that the case? How is the Ping360 connected to the machine running Ping Viewer?

Yes i did see this and i clicked on it. Ping360 is connected using USB

Hi @axppxsky -
If you can hear the sonar head moving in the ping360, and it communicates as expected as you’ve shown but no data is present, your hardware may have a problem. Have you opened the unit before? I’d recommend verifying the transducer and wires on the backside of the PCB are connected with no signs of corrosion.


If everything looks nominal, we can facilitate a replacement via our support form (at the bottom of the page), which will require an order #. Thanks!

Hello,

following up to the above, ive recieved a new sonarwhich works fine, and i can see the data on pingviewer. however im trying to run this code

from brping import Ping360

# connect to and initialize device
p = Ping360()
p.connect_serial('/dev/ttyUSB0', 115200)
print(f'{p.initialize() = }')

# set some settings
print(p.set_number_of_samples(200))
print(p.set_gain_setting(1))

# get some data, full revolution in steps of 10 gradians (9 degrees)
for gradians in range(0, 400, 10):
    print(p.transmitAngle(gradians))

and it keeps printing none. please help

terminal output


ID: 2300 - device_data
Header: start_1: 66 start_2: 82 payload_length: 14 message_id: 2300 src_device_id: 2 dst_device_id: 0
Payload:
  - mode: 0
  - gain_setting: 0
  - angle: 20
  - transmit_duration: 32
  - sample_period: 80
  - transmit_frequency: 800
  - number_of_samples: 200
  - data_length: 0
  - data: []
Checksum: 791 check: 791 pass: True
None
inside this
None
inside this
None
inside this

im running code on ubuntu20.04 i dont know if thats a problem for the library

When I had a similar problem I added a statement that would request a device_data message, type 2300. eg:

p.request(2300)

For some reason calling it a second time would return values in the data field.