Home        Store        Learn        Blog

Connecting Ping360 Sonar With Jetson Nano

I have a Jetson Nano and a Ping360 Sonar but i don’t know how to connect them and getting data out of Ping360. Could you hrlp me please?

Hi @Ahmedakif, welcome to the forum :slight_smile:

How are you wanting to use the Ping360? A relatively standard setup for us is to connect the Ping360 via USB to our Raspberry Pi companion computer, which runs some software that allows it to act as a communications bridge to the topside computer running our Ping Viewer application. Are you

  1. planning a similar setup, but with your Jetson Nano in the place of our companion computer (e.g. Ping360 <-> Jetson Nano <-> topside computer), in which case you’ll need to set up an appropriate communications bridge, or are you
  2. wanting to interact with the Ping360 using code on your Jetson Nano (in which case you’re likely interested in our Ping-Python or Ping-C++ library implementations of the Ping Protocol), or
  3. is your Jetson Nano perhaps being used as a topside computer, with a screen attached, in which case you might want to build Ping Viewer

The second option :smiley: Thank you.

Ok, we’re currently in the process of putting together some more concrete examples of that, because the existing ones are a bit difficult to find/navigate.

I’ll write instructions for Python, because it’s what I’m more familiar with and is a bit easier to get started in.

To start with you’ll need to have Python 3 installed, along with pip. I haven’t used a Jetson Nano before, but it seems to run linux, so you should be able to

  1. Open a Terminal window
  2. Update all existing packages
    sudo apt-get update && sudo apt-get -y upgrade
  3. Install Python 3 and pip using
    sudo apt-get install -y python3 python3-pip
  4. Install the latest version of our ping-python library
    pip3 install --user bluerobotics-ping --upgrade

Then you can run python using the python3 command in your terminal, and you can run python files using python3 my_file.py.

Using the adaptor that comes with the Ping360 you can connect it up to a USB port in your Jetson Nano, and supply power to the Ping360 power wires with a suitable battery or power supply:

Assuming it’s the only thing plugged in to a USB port, you should be able to run the following Python code to interact with it

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))

The methods I was using there are defined here, but note that the auto-transmit functionality isn’t available in the Ping360 firmware yet. For some more information on processing the data, see this post :slight_smile:

If there’s anything in particular that isn’t clear feel free to post follow-ups - hopefully some more complete examples will be available soon.