Component guide · Beginner · 3 min read
NXP MMA8452Q (GY-45, SparkFun), MMA8451, Grove ±1.5 g, ROHM KX022, KXTJ3

Adafruit MSA311 and Pimoroni MSA301
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
These are simple 3-axis I2C accelerometers for tilt, shake and orientation. The NXP MMA8452Q (on the GY-45 and SparkFun boards) and the 14-bit MMA8451 are well supported in Arduino; the Grove ±1.5 g board is the easiest plug-in; the ROHM KX022 and KXTJ3 are low-power chips; and the MSA311 and MSA301 are small STEMMA QT and Pimoroni breakouts.
Key specs at a glance
- Range
- ±1.5 g (Grove) to ±16 g (KX, MSA)
- Resolution
- 12-bit (MMA8452), 14-bit (MMA8451)
- Interface
- I2C (0x1C or 0x1D on MMA845x)
- Supply
- 1.95 to 3.6 V chips; breakouts 3.3 or 5 V
- Features
- Tap, orientation, free-fall, motion interrupts
- Connector
- STEMMA QT, Qwiic or Grove on some boards
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1MMA8452 GY-45 3-Axis Accelerometer Module – I2C Digital Output₹121
Option 2SparkFun Triple Axis Accelerometer Breakout – MMA8452Q (with Headers) – I2C Digital Output₹1,025
Option 3NXP Semiconductors MMA8452QR1 QFN-16 3-Axis Accelerometer Sensor ROHS₹233
Option 4NXP Semiconductors MMA8451QR1 QFN-16 3-Axis Accelerometer Sensor₹185
Option 5Seeed Studio Grove 3-Axis Digital Accelerometer (±1.5g) – I2C Digital Output₹999
Option 6ROHM Semiconductor KX022-1020 LGA-12 3-Axis Accelerometer Sensor₹62
What the MMA8452, MMA8451, KX022, MSA311 and Grove accelerometers is
The NXP MMA8452Q and similar low-cost accelerometers (ADXL345, LIS3DH) measure 3-axis acceleration over I2C for tilt, tap and motion detection.
For tilt, read the gravity vector: angle = atan2 of the axes. This only works when the board is not accelerating.
Pick a breakout with a regulator and level shifting if you use a 5 V Uno. The bare MMA and KX chips need a PCB.
MMA8452, MMA8451, KX022, MSA311 and Grove accelerometers pinout
The pins on the MMA8452, MMA8451, KX022, MSA311 and Grove accelerometers and what each one does.
| Pin | Function |
|---|---|
| VCC / 3V3 | Supply |
| GND | Ground |
| SCL / SDA | I2C |
| SA0 | Address select |
| INT1 / INT2 | Interrupts |
- VCC / 3V3
- Supply
- GND
- Ground
- SCL / SDA
- I2C
- SA0
- Address select
- INT1 / INT2
- Interrupts
Wiring the MMA8452, MMA8451, KX022, MSA311 and Grove accelerometers
Modules with a regulator run from 3.3 V or 5 V. Bare chips (LGA or QFN parts) are 1.8 to 3.6 V only: mount them on a breakout and use a level shifter with 5 V boards.
| MMA8452, MMA8451, KX022, MSA311 and Grove accelerometers pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V (or 3.3V) | 3V3 |
| GND | GND | GND |
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
- VCC
- Arduino Uno:
- 5V (or 3.3V)
- ESP32:
- 3V3
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
Example code
Use the Adafruit MSA301 library for the MSA311 and MSA301, and the maker's library for the Grove and Kionix boards.
#include <SparkFun_MMA8452Q.h>
MMA8452Q accel;
void setup() {
Serial.begin(115200);
Wire.begin();
if (!accel.begin()) { Serial.println("MMA8452Q not found"); while (1); }
}
void loop() {
if (accel.available()) {
float x = accel.getCalculatedX(), y = accel.getCalculatedY(), z = accel.getCalculatedZ();
float pitch = atan2(x, sqrt(y * y + z * z)) * 57.3;
float roll = atan2(y, z) * 57.3;
Serial.printf("x %.2f y %.2f z %.2f g pitch %.0f roll %.0f\n", x, y, z, pitch, roll);
}
delay(100);
}Setup and tuning
VCC 3.3 V, GND, SDA and SCL; breakouts may add a regulator for 5 V.
use the SparkFun MMA8452Q library or the matching library for your chip.
pick ±2 g for tilt, ±8 g for shocks.
compute pitch and roll from the X, Y and Z readings with atan2.
use tap or motion interrupts to wake the microcontroller.
What you need
Shop this list11 of 12 found in our store · ₹4,707
MMA8452 GY-45 3-Axis Accelerometer Module – I2C Digital Output: the part this guide coversMMA8452 GY-45 3-Axis Accelerometer Module – I2C Digital Output₹121
SparkFun Triple Axis Accelerometer Breakout – MMA8452Q (with Headers) – I2C Digital Output: another version this guide coversSparkFun Triple Axis Accelerometer Breakout – MMA8452Q (with Headers) – I2C Digital Output₹1,025
NXP Semiconductors MMA8452QR1 QFN-16 3-Axis Accelerometer Sensor ROHS: another version this guide coversNXP Semiconductors MMA8452QR1 QFN-16 3-Axis Accelerometer Sensor ROHS₹233
NXP Semiconductors MMA8451QR1 QFN-16 3-Axis Accelerometer Sensor: another version this guide coversNXP Semiconductors MMA8451QR1 QFN-16 3-Axis Accelerometer Sensor₹185
Seeed Studio Studio Grove 3-Axis Digital Accelerometer (±1.5g) – I2C Digital Output: another version this guide coversSeeed Studio Grove 3-Axis Digital Accelerometer (±1.5g) – I2C Digital Output₹999
ROHM Semiconductor KX022-1020 LGA-12 3-Axis Accelerometer Sensor: another version this guide coversROHM Semiconductor KX022-1020 LGA-12 3-Axis Accelerometer Sensor₹62
ROHM Semiconductor KXTJ3-1057 LGA-12 3-Axis Accelerometer Sensor – ±2g/±4g/±8g/±16g, I2C Interface: another version this guide coversROHM Semiconductor KXTJ3-1057 LGA-12 3-Axis Accelerometer Sensor – ±2g/±4g/±8g/±16g, I2C Interface₹46
Adafruit MSA311 Triple Axis Accelerometer – STEMMA QT/Qwiic Module: another version this guide coversAdafruit MSA311 Triple Axis Accelerometer – STEMMA QT/Qwiic Module₹769
Pimoroni MSA301 3DoF Motion Sensor Module – I2C Interface, LGA-12 Package: another version this guide coversPimoroni MSA301 3DoF Motion Sensor Module – I2C Interface, LGA-12 Package₹739- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
Alternatives and when to choose them
Common mistakes to avoid
- Powering the bare chip from 5 V.
- Expecting rotation rate from an accelerometer.
- Using ±8 g for small tilt.
- Not filtering vibration.
Frequently asked questions
How do I get tilt angle from an accelerometer?
Use atan2 on the X, Y and Z axes to compute pitch and roll.
Why is the reading noisy?
Vibration and sensor noise; use a low-pass filter or average several samples.
Can it measure rotation speed?
No. An accelerometer measures acceleration; use a gyroscope for rotation rate.
Why is Z about 1 g when still?
That is gravity, which every accelerometer measures even when still.
Is the MMA8452Q 5 V tolerant?
No. Use 3.3 V or a breakout with level shifting.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

