How to interface a MMA8453Q Accelerometer to an ATmega328 MCU

 

Kerry Wong from kerrywong.com shows us how to interface to a MMA8453Q cheap accelerometer using an ATmega328 MCU. There are tons of cool projects out there that are just waiting to be designed using accelerometers!

“MMA8453Q uses the I2C protocol, so I assumed that I could use the default Arduino Wire library. Unfortunately, MMA8453Q uses repeated start condition for the read operations and the default Wire library cannot handle without any modifications. As a result of this, it does not matter which register you try to read from, the returned value is always the content of the status register (at address 0×00) when using the Wire library due to the reset between the write of the register address and the subsequent read. Fortunately, there are alternative I2C libraries available for Arduino that address this issue. And the I2C library I used below is from DSSCircuits”.