Reader small image

You're reading from  Python Robotics Projects

Product typeBook
Published inMay 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788832922
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Prof. Diwakar Vaish
Prof. Diwakar Vaish
author image
Prof. Diwakar Vaish

Prof. Diwakar Vaish is a robotics scientist and the inventor of Manav (India's first indigenous humanoid robot), the world's first mind-controlled wheelchair, brain cloning, and the world's cheapest ventilator. He has also been a guest lecturer at over 13 IITs and various other institutions. He is the founder of A-SET Robotics, a leading robotics research company based in New Delhi.
Read more about Prof. Diwakar Vaish

Right arrow

Interfacing the inertial measurement unit


MPU 6050 is a three-axis accelerometer and three-axis gyroscope. It works on I2C, but the interesting thing about this sensor is that it has a different address for different sensors. What did you just say? Different address for different sensors. Isn't it one single sensor?

Well, yes it is, but if you see the internal construction of the sensor, then you would find that for every different axis, the data is being stored in different registers from where we can acquire the data at our disposal. Hence, if you require just the reading of x axis of accelerometer, then you can do so efficiently rather than getting a whole long string of different values. Now connecting this sensor is super easy. All you have to do is to power it up using Raspberry Pi and simply connect the I2C pins over, as shown in the following diagram: 

Once the wiring is done, go ahead and upload the following code. Once you do so, run and see what you get:

import smbus
from time import...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Python Robotics Projects
Published in: May 2018Publisher: PacktISBN-13: 9781788832922

Author (1)

author image
Prof. Diwakar Vaish

Prof. Diwakar Vaish is a robotics scientist and the inventor of Manav (India's first indigenous humanoid robot), the world's first mind-controlled wheelchair, brain cloning, and the world's cheapest ventilator. He has also been a guest lecturer at over 13 IITs and various other institutions. He is the founder of A-SET Robotics, a leading robotics research company based in New Delhi.
Read more about Prof. Diwakar Vaish