login|Register
Forum > Armbian
Post|
看9860|回2|Favorite
doctor1003148 看全部
2019-10-14 17:33:02
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.



attachment: 您需要登录才可以下载或查看附件。没有账号?Register
rosydam 看全部
2025-2-26 16:12:03
Escape Road - The sound design of the game is top-notch, with roaring engines, screeching tires, and blaring sirens creating an intense and immersive chase atmosphere.
NadiaEira 看全部
2025-11-26 17:44:55
From snowy peaks to icy caves, slope rider dares you to navigate the course and test your limits. This endless sledding adventure is all about precision, timing, and excitement, and your ride ends! Are you ready to conquer the slopes?

OrangePi En

Powered by Discuz! X3.4

homepage|Simple edition|Touch edition|PC