Skip to main content

Crownstone UART

Official Python lib for Crownstone: "Crownstone Unified System Bridge", or Crownstone USB implementation.

This works on all platforms and requires a Crownstone USB to work.

Install guide

This module is written in Python 3 and needs Python 3.7 or higher. The reason for this is that most of the asynchronous processes use the embedded asyncio core library.

If you want to use python virtual environments, take a look at the README_VENV

You can install the package by pip:

pip3 install crownstone-uart

If you prefer the cutting edge (which may not always work!) or want to work on the library itself, use the setuptools: python3 setup.py install

Requirements for the Crownstone USB

OS X

OS X requires installation of the SiliconLabs driver: https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

Ubuntu

In order to use serial without root access, you should be in the dialout group.

You can check if you're in the group:

$ groups

To add yourself:

$ sudo adduser $USER dialout

You may need to logout and login again.

Raspbian

Similar to Ubuntu.

Arch Linux

To use serial in Arch Linux, add yourself to the uucp group.

To add yourself to the group:

$ sudo gpasswd -a $USER uucp

Make sure to logout and login again to register the group change.

Example

An example is provided in the root of this repository.

Prerequisites

  • First use the phone app to setup your Crownstones and the Crownstone USB.
  • Make sure you update the Crownstones' firmware to at least 5.4.0.
  • Find out what port to use (e.g. COM1, /dev/ttyUSB0, or /dev/tty.SLAB_USBtoUART), use this to initialize the library.
  • Have this library installed.

Find the IDs of your Crownstones

Firstly run the example script that simply lists the IDs of the Crownstones.:

$ python3 ./examples/discovery_example.py

Once some IDs are printed, use one of them for the next example. This can take a while because Crownstones, if not switched, only broadcast their state every 60 seconds.

Switch a Crownstone, and show power usage.

Edit the file switch_example.py:

  • Set targetCrownstoneId to a Crownstone ID that was found in the previous example.

Run the file:

$ python3 ./examples/switch_example.py

API documentation

The API documentation can be found here.

License

MIT

Metadata

Release files for crownstone-uart 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crownstone-uart 2.1.0
File Size Uploaded
crownstone-uart-2.1.0.tar.gz 24.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crownstone-uart 2.1.0
File Interpreter ABI Platform
crownstone_uart-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 65.6 kB

Release files / crownstone-uart-2.1.0.tar.gz

Download URL crownstone-uart-2.1.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96e297428c4678c867888d06d9c7fa13a7cb1c0ac2bee9ed4f8250c96e4d65b5
BLAKE2b-256 checksum
How to use checksums
b91848601f62dff46f372dfdf96cb1cb614003e30db570c09d87f69604b4fb81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

Release files / crownstone_uart-2.1.0-py3-none-any.whl

Download URL crownstone_uart-2.1.0-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b984189ff5835362312f747e481479b3362f39f2aa08e0d862ebed66d0d9a520
BLAKE2b-256 checksum
How to use checksums
90464225b7322aa3e1af012e98e4af8c79dc224e9bcc920028af156363d7ffc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

Release history Release notifications | RSS feed

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

This release

2.1.0 This release

2 release files

2.0.0

4 release files

1.0.1

2 release files

1.0.0

4 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

4 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

4 release files

0.7.3

2 release files

0.7.2

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page