Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Adafruit 9 DOF IMU


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


  • Please log in to reply
10 replies to this topic

#1 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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



#2 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 26 February 2014 - 08:43 AM

Attached File  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



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 February 2014 - 08:58 AM

Hi sfugarino,

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?

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

#4 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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.



#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 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

#6 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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



#7 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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



#8 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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();



#9 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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



#10 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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.

Attached File  Adafruit9DOF.zip   121.97KB   0 downloads

#11 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 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 Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.