Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Python library for Pozyx devices

Project Description

A Python library to work with the pozyx indoor positioning system over USB.

This library works with both Python 2 and 3.

Prerequisites

  • Download and install Python. On Windows, make your life easier and make sure Python is in your PATH. A recommended install is therefore the Anaconda Suite by Continuum. If you’re going to follow the tutorials, you’ll need to install Python 3 for the python-osc support.
  • Install the PySerial package. If you have pip installed, you can do this by writing pip install pyserial in your command line interface (cmd on Windows).
  • Windows only install ST’s virtual COM driver. After running this installer, please run the correct driver package for your system, located in “C:\Program Files (x86)\STMicroelectronics\Software\Virtual comport driver”. Choose Win7 if you run Windows 7 or older. Choose Win8 for Windows 8 or newer. Run “dpinst_amd64.exe” on a 64-bit system, “dpinst_x86.exe”on a 32-bit system.

Installing this package

Just run pip install pypozyx

PyPozyx is now installed. To check whether it is: if you followed all the steps correctly, and know which port your Pozyx is on, the following code should work:

from pypozyx import PozyxSerial
port = 'COMX' # on UNIX systems this will be '/dev/ttyACMX'
p = PozyxSerial(port)

If your port is correct and the serial connection to the Pozyx isn’t used by other software, this will run without any errors.

But! How do I know what port my Pozyx is on?

  • You can see the COM ports on your system easily using Python with: python -c "from pypozyx import *;list_serial_ports()"
  • NEW You can quickly find whether there’s a recognized Pozyx device using: python -c "from pypozyx import *;print(get_first_pozyx_serial_port())"

Documentation and examples

You can find the Python tutorials on our site. You probably got here from the getting started page

Documentation can be found here.

  • This was originally a port of the Pozyx’s Arduino library, so most of the Arduino Library Documentation is transformable to this. The major difference is that you don’t ever again need to pass along the length of the data you’re reading/writing. This is taken care of by the library through the Data and SingleRegister classes like so:
whoami = SingleRegister()
pozyx.regRead(POZYX_WHO_AM_I, whoami) # which is pozyx.getWhoAmI(whoami)
  • SingleRegister(value=0, size=1, signed=1) is basically an instance Data([0], ‘B’), which functions as a single uint8_t. If you want to make your custom data, for a single register you can adapt the size and signed parameters, and for larger data structures you can use your own data formats. Data([0]*3, ‘BHI’), for example, creates a structure of 1 uint8_t, uint16_t and uint32_t. Writing and reading data using this example as a parameter will automatically read/write 7 bytes worth of data. To specify your own data formats, check the struct package documentation for Python 3 or Python 2.
  • A more pythonic library would be nice, but isn’t in the works.

More usage examples can be found in the useful and tutorials folders of the repository.

Release history Release notifications

This version
History Node

1.1.7

History Node

1.1.6

History Node

1.1.5

History Node

1.1.4

History Node

1.1.3

History Node

1.1.2

History Node

1.0.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pypozyx-1.1.7-py2.py3-none-any.whl (44.7 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page