Raspberry Pi and MMA7361 accelerometer example

The MMA7361L is a low power, low profile capacitive micromachined accelerometer featuring signal conditioning, a 1-pole low pass filter, temperature compensation, self test, 0g-Detect which detects linear freefall, and g-Select which allows for the selection between 2 sensitivities. Zero-g offset and sensitivity are factory set and require no external devices. The MMA7361L includes a Sleep Mode that makes it ideal for handheld battery powered electronics.

Features
• 3mm x 5mm x 1.0mm LGA-14 Package
• Low Current Consumption: 400 μA
• Sleep Mode: 3 μA
• Low Voltage Operation: 2.2 V – 3.6 V
• High Sensitivity (800 mV/g @ 1.5g)
• Selectable Sensitivity (±1.5g, ±6g)
• Fast Turn On Time (0.5 ms Enable Response Time)
• Self Test for Freefall Detect Diagnosis
• 0g-Detect for Freefall Protection
• Signal Conditioning with Low Pass Filter
• Robust Design, High Shocks Survivability
• RoHS Compliant
• Environmentally Preferred Product
• Low Cost

Typical Applications
• 3D Gaming: Tilt and Motion Sensing, Event Recorder
• HDD MP3 Player: Freefall Detection
• Laptop PC: Freefall Detection, Anti-Theft
• Cell Phone: Image Stability, Text Scroll, Motion Dialing, E-Compass
• Pedometer: Motion Sensing
• PDA: Text Scroll
• Navigation and Dead Reckoning: E-Compass Tilt Compensation
• Robotics: Motion Sensing

Schematic and connection

We use 3 channels of an MCP3008 to read the X, Y and Z value

 

Code

As stated this simply displays the ADC value from the 3 channels for the X, Y and Z outputs of the sensor

from gpiozero import MCP3008
from time import sleep
voltage = [0,0,0,0,0,0,0,0]
vref = 3.3
while True:
for x in range(0, 3):
with MCP3008(channel=x) as reading:
voltage[x] = reading.value * vref
print(x,": ", voltage[x])
sleep(0.5)

 

Output

Links

http://www.nxp.com/files/sensors/doc/data_sheet/MMA7361L.pdf

MMA7361 Angle Sensor Inclination Accelerometer Acceleration Module For Arduino