

The Adafruit MMA8451 Accelerometer (Part ID: 2019) is a high-precision, 3-axis accelerometer designed to measure acceleration forces in three dimensions. This compact and versatile sensor is capable of detecting motion, orientation, and free-fall events, making it ideal for a wide range of applications. With its I2C interface and built-in features such as tap detection and orientation sensing, the MMA8451 is a popular choice for motion-based projects.








The Adafruit MMA8451 Accelerometer offers the following key technical details:
| Parameter | Value |
|---|---|
| Operating Voltage | 3.3V (logic level) |
| Communication Interface | I2C |
| Measurement Range | ±2g, ±4g, ±8g (configurable) |
| Resolution | 14-bit |
| Data Rate | 1.56 Hz to 800 Hz |
| Operating Temperature | -40°C to +85°C |
| Dimensions | 20mm x 20mm x 3mm |
The MMA8451 breakout board has the following pin layout:
| Pin | Name | Description |
|---|---|---|
| VIN | Power | Connect to 3.3V or 5V power supply. Includes onboard voltage regulator. |
| GND | Ground | Connect to the ground of the circuit. |
| SCL | Clock | I2C clock line. Connect to the SCL pin of the microcontroller. |
| SDA | Data | I2C data line. Connect to the SDA pin of the microcontroller. |
| INT | Interrupt | Optional interrupt pin for motion detection or other events. |
Below is an example code snippet to read acceleration data from the MMA8451 using an Arduino UNO:
#include <Wire.h>
#include <Adafruit_MMA8451.h>
#include <Adafruit_Sensor.h>
// Create an MMA8451 object
Adafruit_MMA8451 mma = Adafruit_MMA8451();
void setup() {
Serial.begin(9600);
Serial.println("Adafruit MMA8451 Accelerometer Test");
// Initialize the sensor
if (!mma.begin()) {
Serial.println("Could not find a valid MMA8451 sensor, check wiring!");
while (1);
}
Serial.println("MMA8451 found!");
// Set the measurement range to ±2g
mma.setRange(MMA8451_RANGE_2_G);
Serial.print("Range set to: ");
switch (mma.getRange()) {
case MMA8451_RANGE_2_G: Serial.println("±2g"); break;
case MMA8451_RANGE_4_G: Serial.println("±4g"); break;
case MMA8451_RANGE_8_G: Serial.println("±8g"); break;
}
}
void loop() {
// Read acceleration data
sensors_event_t event;
mma.getEvent(&event);
// Print acceleration values
Serial.print("X: "); Serial.print(event.acceleration.x); Serial.print(" m/s^2 ");
Serial.print("Y: "); Serial.print(event.acceleration.y); Serial.print(" m/s^2 ");
Serial.print("Z: "); Serial.print(event.acceleration.z); Serial.println(" m/s^2");
delay(500); // Delay for readability
}
Sensor Not Detected
Incorrect or No Data Output
Interrupt Pin Not Working
Q: Can the MMA8451 operate at 5V logic levels?
A: Yes, the breakout board includes a level shifter, allowing it to work with both 3.3V and 5V logic.
Q: How do I change the measurement range?
A: Use the setRange() function in the Adafruit MMA8451 library to configure the range to ±2g, ±4g, or ±8g.
Q: What is the default I2C address of the MMA8451?
A: The default I2C address is 0x1D. If the ADDR pin is connected to GND, the address changes to 0x1C.
Q: Can I use multiple MMA8451 sensors on the same I2C bus?
A: Yes, but you must configure each sensor with a unique I2C address by adjusting the ADDR pin.
This documentation provides a comprehensive guide to using the Adafruit MMA8451 Accelerometer effectively in your projects.