Skip to content

Software

Ping Python library (Blue Robotics sonar)

By Blue Robotics, United States (checked on github.com/bluerobotics (opens in a new tab)), from github.com/bluerobotics/ping-python (opens in a new tab)

  • Drones and boats
  • Driver or SDK
  • MIT

A Python library for talking to Blue Robotics' Ping sonar, an ultrasonic altimeter for underwater projects. It wraps the device's full set of commands in one interface.

Facts

GitHub stars
61read on 28 Nov 2026
Last update
5 Aug 2026Newest commit on master
Maintenance
Maintaineda commit in the last 12 months
Difficulty
Beginner
Hardware it needs, as the project states it
A Ping sonar device, connected through a serial port (such as /dev/ttyUSB0 or COM1) or over UDP.

Checked on GitHub on 28 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 7f27d04 (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

At a glance

What it is
  • Connects to a Ping sonar over a serial port or over UDP.
  • Reads distance measurements with a confidence value.
  • Requests profiles and other device data through get_ methods.
  • Changes device settings, such as the speed of sound, through set_ methods.
  • Ships a simplePingExample.py script that reads from a given device path or UDP address.
  • Installs with pip as bluerobotics-ping, and can be built from source.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Maintained, last commit on 5 Aug 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 7f27d04

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by Blue Robotics, at commit 7f27d04, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

ping-python

Picture: 7120633?v=3&s=200 (opens in a new tab)

Image: Travis Build Status (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)

Python library for the Ping sonar. Ping is the simple, affordable, and compact ultrasonic altimeter for any aquatic project.

This library exposes all functionality of the device, such as getting profiles, controlling parameters, switching modes, or just simply reading in the distance measurement.

Available here (opens in a new tab)

Resources
Installing
pip
$ pip install --user bluerobotics-ping --upgrade
From source
$ git clone --single-branch --branch deployment https://github.com/bluerobotics/ping-python.git
$ cd ping-python
$ python setup.py install --user

The library is ready to use: import brping. If you would like to use the command line examples (opens in a new tab) or tools (opens in a new tab) provided by this package, follow the notes in python's installing to user site (opens in a new tab) directions (eg export PATH=$PATH:~/.local/bin).

From master branch

If you wish to build from scratch the project using master branch or wip pull requests to test, you should compile and generate the definitions file:

$ git clone https://github.com/bluerobotics/ping-python.git
$ pip install jinja2
$ cd ping-python
$ git submodule update --init
$ python generate/generate-python.py --output-dir=brping
$ python setup.py install --user
$ python -c "import brping"  # It works!
Quick Start

The bluerobotics-ping package installs a simplePingExample.py script to get started. Place your device's file descriptor (eg. /dev/ttyUSB0, COM1) after the --device option.

$ simplePingExample.py --device <your-device>

It's also possible to connect via UDP server using the --udp option with IP:PORT as input (e.g 192.168.2.2:9090).

Usage

The Ping1D (opens in a new tab) class provides an easy interface to configure a Ping device and retrieve data.

A Ping1D object must be initialized with the serial device path and the baudrate.

from brping import Ping1D
myPing = Ping1D()
myPing.connect_serial("/dev/ttyUSB0", 115200)
# For UDP
# myPing.connect_udp("192.168.2.2", 9090)

Call initialize() to establish communications with the device.

if myPing.initialize() is False:
    print("Failed to initialize Ping!")
    exit(1)

Use get_<message_name> (opens in a new tab) to request data from the device. The data is returned as a dictionary with keys matching the names of the message payload fields. The messages you may request are documented in the ping-protocol (opens in a new tab).

    data = myPing.get_distance()
    if data:
        print("Distance: %s\tConfidence: %s%%" % (data["distance"], data["confidence"]))
    else:
        print("Failed to get distance data")

Use the set_* (opens in a new tab) messages (eg. set_speed_of_sound() (opens in a new tab)) to change settings on the Ping device.

    # set the speed of sound to use for distance calculations to
    # 1450000 mm/s (1450 m/s)
    myPing.set_speed_of_sound(1450000)

See the doxygen (opens in a new tab) documentation for complete API documentation.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.