MPU-6050 with ESPHome as Earthquake Sensor

Hi! I have Wemos D1 Mini and an MPU 6050 sensor mounted on the wall, I wanna make it as an earthquake sensor device.
I’ve managed to set it up with the following code on ESPHome, but I don’t think it’s not good enough:

  - platform: mpu6050
    address: 0x68
    update_interval: 100ms
    accel_x:
      name: "MPU6050 Accel X"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    accel_y:
      name: "MPU6050 Accel Y"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    accel_z:
      name: "MPU6050 Accel z"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    gyro_x:
      name: "MPU6050 Gyro X"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    gyro_y:
      name: "MPU6050 Gyro Y"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    gyro_z:
      name: "MPU6050 Gyro z"
      filters:
         - sliding_window_moving_average:
            window_size: 4
            send_every: 1     
         - delta: 0.5  
    temperature:
      name: "MPU6050 Temperature"    
      filters:
        - sliding_window_moving_average:
            window_size: 50
        - exponential_moving_average:
            alpha: 0.2

With this code, the value of each sensor while still is not 0. I’m aware that it does not come with calibration as written in documentation.
I tried adding derivative sensor on HA hoping that if the value changes from 0, it will trigger, but with the following automation it will only do the actions after movements stopped.
Another downside of derivative sensor AFAIK is that if the sensor is not going back to initial position, the value will offset.

trigger:
  - platform: numeric_state
    entity_id:
      - sensor.derivative_gyro_x
      - sensor.derivative_gyro_y
      - sensor.derivative_gyro_z
      - sensor.derivative_accel_x
      - sensor.derivative_accel_y
      - sensor.derivative_accel_z
    above: 0
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition: []

What’s the best way to do this?
TIA

You can get regional earthquake data, tide data, etc from API’s just like importing weather data when you use the OpenWeatherMap api. Taping a mpu6050 sensor on a wall in your house will be basically useless. Vibrations that pass through your walls could come from inside the house from all knds of sources like kids running around, something falling on the floor, loud music, or from the weather outside. This is why earthquakes are monitored from ground sensors in very remote areas and are burried several feet below ground level. Just see if USGS has a public API or some similar atency. A google search might be a good place to start too.

The thing is, I live in a third-world country where a national earthquake alert system is nonexistent. People here only get notified after the quake, and there are individuals who have stolen the government’s buoys and sensors. I’ve tried USGS, and as expected, there’s not enough data. There have been multiple quakes here, but they’re not recorded there.

Regarding other factors, it’s very quiet here, so I don’t think that would be a problem.

I’m also open to alternatives.

Perhaps, raising malitias and rooting out corruption and criminal organizations who steal tide buoys and keep these places in the third world, that would be a good starting place. You do realize this is how we all find out about quakes? We feel them in real time ot hear about a place getting hit after it happened. There arent any early warning systems for earthquakes or volcanoes here in the US or anywhere that ive ever heard of.

Hi @Brix1330,

I am interested in the same topic.
Did you solve?

Thanks