View: 5366|Reply: 0

Run MPU9150 MotionSensorExample on Orange Pi One

[Copy link]

2

threads

3

posts

22

credits

Novice

Rank: 1

credits
22
Published in 2019-10-14 17:33:02 | Show all floors |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 thread contains more resources

You need to Log in to download or view,No account?    Register

x
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list