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

MMA8452Q triple axis accelerometer code example

accelerometer i2c mma8452Q example

  • Please log in to reply
No replies to this topic

#1 o0Higgy0o

o0Higgy0o

    New Member

  • Members
  • Pip
  • 3 posts

Posted 18 April 2014 - 11:35 AM

Hi,

 

I have recently been playing around with a MMA8452Q triple axis accelerometer from proto-pic. My basic premise was to set up 2 accelerometers and get them to send an interrupt when the acceleration was greater than 1g in any axis. I wanted to set them side-by-side and measure the time difference between the interrupts on an oscilloscope for a common 1g impulse shock, in my case I hoped it was very small. I managed to set the devices up on a 800Hz sample rate, 1g transient shock threshold and no debounce counter. Unfortunately for my application the time difference between the interrupts from both devices for the same impulse shock was too long (up to 1.5ms) so I need to rethink my original idea. Attached is my code as an example start for anyone else wishing to setup the accelerometers. Bare in mind my code is quick and dirty and worked for me but hopefully helpful. I used a Netduino Plus 2 on framework 4.3

 

For reference to understand the MMA8452Q useful Freescale info can be found:

 

Thank you to Stefan Thoolen for the netmftoolbox. I used the MultiI2C class and extended it slightly to help reading and writing to individual registers. I used individual toolbox cs files rather than referencing the whole toolbox hence the inclusion of Tools.cs and MultiI2C.cs .

 

Enjoy,

 

o0Higgy0o

Attached Files







Also tagged with one or more of these keywords: accelerometer, i2c, mma8452Q, example

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.