Getting to Know the MPU6050
The MPU6050 is a six-axis sensor module developed by InvenSense, combining an accelerometer for measuring linear acceleration and a gyroscope for measuring rotational velocity in a single chip. It detects all three axes X, Y, and Z for both functions, totaling six measurement channels. Originally designed for drones, robots, and VR devices, it has gained strong popularity in earthquake detection due to its well-matched capabilities and accessible price.
Key Capabilities of the MPU6050
Several features make the MPU6050 well-suited for earthquake detection. It offers 16-bit resolution for both the accelerometer and gyroscope, capturing subtle changes with precision. Its sampling rate reaches up to 1,000 Hz, sufficient for analyzing earthquake wave patterns that require real-time data. I2C or SPI connection requires minimal wiring and is simple to implement. Its price of approximately 50 to 150 THB per unit is low enough for household installation, and it is supported by a large ESPHome and Arduino community.
How the MPU6050 Detects Earthquakes
When the ground shakes, an MPU6050 mounted on a structural wall or column detects acceleration changes across all three axes simultaneously. This data passes through I2C to an ESP32 running ESPHome, which processes it and sends readings to Home Assistant via MQTT. When acceleration values exceed the defined threshold, HA immediately triggers the configured Automation chain.
Real earthquakes produce a distinctive wave pattern: a P-wave arrives first with lower frequency, followed by the more powerful S-wave. Analyzing this pattern alongside threshold values allows the system to distinguish genuine earthquakes from normal household vibration.
Calibration: The Step You Cannot Skip
Properly calibrating the MPU6050 is the foundation of accuracy. The basic process covers setting offset values to compensate for each chip's initial bias, applying a low-pass filter to remove high-frequency noise unrelated to seismic events, and testing against real vibration in each home's specific environment. HappySmart factory-calibrates every sensor unit before delivery, so customers receive a system ready for immediate use without needing to calibrate themselves.
Limitations to Understand
While the MPU6050 suits household use well, there are limitations to be aware of. Its high sensitivity can pick up noise from footsteps or appliances, requiring installation on stable surfaces such as concrete columns or plaster walls, along with appropriate threshold and filter settings. Its accuracy does not match laboratory-grade seismometers, but it is sufficient for home and commercial building protection.
MPU6050 Compared to Alternative Sensors
Alternatives include the ADXL345 offering higher accuracy at a higher price, and the BNO055 with built-in sensor fusion for easier processing but at significantly higher cost. For household use and accessible budgets, the MPU6050 remains the best value option. HappySmart also offers industrial MEMS sensor options for customers who need maximum accuracy.
