Best Answer sfugarino , 27 February 2014 - 08:35 AM
I believe it actually works now. Feel free to use it anyway you like.
Sam Fugarino
Go to the full post
  | ||||||||||||||
Adafruit 9 DOF IMU
Started by
sfugarino
, Feb 25 2014 08:31 PM
Best Answer sfugarino , 27 February 2014 - 08:35 AM
I believe it actually works now. Feel free to use it anyway you like.
10 replies to this topic
#1Posted 25 February 2014 - 08:31 PM Trying to get this IMU to work. Don't know what I'm doing wrong. My code is attached. Do I need to use pull up resistors? Attached Files#2Posted 26 February 2014 - 08:43 AM Adafruit9DOF.zip 100.14KB 0 downloads Upgraded to 4.3.1 and the I2C bus started working. The data returned is not formatted right. I keep switching the bytes around but haven't gotten the right results yet. Trying to use the BitConverter. Attached Files#3Posted 26 February 2014 - 08:58 AM
Hi sfugarino,
Does the IMU have pull-up resistors on-board? If not, you will need to add them. [They should also be sized for 3.3V I2C, etc. 2.2K is a pretty good value.] Chris #4Posted 26 February 2014 - 10:41 AM Chris, I'm not sure. The data sheet on the accelerometer/magnetometer says pull-ups are required. I'm going to add them just in case. I'm not sure if that's the problem I'm having now. I was thinking my algorithm to convert the 2 byte values returned by the sensor into floats is wrong. #5Posted 26 February 2014 - 10:46 AM
Hi sfugarino,
If you're getting data back...the pull-ups are probably fine. Please be aware that secondary pull-ups require using a different ohm value (since multiple pull-up resistors will merge their strength).
Chris
#6Posted 26 February 2014 - 12:20 PM Add pull ups, but not right yet. I'm getting the right amount of data back, it just is not right, or rather my conversion isn't correct. I did find I missed some scaling factors on the final results, but it'd still didn't give me the results I expect. Attached Files#7Posted 26 February 2014 - 10:08 PM Accelerometer data is correct or rather matches the data I get from my Arduino. Missed a right shift of the bits. Compass and gyro still need work. Attached Files#8Posted 26 February 2014 - 10:16 PM Oh, forgot to mention I had to set the sda line high to get the i2c bus to work. That came from another post in this forum. OutputPort pin = new OutputPort(Pins.GPIO_PIN_SDA, true); pin.Write(false); pin.Dispose(); #9Posted 27 February 2014 - 08:35 AM Best Answer
I believe it actually works now. Feel free to use it anyway you like.
Sam Fugarino Attached Files#10Posted 01 March 2014 - 10:08 PM
Hate to beat a dead dog, but that last code still had issues. The calculation in this update use code pilfered from other post on this site. I haven't credit any one including myself, but will do so in the near future. If anyone wants to chime in, your feedback would be appreciated.
Adafruit9DOF.zip 121.97KB 0 downloads #11Posted 05 March 2014 - 05:41 PM
I found out what was throwing me for a loop. When you read the magnetometer data with the compass configured as it is in the Adafruit library, the hi bits are read first and the z axis information proceeds the y axis. I'm pretty confident about my code now. It needs some refactoring and the sensor code should be moved to a library.
Let's move on to a Kalman filter. Attached Files0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||