Home » ESP32 and MMA7361 accelerometer example

ESP32 and MMA7361 accelerometer example

by shedboy71

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

Parts Required

Here are the parts I used

The sensor you can pick up in the $6 price range – you can connect to the sensor using a standard header the classic dupont style jumper wire.

Name Link
ESP32
MMA7361
Connecting cables

Schematic and connection

esp32 and mma7361

esp32 and mma7361

 

Code

int x;
int y;
int z;

void setup()
{
Serial.begin(9600);
}

void loop()
{
x = analogRead(A4); // read A5 input pin
y = analogRead(A3); // read A4 input pin
z = analogRead(A0); // read A3 input pin
Serial.print("X = "); // print x value
Serial.println(x);
Serial.print("Y = "); // print y value
Serial.println(y);
Serial.print("Z = "); // print z value
Serial.println(z);
delay(1000);
}

 

Output

Open the serial monitor and move the sensor around, you should see soemthing like this

X = 86
Y = 82
Z = 656
X = 68
Y = 80
Z = 640
X = 76
Y = 80
Z = 657
X = 422
Y = 96
Z = 653
X = 354
Y = 80
Z = 656
X = 1573
Y = 216
Z = 857

 

Links

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

You may also like

Leave a Comment

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.