Skip to main content

Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.

Project description

CreaTeBME

Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.

Installation

To install the latest stable version simply run pip install CreaTeBME.

Usage

Easy Wireless

To connect to the sensors, a simple call of the connect() method can be used. This method will return a list of ImuSensor objects.

from CreaTeBME import connect

sensors = connect()

The take_mesurement() method of the ImuSensor objects can in return be used to read out the gyroscope and accelerometer data.

while True:
    for sensor in sensors:
        measurement = sensor.take_measurement()
        # Do something with the data

This will return a list of the accelerometer and gyroscope data in the form [acc_x, acc_y, acc_z, gyr_x, gyr_y, gyr_z]. The accelerometer values are given in g (9.81 m/s^2) and the gyroscope values in deg/s.

Manual Wired and Wireless

Another way of connecting IMU sensors is to manually create ImuSensor objects. This can be done by specifying the mode and the address of the sensor.

from CreaTeBME.ImuSensor import ImuSensor, MODE_WIRED, MODE_WIRELESS

sensor_wired = ImuSensor(MODE_WIRED, 'COM4')
sensor_wireless = ImuSensor(MODE_WIRELESS, '01:23:45:67:89:AB')

For a wired sensor, the address is the serial port on the computer, on Windows this will be COM followed by a number. For a wired sensor, the bluetooth address is used, this will look like 01:23:45:67:89:AB.

Common errors

Windows installation

On Windows, during the installation a compile error for pybluez will likely come up. To solve this, install the pybluez 0.22 wheel before installing this package. A PyBluez 0.22 wheel for Python 3.8 can be found here. Download it to your current directory and install it using pip install PyBluez-0.22-cp38-cp38-win_amd64.whl.

Running in PyCharm

When using this package and running your program in PyCharm, an error complaining about CMD not being found can show. To solve this, run py xxx.py in the terminal, where xxx is the file name of the python file you want to run.

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

CreaTeBME-0.0.5.tar.gz (16.7 kB view hashes)

Uploaded Source

Built Distribution

CreaTeBME-0.0.5-py3-none-any.whl (16.9 kB view hashes)

Uploaded Python 3

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