Coder Social home page Coder Social logo

nicogene / bno055-python-i2c Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghirlekar/bno055-python-i2c

0.0 1.0 0.0 6 KB

Pythonifying the Adafruit BNO055 library to directly use the BNO055 on the Raspberry Pi connected through I2C.

License: MIT License

Python 100.00%

bno055-python-i2c's Introduction

bno055-python-i2c

Python module for the Adafruit BNO055 on the Raspberry Pi connected through I2C.

Getting started procedure

These steps are for the a Raspberry Pi 2 running Ubuntu 14.04 (Trusty). The equivalent steps for Raspbian are well documented by Adafruit and others.

Installing Kernel support

Open this file

sudo nano /etc/modules

and add the followings lines to it

i2c-bcm2708 
i2c-dev

Install the necessary python modules

sudo apt-get install python-smbus
sudo apt-get install i2c-tools

python-smbus is the python module that we use for I2C communication on the Raspberry Pi.

Test it

Connect your i2c peripheral and run this in the shell

sudo i2cdetect -y 1

Corrupted data issues

If you notice that you have bad data (randomly fluctuating data values) coming from the device, it may be due to the I2C clock speed. First check what is the baudrate of the I2C bus using

sudo cat /sys/module/i2c-bcm2708/parameters/baudrate

I have noticed the following behaviour of I2C by varying the baudrate

Baudrate Behaviour
400KHz Bus fails to initialize, instead get IOError
100KHz Bus initializes and device communicates with ~50% data corrupted
70KHz Bus initializes and device communicates with occasional data value corrupted
50KHz Bus initializes and device communicates with no apparent data corruption

You can change the baudrate to 50KHz this way

sudo modprobe -r i2c-bcm2708
sudo modprobe i2c-bcm2708 baudrate=50000

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.