Skip to main content

BMI160-i2c

I2C library to use the Inertial Mesurment Unit BMI160. Heavily inspired on @serioeseGmbH code serioeseGmbH/BMI160, in fact I just adapted his code.

This library was tested successfully on a Raspberry Pi 3 B

Installation

The package is available on pypi.org.

You can install this package using this command

python3 -m pip install BMI160-i2c

This library require smbus

Install smbus2 using the following command:

python3 -m pip install smbus2

Usage

Wire the breakout board with these lines : GND, 3V3, SAO (to GND), SDA, SCL

Make sure that the device is available at 0x68 or 0x69 i2c address by running this command:

i2cdetect -y 1

Example : A little python script to fetch all 6 values from the sensor :

from time import sleep
from BMI160_i2c import Driver

print('Trying to initialize the sensor...')
sensor = Driver(0x68) # change address if needed
print('Initialization done')

while True:
  data = sensor.getMotion6()
  # fetch all gyro and acclerometer values
  print({
    'gx': data[0],
    'gy': data[1],
    'gz': data[2],
    'ax': data[3],
    'ay': data[4],
    'az': data[5]
  })
  sleep(0.1)

Documentation

There is so many method available to do whatever you want to do with a sensor of this kind.

Look at all the methods available here.

Contributions

Feel free to open a issue or a pull request I will be happy to answer any questions or help you with this library.

You can also use these alternative methods to contact me:

Maintenance

  • Increment the version used in setup.py
  • Build the package: python3 setup.py sdist bdist_wheel
  • Publish the package: python3 -m twine upload dist/*
  • Enter __token__ for the username
  • Enter pypi-{....} for the password
  • And tada!

Metadata

Release files for BMI160-i2c 0.6

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

Source distribution (sdist)

Source distribution for BMI160-i2c 0.6
File Size Uploaded Provenance Actions
BMI160_i2c-0.6.tar.gz 16.5 kB Without provenance Details for BMI160_i2c-0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for BMI160-i2c 0.6
File Interpreter ABI Platform Actions
BMI160_i2c-0.6-py3-none-any.whl Python 3 none any Details for BMI160_i2c-0.6-py3-none-any.whl

Total release size: 33.7 kB

Release files / BMI160_i2c-0.6.tar.gz

Download URL BMI160_i2c-0.6.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
076e1a8c23f22fc1714cea0a0e1fe4d5feafc9210e442b09f98b1bc257d8a2c4
BLAKE2b-256 checksum
How to use checksums
bf52084b730200309d7f2d141b1c23122d21463e0e67a978ed18c990129540e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / BMI160_i2c-0.6-py3-none-any.whl

Download URL BMI160_i2c-0.6-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dc3331a9921f1241a0e6b390dbc4d91046aa14bcf5c48f34ce63a359a778701
BLAKE2b-256 checksum
How to use checksums
693ef23bb307632a72163554cc2c2786251be01b01e0a4f162d4dffb581233c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for BMI160-i2c 0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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