GY-45 MMA8452 3-Axis Accelerator Module

SKU: FA2155
Operating Voltage (VCC)

3V – 5V DC

Core Supply Voltage (VDD)

1.95V – 3.6V

Interface Voltage (VDDIO)

1.6V – 3.6V

Current Consumption (Active)

6 µA – 165 µA (depends on ODR)

Measurement Ranges (Selectable)

±2g, ±4g, ±8g

Resolution

12-bit (default) / 8-bit (optional)

Output Data Rate (ODR) Range

1.56 Hz – 800 Hz

Noise Density

99 µg/√Hz

Communication Protocol

I2C (up to 2.25 MHz with 4.7kΩ pull-ups)

I2C Address (Selectable)

0x1C (SA0=GND) or 0x1D (SA0=VDDIO)

Interrupt Pins

2 programmable interrupt pins (INT1, INT2)

Operating Temperature

-40°C to +85°C

Module Dimensions

Approx. 14.5mm × 20.5mm

Mounting Holes

3mm diameter, 15mm pitch

Weight

Approx. 2g – 3g

Product Overview

The GY-45 MMA8452 3-Axis Accelerometer Module is a high-precision, low-power digital motion sensor based on the NXP MMA8452Q integrated circuit. This sensor is used to measure acceleration, tilt, vibration, and motion detection along the X, Y, and Z axes. It is widely used in robotics, IoT devices, wearable electronics, and gesture recognition applications.

The MMA8452Q is a smart, low-power, three-axis, capacitive micromachined accelerometer with 12 bits of resolution. It includes embedded functions with flexible user-programmable options, allowing configuration of up to two interrupt pins, which reduces the load on the host processor by eliminating the need for continuous polling.

The GY-45 module is designed for easy integration with 3V to 5V systems, making it compatible with both Arduino (5V) and ESP32/ESP8266 (3.3V) without additional level shifting. With selectable ±2g/±4g/±8g measurement ranges and output data rates from 1.56 Hz to 800 Hz, this sensor is suitable for a wide range of applications, from static tilt measurement to high-frequency vibration monitoring.

Key Features

  • High-Precision 12-bit Digital Output: Provides 12-bit resolution for accurate acceleration measurement, configurable to 8-bit for faster readings

  • Selectable Measurement Ranges: User-selectable full-scale ranges of ±2g, ±4g, and ±8g for flexible sensitivity adjustment

  • Low Power Consumption: Operating current ranges from 6 µA to 165 µA, making it ideal for battery-powered applications

  • I2C Digital Interface: Simple 2-wire communication (SDA, SCL) with configurable I2C address (0x1C or 0x1D), allowing multiple sensors on the same bus

  • Embedded Motion Detection Features:

    • Freefall or motion detection

    • Pulse (tap/double-tap) detection

    • Transient (jolt) detection

  • Orientation Detection: Portrait/landscape detection with programmable hysteresis for stable switching

  • Automatic ODR Adjustment: Auto-wake and return-to-sleep functionality automatically changes output data rate to save power

  • High-Pass Filtered Data: Real-time output of high-pass filtered data removes DC offset for accurate dynamic motion measurement

  • Wide Voltage Compatibility: Operates on 3V to 5V DC power supply; I/O voltage range from 1.6V to 3.6V

Technical Specifications

Parameter Operating Value
Operating Voltage (VCC) 3V – 5V DC
Core Supply Voltage (VDD) 1.95V – 3.6V
Interface Voltage (VDDIO) 1.6V – 3.6V
Current Consumption (Active) 6 µA – 165 µA (depends on ODR)
Measurement Ranges (Selectable) ±2g, ±4g, ±8g
Resolution 12-bit (default) / 8-bit (optional)
Output Data Rate (ODR) Range 1.56 Hz – 800 Hz
Noise Density 99 µg/√Hz
Communication Protocol I2C (up to 2.25 MHz with 4.7kΩ pull-ups)
I2C Address (Selectable) 0x1C (SA0=GND) or 0x1D (SA0=VDDIO)
Interrupt Pins 2 programmable interrupt pins (INT1, INT2)
Operating Temperature -40°C to +85°C
Module Dimensions Approx. 14.5mm × 20.5mm
Mounting Holes 3mm diameter, 15mm pitch
Weight Approx. 2g – 3g

