Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 965|Reply: 0

Run MPU9150 MotionSensorExample on Orange Pi One

[Copy link]

2

Threads

3

Posts

22

Credits

Novice

Rank: 1

Credits
22
Post time 2019-10-14 17:33:02 | Show all posts |Read mode
Edited by doctor1003148 at 2019-10-15 13:46

Hi, guys!
I tried to run MotionSensorExample on Orange Pi One, and have got some outputs.
Originally MotionSensorExample is a sample program for testing your MPU Motion Sensor with Rasperry Pi.  I successfully ran it on Orange Pi, and  someone might think this useful.

My Orange Pi One runs Armbian_5.90_Orangepione_Ubuntu_bionic_next_4.19.57
The MPU sensor I use is MPU9150. I connect it to my orange pi one's i2c0 using only four wires,which are 5V->pin 2, SDA->pin 3, SCL->pin 5, and GND->pin 6.  (my mpu9150 module uses 5V power supply)

1.First install i2c-tools to see i2c devices and for debugging purpose.
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install i2c-tools

2.Run armbian-config to enable i2c device,which is armbian-config  ----> system  ---->  hardware  ---->  i2c0     use space key to select, and save, and reboot your Orange Pi One.

By the way, if the mpu sensor was connected the way like SDA->pin 3  and  SCL->pin 5, i2c0 should be open. I tried to open i2c1 to see if I can skip step 5 below or not. It turned out that the mpu9150 was no longer detected.


3.use i2cdetect to locate the MPU sensor.
    sudo i2cdetect -y 0




4.Clone MotionSensorExample code from github
    git clone https://github.com/rpicopter/MotionSensorExample.git

5. cd to MotionSensorExample/libs/I2Cdev and modify all the three '/dev/i2c-1'   to    '/dev/i2c-0'  in file I2Cdev.c  (I think maybe because of that the raspberry pi use i2c-1 as default)
If you missed this step, you may get a "Failed to write device" error.


6. cd to MotionSensorExample/MotionSensor and modify '-DMPU6050'    to     '-DMPU9150'   in Makefile   (As in the README file, you can use MPU6050/MPU6500/MPU9150/MPU9250)
If you missed this step, you may get another "No such device or address"error.

7.cd back to MotionSensorExample and run 'make' , and you should see a new executable file named 'mstest' , and you can then run it.



This post contains more resources

You have to Login for download or view attachment(s). No Account? Register

x
You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2020-7-8 10:27 GMT+8 , Processed in 0.027680 second(s), 24 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list