Hello!
I am trying to see if anyone is familiar with the lovely MPU6050 3-axis 16-bit accelerometer and gyroscope (real 16-bit, not 13-bit hiding in 16bits :):)). A cool guy, Jeff Rowberg, made some wonderful demo code to get up and running on the Arduino UNO, and I struggled for 16+ hours to get it running on the Baby-O. What can I say, I’m a newb, I didn’t even know how to properly program the baby orangutan.
[size=85](for reference, the key is to change the IC2Dev library to account CPU_FREQ = “20…” instead of “16…” AND (this stumped me for ages) change where it says TWBR = “16000 / khz” to “CPU_FREQ/ TWI” because for some reason at one point it properly defines TWBR to be related to CPU_FREQ, but then in another point it redefines TWBR to be based on some static integers. The second TWBR would mess up I2C communication.)[/size]
I’m asking if anyone is familiar with the MPU6050 because I’m trying to optimize the settings for my tilt-sensing application.
The questions I have, which relate to Jeff Rowberg’s code: i2cdevlib.com/devices/mpu6050#source,
which according to the 'net is fairly typically used if anyone wants to run this sensor with the DMP calculations.
- When I do the demo code for pitch/roll/yaw, I notice the values are only given to 2 decimal digits. I’m a bit confused, because I don’t see them being truncated anywhere. I only need them to two decimal points, but i was hoping to ensure it wasn’t that I was killing the data early. 2) I want to have my Accelerometer set to +/-2g. All my trawling has taught me that these are the relevant things:
define MPU6050_ACCEL_FS_2 0x00 //I think this sets the range to +/– 2g.
define MPU6050_ACONFIG_AFS_SEL_BIT 0 //I changed this from 4, to 0, because I think 0 corresponds with +/– 2g
define MPU6050_ACONFIG_AFS_SEL_LENGTH 5 //This was 2, but I don’t understand what it does to the code, except that it doesn’t seem to harm output. ???
So I’m not totally clear when SEL_LENGTH does, and I don’t understand if it’s AFS_SEL_BIT that determines the range, or FS_2, or both. It seems there are also some things that I could optimize to reduce the sampling rate, since I don’t need more than a sample a second, but it might be beyond me.
So i thought among the curious Pololu people, someone had tried running the MPU6050, or at least would want to know the quick dirty details to use the baby-O in the Arduino IDE along with the MPU6050