Find here working Arduino sketch for MPU-6000 / ArduIMU+ V3 using Digital Motion Processor (DMP)

Maybe you are interested in my Arduino sketch specifically written for the MPU-6000 on the ArduIMU+ V3 board from 3DRobotics Inc. It is attached to this post (v053_MPU6000_DMP6_SPI.ino). Please read the header carefully because it contains a lot of useful information.My sketch is based on Jeff Rowberg's MPU6050_DMP6_I2C sketch which makes use of the Digital Motion Processor to obtain the quaternion values from the MPU, and from there derives roll, pitch and yaw without almost any drift. My sketch is a translation of Jeff's sketch and also uses the DMP, but makes use of the SPI protocol i.s.o. the I2C protocol for transferring data (on ArduIMU+ V3 "MPU-6000 uses SPI for max performance"). My sketch works perfectly with the Teapot demo also from Jeff, I only corrected the axis ((Teapot_ArduIMU_V3.pde - attached). Please let me know if you like it. It took me a little over 100 hours to write and test it.

Views: 23027

Attachments:

Reply to This

Replies to This Discussion

I recomend the MPXV 5004DP, unless you are going to achieve negative speeds... because these sensors are analog and are very sensitive to  Vin the scale of the 5004 is a bit better. I am currently using it and it works great. 

My intent was not to calculate airspeed from the accelerometer values (by integration), but only the roll / pitch / yaw angles. For a more direct measure of airspeed, using a pressure sensor like the MPXV 5004DP indeed may be a more accurate way than integration of the acceleration. But that is beside this discussion topic.

Yes, the "Brushlessgimbal IMU Kit" used for the "Martinez brushless gimbal" is the MPU-6050 from Invensense on a break-out board. The MPU-6050 is identical to the MPU-6000 on the ArduIMU+ V3 but can only be operated using the I2C data protocol. The "Brushlessgimbal IMU Kit" connects to the "Brushlessgimbal Controller AIO Kit" which has an Atmel processor ('Arduino') on it.

You can do the same by buying the MPU-6050 break-out board, and connect it to for instance an Arduino Nano board. Jeff Rowberg's sketch (from which I derived mine) works perfectly well then, because it is specifically written for I2C use. More info: read the header of my sketch.

By the way, calculating yaw from the standard accelerometer values using trigonometry can not be done for yaw (see info in my sketch), that's why my sketch (as derived from Jeff Rowberg's) uses the Digital Motion Processor (DMP) to obtain the quaternion w, x, y and z values to calculate a stable yaw angle from.

That's great! Maybe you can add the OUTPUT_BINARY lines of code here, so others can add it to the sketch as well if they like. Thanks.

OK, here's what I did.  I added a #define up where the other output options are.

#define OUTPUT_BINARY

and then I inserted the code that's included here in the area where the other output code is in the sketch. 

I attached it as a .h file because I used Atmel Studio to copy what I did.  It isnt really a .h type file and I dont want to confuse myself or anyone else. 

Attachments:

And I made one more change by modifying the OUTPUT_READABLE_ROLLPITCHYAW.  This allows you to connect to ArduIMU Test.  The attachment shows what I added.

Attachments:

@Søren Kuula : The BLG IMU is a rip off from multiwii.

For MPU i would also look here https://github.com/Pansenti/MPU9150Lib

and read this: http://aeroquad.com/showthread.php?6013-MPU-6000-DMP-license-finall...!&p=54047&viewfull=1#post54047

Hi Crash,

OK I didn't know that, never looked at Wii. But anyway they found a good source to rip from..

Martin - yaw from accelerometer? Hmm how does that work?

Regards

Soren

MultiWii uses the sensors in the Wii Remote, the Wii Motion Plus and the Nunchuk. These accelerometers and gyroscopes (ADXL330, IDG-600, X3500W and LIS3L02AL) all output analog voltages, unlike the MPU-6000 on the ArduIMU+ V3 which uses a digital databus protocol (SPI) to output the accelerometer and gyroscope measurement values. The "Brushlessgimbal IMU Kit" (BLG) uses the MPU-6050 which is identical to the MPU-6000 apart from the used databus protocol (I2C). The main part of my Arduino sketch which I derived from Jeff Rowberg's version only configures and initializes the DMP of the MPU-6000 for use.Why would the BLG IMU be a rip off from MultiWii?

Thanks for the links to the MPU-9150 code and the interesting discussion about the DMP in the MPU-6000. And for those interested: MPU-9150 break-out boards are readily available. The MPU-9150 combines the MPU-6050 and the AK8975 3-axis digital compass in one package.

Your information is way outdated (1-2 years old?). The days of the orig wii sensors are LONG GONE. Browse the mwii github (imu.c and sensors.c) and compare the imu part to BLG. I know they use parts of the I2clib but only as atavism. It is basically just used to read out MPU6050 / 6000 gyro and acc rawdata, like the multiwii does. They used the DMP and now stay away from it and use the simple multiwii imu part. Thats why it is a rip off and not a self developed IMU part.

And thats why it is a complete waste of the hardware to use a 1:1 copy in this project: http://www.diydrones.com/profiles/blogs/vr-gimbal-2-0-3-axis-32bit-... (like they actually do)

I see. Then maybe MultiWii should have changed its name also a few years ago (without Wii in it)... ;-) Evidently, I was confused by the name versus the contents.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service