Skip to main content

Python driver for the Calypso UP10 anemometer

Project description

https://github.com/daq-tools/calypso-anemometer/workflows/Tests/badge.svg Test suite code coverage https://img.shields.io/pypi/pyversions/calypso-anemometer.svg https://img.shields.io/pypi/status/calypso-anemometer.svg https://img.shields.io/pypi/v/calypso-anemometer.svg https://pepy.tech/badge/calypso-anemometer/month https://img.shields.io/pypi/l/calypso-anemometer.svg

Python driver for the Calypso UP10 anemometer

About

Hardware device

The Calypso UP10 ultrasonic portable solar wind meter is a Bluetooth, solar-powered, pocket-sized, ultrasonic anemometer. No power cords or data wires needed.

Resources:

Software library

The device driver library is written in Python and based on the Bleak library, the Bluetooth Low Energy platform Agnostic Klient for Python. It was verified to work well on a Raspberry Pi / OpenPlotter installation and a macOS workstation.

Features

  • Run device discovery

  • Acquire device status and readings (one shot)

  • Acquire device readings continuously (subscribe/notify)

  • Set device data rate

  • Telemetry: NMEA-0183 and SignalK over UDP

Setup

pip install calypso-anemometer

To install the latest development version from the repository, invoke:

pip install git+https://github.com/daq-tools/calypso-anemometer

Synopsis

Usage

Discover the ULTRASONIC BLE device and run a conversation on it:

# Get device information.
calypso-anemometer info

# Get device reading.
calypso-anemometer read

# Get device readings, continuously at 4 Hz (default).
calypso-anemometer read --subscribe

# Get device readings, continuously at 1 Hz.
calypso-anemometer read --subscribe --rate=hz_1

# Continuously receive device readings and submit them in SignalK Delta Format via UDP.
# See section "SignalK telemetry" about how to create an UDP receiver
# data connection in your Signal K server beforehand.
calypso-anemometer read --subscribe --rate=hz_1 --target=udp+signalk+delta://openplotter.local:4123

# Continuously receive device readings and submit them in NMEA-0183 format via UDP broadcast.
# See section "NMEA-0183 telemetry" about how to create an UDP receiver data connection
# in OpenCPN beforehand. If you don't have _any_ networking configured, just use `localhost`.
calypso-anemometer read --subscribe --rate=hz_1 --target=udp+broadcast+nmea0183://255.255.255.255:10110

If you already discovered your device and know its address, use the CALYPSO_ADDRESS environment variable to skip discovery, saving a few cycles:

# Linux
export CALYPSO_ADDRESS=F8:C7:2C:EC:13:D0

# macOS
export CALYPSO_ADDRESS=0C3E4A46-BFCB-52E5-BC57-DE1D60C3A2B2

# Activate discovery again.
unset CALYPSO_ADDRESS

Development

# Set device data rate to one of HZ_1, HZ_4, or HZ_8.
# Note: Works only for the upcoming conversation. Will be back at HZ_4 afterwards.
calypso-anemometer set-option --rate=hz_1

# Set device mode to one of SLEEP, LOW_POWER, or NORMAL.
# Note: Does not work, the setting is read-only.
calypso-anemometer set-option --mode=normal

# Explore all services and characteristics. Useful for debugging purposes.
calypso-anemometer explore

Pre-flight checks

You will need a working Bluetooth/BLE stack. This section outlines a few commands to discover an ULTRASONIC device nearby.

Enumerate Bluetooth adapters:

hcitool dev
Devices:
    hci1    E4:5F:01:BB:71:FC
    hci0    00:1A:7D:DA:71:15

lsusb
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Display information about two Bluetooth adapters:

hciconfig hci0 name
hci0:       Type: Primary  Bus: USB
    BD Address: 00:1A:7D:DA:71:15  ACL MTU: 310:10  SCO MTU: 64:8
    Name: 'openplotter #1'

hciconfig hci1 name
hci1:   Type: Primary  Bus: UART
    BD Address: E4:5F:01:BB:71:FC  ACL MTU: 1021:8  SCO MTU: 64:1
    Name: 'openplotter'

Run a BLE device scan on a specific adapter:

sudo hcitool -i hci0 lescan

Run a BLE device scan using Bleak:

bleak-lescan -i hci0
bleak-lescan -i hci1

SignalK telemetry

The program can optionally submit telemetry data in SignalK Delta Format via UDP. To make a SignalK server receive the data, create an “UDP receiver” data connection on the Server » Data Connections dialog of your OpenPlotter instance.

https://user-images.githubusercontent.com/453543/178626096-04fcc1b6-dbfc-4317-815d-4f733fee4b67.png

SignalK UDP receiver on port 4123.

NMEA-0183 telemetry

The program can optionally submit telemetry data in NMEA-0183 format via UDP. To make OpenCPN receive the data, create a corresponding data connection like outlined in this screenshot.

https://user-images.githubusercontent.com/453543/179367303-14e1b958-16ae-4bf8-b077-4f96d929e8b0.png

NMEA-0183 UDP receiver on port 10110.

Development

git clone https://github.com/daq-tools/calypso-anemometer
cd calypso-anemometer
python3 -m venv .venv
source .venv/bin/activate
pip install --editable=.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calypso-anemometer-0.3.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

calypso_anemometer-0.3.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file calypso-anemometer-0.3.0.tar.gz.

File metadata

  • Download URL: calypso-anemometer-0.3.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for calypso-anemometer-0.3.0.tar.gz
Algorithm Hash digest
SHA256 071bdd29335853d2db6985172b6ca027f141fb330860864e5e969126c4f2b197
MD5 d662ac7a4c53f4d368e098be1be1225f
BLAKE2b-256 4f8070fb9dbb299009e42db897d00b4115562496d463ede81ad53a8550ed9634

See more details on using hashes here.

Provenance

File details

Details for the file calypso_anemometer-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for calypso_anemometer-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a74d6c69ee71b83fae3da6e3abd9da91f9255b2849ce8b335e7454a8635e19e
MD5 f4c9be0809767f7bf5017bb0d136977a
BLAKE2b-256 19d37863990ae662658f8701aaaabe8b2e0b4b7fd13cfe47bc537b1409240b01

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page