Pinout & Connection Guide

The GY-45 MMA8452 module features a compact 5-pin or 6-pin configuration for easy wiring.

Pin Definitions

Pin Label Function Description
VCC VCC / 3-5V Power Supply Connect to 3.3V or 5V DC power source
GND GND Ground Common ground connection
SCL SCL / SCK I2C Clock Line Connect to SCL pin of microcontroller
SDA SDA / SDI I2C Data Line Connect to SDA pin of microcontroller
SA0 SA0 / ADDR I2C Address Select GND = 0x1C, VCC = 0x1D
INT1/INT2 INT1 / INT2 Interrupt Outputs Optional; connect to digital input pins

I2C Pin Mapping for Common Development Boards

Development Board SDA Pin SCL Pin Power Note
Arduino Uno / Nano A4 (SDA) A5 (SCL) VCC to 5V
Arduino Mega 2560 20 (SDA) 21 (SCL) VCC to 5V
ESP32 GPIO21 GPIO22 VCC to 3.3V
ESP8266 (NodeMCU) GPIO4 (D2) GPIO5 (D1) VCC to 3.3V
Raspberry Pi GPIO2 (Pin 3) GPIO3 (Pin 5) VCC to 3.3V

Wiring Diagram (Arduino Uno)

text
GY-45 Module          →    Arduino Uno
─────────────────────────────────────────
VCC                   →    5V
GND                   →    GND
SCL                   →    A5 (SCL)
SDA                   →    A4 (SDA)
SA0                   →    GND (for address 0x1C)
INT1 (optional)       →    D2 (or any digital pin)

Usage Guide

Software Setup (Arduino IDE)

Step 1: Install Required Libraries

The MMA8452 is supported by several libraries:

Option A: “MMA8452” Library – Simple and easy to use

  1. Open Arduino IDE → Sketch → Include Library → Manage Libraries

  2. Search for “MMA8452”

  3. Install the library by Adafruit or other trusted developer

Option B: “SparkFun MMA8452Q” Library – Comprehensive features

Step 2: Basic Test Sketch

cpp
/*
  GY-45 MMA8452 Accelerometer Basic Read Example
*/

#include <Wire.h>
#include <Adafruit_MMA8452.h>

Adafruit_MMA8452 mma = Adafruit_MMA8452();

void setup() {
  Serial.begin(9600);
  
  if (!mma.begin()) {
    Serial.println("Could not find MMA8452 sensor. Check wiring!");
    while (1);
  }
  
  Serial.println("GY-45 MMA8452 Sensor Ready");
  
  // Set measurement range (±2g, ±4g, ±8g)
  mma.setRange(MMA8452_RANGE_2_G);
  
  Serial.print("Range set to: ");
  Serial.print(2 << mma.getRange());
  Serial.println("g");
}

void loop() {
  // Read accelerometer data
  mma.read();
  
  Serial.print("X: ");
  Serial.print(mma.x);
  Serial.print("  Y: ");
  Serial.print(mma.y);
  Serial.print("  Z: ");
  Serial.print(mma.z);
  Serial.println();
  
  // Convert to g-force (raw data / 4096 for ±2g range)
  float xg = mma.x / 4096.0;
  float yg = mma.y / 4096.0;
  float zg = mma.z / 4096.0;
  
  Serial.print("Force (g): ");
  Serial.print(xg);
  Serial.print(", ");
  Serial.print(yg);
  Serial.print(", ");
  Serial.println(zg);
  
  // Calculate tilt angles
  float pitch = atan2(-xg, sqrt(yg * yg + zg * zg)) * 180 / PI;
  float roll = atan2(yg, zg) * 180 / PI;
  
  Serial.print("Pitch: ");
  Serial.print(pitch);
  Serial.print("°, Roll: ");
  Serial.println(roll);
  Serial.println();
  
  delay(500);
}

Understanding the Data Output

The MMA8452Q outputs 12-bit data (range: -2048 to 2047). The sensitivity depends on the selected range:

Range Sensitivity (LSB/g)
±2g 1024 LSB/g
±4g 512 LSB/g
±8g 256 LSB/g

