The MMA7455L is a Digital Output (I2C/SPI), low power, low profile capacitive micromachined accelerometer featuring signal conditioning, a low pass filter, temperature compensation, self-test, configurable to detect 0g through interrupt pins (INT1 or INT2), and pulse detect for quick motion detection. 0g offset and sensitivity are factory set and require no external devices.
The 0g offset can be customer calibrated using assigned 0g registers and g-Select which allows for command selection for 3 acceleration ranges (2g/4g/8g). The MMA7455L includes a Standby Mode that makes it ideal for handheld battery powered electronics.
Self-Test for Z-Axis
Low Voltage Operation: 2.4 V – 3.6 V
User Assigned Registers for Offset Calibration
Programmable Threshold Interrupt Output
Level Detection for Motion Recognition (Shock, Vibration, Freefall)
Pulse Detection for Single or Double Pulse Recognition
Selectable Sensitivity (±2g, ±4g, ±8g) for 8-bit Mode
The MMA7455 accelerometer is a sensor that can measure acceleration in three axes. This sensor is commonly available as a breakout board.
It requires VCC, GND , SCA and SCL to be connected.
Vcc – Raspberry Pi 3.3v
Gnd – Raspberry Pi Gnd
SDA – Raspberry Pi Pin 3 (SDA1)
SCL – Raspberry Pi Pin 5 (SCL1)
Save this as MMA7455.py
import smbus import time bus = smbus.SMBus(1) # MMA7455L address, 0x1D bus.write_byte_data(0x1D, 0x16, 0x01) time.sleep(0.5) # Read 6 bytes data back from 0x00 data=bus.read_i2c_block_data(0x1D, 0x00, 6) # Convert the data to 10-bits xAcc = (data & 0x03) * 256 + data  if xAcc > 511 : xAcc -= 1024 yAcc = (data & 0x03) * 256 + data  if yAcc > 511 : yAcc -= 1024 zAcc = (data & 0x03) * 256 + data  if zAcc > 511 : zAcc -= 1024 # Output data print "Acceleration in X-Axis : %d" %xAcc print "Acceleration in Y-Axis : %d" %yAcc print "Acceleration in Z-Axis : %d" %zAcc
Run this from the command line – sudo python MMA7455.py