Jump to content
43oh

Help! MMA8452Q accelerometer with Launchpad


Recommended Posts

1) if the accelerometer is on a breakout then you can commit to that device and get started.  If it's just a 20 pin QFN probably I recommend something on a breakout board while you experiment.

 

2) I recommend CDE's I2C explorer found on this forum as a starting point.  Get that going on your microcontroller and serial terminal.  It would help to find out whether you will be using a 2452 or earlier 2231.

 

I disabled all internal pullups within the code and made a UART change for it to work with the 2452.

 

In general you will only need 4 wires to connect a device:

 

- most 3.3 LDO voltage regulators provided on the cheap breakout boards seem to be happy with the 3.6v the launchpad provides

- ground

- SDA and SCL ( I pull these high with 4K7 ohm) SDA 1.7 SCL 1.6

 

other broken out lines are generally used for addressing/chip select (which I do do) or slave initiated interrupts which will likely be of high interest in your freefall detection.

 

In general, many devices will have:

 

- a sleep/wake register you will write to to begin taking readings

- a series of data registers you can read at your master initiated leisure

 

- you will want to find the register/s to set a freefall interrupt on a pin if that suits.

 

Often there is so much confusion on the internet that the datasheet is the simplest first place to look, but being lazy I usually look for an arduino sample and look for:

 

- slave address

- initiation register and value ( usually to wake from sleep mode )

- data register

 

(*devices will vary but accelerometers seem pretty similar for that at least)

 

I will then use the I2C explorer with the search 's' command to confirm it is communicating.  It will display the 2 cooked slave addresses. Familiarize yourself with the I2C Slave address shifting semantics for R and W. [ SLAVE ADDRESS 7 bits (left shifted 1 bit)  ][ W:0 R:1 1 bit ].  Different modules and/or software will address this single byte differently.

 

After that I would study the datasheet and find out range setting / power modes etc and, in the case of the Invensense MPU6050, lament why oh why such power must be deliberately obfuscated and withheld from the hobbyist community.   I should be preaching read the datasheet thoroughly first, but in reality once your I2C is up and running it is simple enough that you go straight to raw data reading and then backwards to modes etc from there.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...