Example: For ±2g range, an X-axis reading of 512 means 0.5g of acceleration.

Typical Orientation Readings (Stationary)

Orientation X (g) Y (g) Z (g)
Flat (face up) 0 0 +1
Flat (face down) 0 0 -1
Tilted on side (X down) +1 0 0
Tilted on side (X up) -1 0 0
Vertical (Y down) 0 +1 0

Configuring Motion Detection

cpp
/*
  MMA8452 Motion Detection Example
*/

#include <Wire.h>
#include <Adafruit_MMA8452.h>

Adafruit_MMA8452 mma = Adafruit_MMA8452();

void setup() {
  Serial.begin(9600);
  
  if (!mma.begin()) {
    Serial.println("Sensor not found");
    while (1);
  }
  
  // Configure for freefall detection
  mma.writeRegister(MMA8452_FF_MT_CFG, 0x38);  // Enable freefall on all axes
  mma.writeRegister(MMA8452_FF_MT_THS, 0x0A);  // Set threshold
  mma.writeRegister(MMA8452_FF_MT_COUNT, 0x05); // Set debounce count
  
  // Enable interrupt on INT1 pin
  mma.writeRegister(MMA8452_CTRL_REG4, 0x04);   // Enable freefall interrupt
  mma.writeRegister(MMA8452_CTRL_REG5, 0x01);   // Route to INT1 pin
}

void loop() {
  if (mma.readTap() & 0x04) {  // Freefall detected
    Serial.println("Freefall detected!");
  }
  delay(100);
}

Power Management for Battery-Powered Projects

Mode Power Consumption Use Case
Active (800 Hz ODR) ~165 µA High-speed motion capture
Active (50 Hz ODR) ~50 µA General motion detection
Active (1.56 Hz ODR) ~6 µA Low-power tilt sensing
Standby < 1 µA Idle between readings
Q: What is the resolution of the MMA8452 sensor?

The MMA8452Q provides 12-bit digital output (default). It can also be configured for 8-bit output for faster readings. The resolution allows detection of tilt changes as small as approximately 0.06°.

Q: Is the GY-45 MMA8452 compatible with 3.3V microcontrollers?

Yes. The module operates on 3V to 5V power and includes onboard regulation, making it directly compatible with both 3.3V (ESP32, ESP8266) and 5V (Arduino) systems.

Q: What is the difference between MMA8452 and MPU6050?

The MMA8452 is a 3-axis accelerometer only. The MPU6050 combines both 3-axis accelerometer and 3-axis gyroscope. Choose MMA8452 for applications requiring only tilt and motion detection (low power, simpler). Choose MPU6050 for full 6-DOF motion tracking.

Q: Can this sensor detect tap/double-tap gestures?

Yes. The MMA8452Q includes embedded pulse detection functionality that can detect single and double taps. This is configured through the device’s interrupt registers without requiring continuous processor polling.

Q: How do I select between ±2g, ±4g, and ±8g ranges?

Use the setRange() function in your library or write directly to the XYZ_DATA_CFG register. Example: mma.setRange(MMA8452_RANGE_2_G) for ±2g sensitivity.

Q: What are the two I2C addresses, and how do I select them?

The I2C address is determined by the SA0 pin:

  • SA0 = GND: Address 0x1C (default on most GY-45 modules)

  • SA0 = VCC: Address 0x1D

Q: Why are my readings 0 or 4095?

This indicates communication failure or an incorrectly configured I2C address. Check your wiring and verify the correct I2C address using an I2C scanner sketch.

Q: Can the MMA8452 be used as a pedometer or step counter?

Yes. The MMA8452 is suitable for real-time activity analysis applications, including pedometer step counting. The embedded transient detection can be configured to detect step patterns.

Q: What is the purpose of the two interrupt pins (INT1, INT2)?

The two programmable interrupt pins can be configured to trigger on various events including freefall, motion, pulse detection, orientation change, and data ready. This offloads processing from the main microcontroller.

Q: How does the auto-wake/sleep function work?

The device automatically changes the output data rate (ODR) between a higher rate when motion is detected and a lower rate during inactivity. This significantly reduces power consumption while maintaining responsiveness.