Wemos and MMA7455L example

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.

Features
• Digital Output (I2C/SPI)
• 3mm x 5mm x 1mm LGA-14 Package
• 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
• Sensitivity (64 LSB/g @ 2g and @ 8g in 10-Bit Mode)
• Selectable Sensitivity (±2g, ±4g, ±8g) for 8-bit Mode

here is a typical module which you can buy

mma7455_module

Connection and Layout

 

  • GND – To Wemos GND
  • VCC – To Wemos 3V3
  • SCL – To Wemos D2
  • SDA – To Wemos D1

Code

You will need a copy of the MMA_7455 library to make your life easier. Download and copy to your Arduino -> Libraries folder

#include <Wire.h> //Include the Wire library
#include <MMA_7455.h> //Include the MMA_7455 library
 
MMA_7455 mySensor = MMA_7455();
 
char xVal, yVal, zVal;
 
void setup()
{
Serial.begin(9600);
delay(500);
Serial.println("MMA7455 Accelerometer Test.");
mySensor.initSensitivity(2);
}
 
void loop()
{
xVal = mySensor.readAxis('x'); //Read the 'x' Axis
yVal = mySensor.readAxis('y'); //Read the 'y' Axis
zVal = mySensor.readAxis('z'); //Read the 'z' Axis
Serial.print("X = ");
Serial.print(xVal, DEC);
Serial.print(" Y = ");
Serial.print(yVal, DEC);
Serial.print(" Z = ");
Serial.println(zVal, DEC);
delay(1000);
}

 

Testing

Open the serial monitor and move the module about

X = 193 Y = 227 Z = 240
X = 226 Y = 222 Z = 9
X = 0 Y = 207 Z = 54
X = 246 Y = 154 Z = 31
X = 185 Y = 246 Z = 49
X = 175 Y = 252 Z = 31
X = 179 Y = 229 Z = 3
X = 190 Y = 220 Z = 249

 

Links

MMA7455 Accelerometer Sensor Module AVR ARM MCU

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*