Giter Site home page Giter Site logo

tforgaard / bmi160-i2c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lefuturiste/bmi160-i2c

0.0 0.0 0.0 91 KB

WIP lib to communicate with the BMI160 accel/gyro sensor with the raspberry pi i2c in python

License: MIT License

Python 100.00%

bmi160-i2c's Introduction

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.

Credits & Related links

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!

bmi160-i2c's People

Contributors

lefuturiste avatar larsll avatar tforgaard avatar mreihs avatar robofoundry avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.