<div align="center">
<a href="https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect">
<img
src="https://gloimg.gbtcdn.com/soa/gb/2015/201509/goods_img_big-v1/1442961797146-P-3106869.jpg"
alt="MPU-9250"
height="150"
align="center"
/>
</a>
<br />
ð Use [donations](#Sponsors-and-Donations) to help support your projects! ð
</div>
<br />
[![Project Status: Active â The project has reached a stable, usable state and is being actively developed.](https://img.shields.io/badge/Project_Status-Active-green?style=flat-square&color=success)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=flat-square&color=success)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect)
[![License: CC BY-NC-ND 4.0](https://img.shields.io/badge/License-CC%20BY--NC--ND%204.0-lightgrey.svg?style=flat-square&color=success)](LICENSE.txt)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QYV4NEUSVWZCY&source=url)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square)
![pypi](https://img.shields.io/pypi/v/pybadges.svg?style=flat-square)
![versions](https://img.shields.io/pypi/pyversions/pybadges.svg?style=flat-square)
[![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.3960441-blue?style=flat-square)](https://doi.org/10.5281/zenodo.3960441)
[![GitHub issues](https://img.shields.io/github/issues/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/issues)
[![GitHub forks](https://img.shields.io/github/forks/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/network/members)
[![GitHub stars](https://img.shields.io/github/stars/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/stargazers)
[![GitHub watchers](https://img.shields.io/github/watchers/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/watchers)
[![GitHub contributors](https://img.shields.io/github/contributors/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect?style=flat-square&color=success)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/graphs/contributors/)
[![HitCount](http://hits.dwyl.io/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/badges.svg)](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/mpu9250_jmdev?style=flat-square&color=success)](https://pypi.org/project/mpu9250_jmdev)
# MPU-9250 (MPU-6500 + AK8963) I2C Driver in Python
**MPU-9250** is a multi-chip module (MCM) consisting of two dies integrated into a single QFN package. One die the **MPU-6500** houses the 3-Axis gyroscope, the 3-Axis accelerometer and temperature sensor. The other die houses the **AK8963** 3-Axis magnetometer. Hence, the MPU-9250 is a 9-axis MotionTracking device that combines a 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and a Digital Motion Processor⢠(DMP). The hardware documentation for MPU-9250 can be found at [Product Specification](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/blob/master/doc/MPU-9250%20Product%20Specification%20Revision%201.1.pdf) and [Register Map and Descriptions](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/blob/master/doc/MPU-9250%20Register%20Map%20and%20Descriptions%20Revision%201.6.pdf).
## Table of Contents
- [Instalation](#Instalation)
- [How To Use](#How-To-Use)
- [Getting Data](#Getting-Data)
- [Calibrating Sensors](#Calibrating-Sensors)
- [Reset Registers](#Reset-Registers)
- [Final Notes](#Final-Notes)
- [Sponsors and Donations](#Sponsors-and-Donations)
- [What We're Working on Now](#What-We're-Working-on-Now)
- [How To Cite](#How-To-Cite)
- [License](#License)
## Instalation
To install via pip use:
```bash
pip install mpu9250-jmdev
```
To use the package for development purposes use:
```bash
git clone https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect.git MPU9250
cd MPU9250
pip install -e .
pip install -r requirements.txt
```
### Known Issues
> :information_source: Notice that this package requires Python 3.6 or higher.
> :warning: If you have both Python 2 and 3 installed on your machine, use ```pip3``` to install and ```python3``` to run instead.
> :warning: If you run your python source-code with ```sudo```, remember to use ```sudo``` with ```pip install``` commands as well.
> :warning: If you get zero values and the message **Using Fake SMBus**, the **smbus2** requirement has not been installed correctly. Try installing manually with the command ```pip install -r requirements.txt``` or ```python -mpip install smbus2```.
> :exclamation: Any other problem or questions, **open an issue in this repository [clicking here](https://github.com/Intelligent-Vehicle-Perception/MPU-9250-Sensors-Data-Collect/issues), do not send me an e-mail!**
## How To Use
With I2C Bus, you can use the MPU-9250 in two ways: simple mode or advanced mode. The example source-codes are in **examples** folder.
### Simple Mode - Master Only
In this mode, the MPU-9250 connects directly to Raspberry GPIOs. There are two physical addresses available for the MPU-9250, being 0x68 and 0x69. Therefore, on each I2C Bus you can have up to two MPU-9250 connected. The connection between GPIOs and MPU-9250 is as follows:
| MPU9250 | Raspberry | Note |
|---|---|---|
| VDD | 3.3V | On some models of the MPU-9250 5V can be used. |
| AD0 | 3.3V | If used, the MPU-9250's address is changed to 0x69. Otherwise, the address is 0x68. |
| GND | GND | |
| SDA | SDA | |
| SCL | SCL | |
Below simple code to test the execution with never ending loop:
```python
import time
from mpu9250_jmdev.registers import *
from mpu9250_jmdev.mpu_9250 import MPU9250
mpu = MPU9250(
address_ak=AK8963_ADDRESS,
address_mpu_master=MPU9050_ADDRESS_68, # In 0x68 Address
address_mpu_slave=None,
bus=1,
gfs=GFS_1000,
afs=AFS_8G,
mfs=AK8963_BIT_16,
mode=AK8963_MODE_C100HZ)
mpu.configure() # Apply the settings to the registers.
while True:
print("|.....MPU9250 in 0x68 Address.....|")
print("Accelerometer", mpu.readAccelerometerMaster())
print("Gyroscope", mpu.readGyroscopeMaster())
print("Magnetometer", mpu.readMagnetometerMaster())
print("Temperature", mpu.readTemperatureMaster())
print("\n")
time.sleep(1)
```
### Advanced Mode - Master-Slave
If you want to have more than two MPU-9250 on one I2C Bus, you must use Master-Slave mode. In this case, first configure the MPU-9250 according to the previous section, they will be used as Master. To configure the MPU-9250 Slaves, connect as follows:
| MPU9250 Slave | MPU9250 Master | Raspberry PI | Note |
|---|---|---|---|
| VDD | | 3.3V | On some models of the MPU-9250 5V can be used. |
| AD0 | | 3.3V | If used, the MPU-9250's address is changed to 0x69. Otherwise, the address is 0x68. |
| GND | | GND | |
| SDA | EDA | |
| SCL | ECL | |
This way you will have an MPU-9250 Master connecting SDA and SLC directly to the GPIO in Raspberry PI, and an MPU-9250 Slave connecting SDA and SLC to the EDA and ELC in MPU-9250 Master.
Below simple code to test the execution with never ending loop:
```python
import time
from mpu9250_jmdev.registers import *
from mpu9250_jmdev.mpu_9250 i
没有合适的资源?快使用搜索试试~ 我知道了~
MPU9250 (MPU6500 + AK8963) 用于 Raspbery PI 的 Python 中的 I2C 驱动程序
共21个文件
py:10个
pdf:2个
json:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 148 浏览量
2022-07-14
14:49:17
上传
评论 1
收藏 1.57MB ZIP 举报
温馨提示
python Python 中的 MPU-9250 (MPU-6500 + AK8963) I2C 驱动程序 MPU-9250是一种多芯片模块 (MCM),由集成到单个 QFN 封装中的两个裸片组成。MPU-6500的一个芯片包含 3 轴陀螺仪、3 轴加速度计和温度传感器。另一个模具装有AK8963 3 轴磁力计。因此,MPU-9250 是一款 9 轴运动跟踪设备,它结合了 3 轴陀螺仪、3 轴加速度计、3 轴磁力计和数字运动处理器 (DMP)。MPU-9250 的硬件文档可以在Product Specification and Register Map and Descriptions找到。 更多详情、使用方法,请下载后细读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
MPU-9250-Sensors-Data-Collect-master.zip (21个子文件)
MPU-9250-Sensors-Data-Collect-master
.github
FUNDING.yml 153B
ISSUE_TEMPLATE
bug_report.md 834B
_config.yml 73B
requirements.txt 13B
doc
MPU-9250 Register Map and Descriptions Revision 1.6.pdf 955KB
MPU-9250 Product Specification Revision 1.1.pdf 940KB
examples
basic-usage
master-only-mode.py 3KB
master-slave-mode.py 3KB
thread-sampling
sampling.py 3KB
sensors.py 5KB
run.py 2KB
setup.py 968B
.gitignore 48B
mpu9250_jmdev
registers.py 7KB
fake_smbus.py 807B
__init__.py 0B
mpu_9250.py 37KB
README.md 15KB
LICENSE.txt 19KB
.vscode
settings.json 294B
extensions.json 95B
共 21 条
- 1
资源评论
- Noneting2024-03-17资源内容详尽,对我有使用价值,谢谢资源主的分享。
快撑死的鱼
- 粉丝: 2w+
- 资源: 9148
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功