An article on the Raspberry Shake got me looking for more on earthquake sensors. I found the Omron D7S. Datasheet here.
The chip can be found at both Mouser and Digikey. It is a small SMT mountable PCB that communicates via i2c. The datasheet provides little info on actually programming the device. Googling about found two libraries that helped shed some light on things.
First, from Omron, a python library on github. The platform of choice is a Pi Zero W with Rasbian Buster Lite. To get started, install git, i2c-tools, python3-smbus, and python3-rp-gpio. Clone the repo and the software is ready.
Connecting the sensor to the Pi only needed four wires – 3.3v, gnd, SDA, SCL. 10k pull-up resistors are used for SDA and SCL. A 10k pull-up was also added for the sensor “settings” pin. Both Vcc and both Ground pins on the sensor need to be wired.
- Pi pin 1 – Vcc to Sensor pins 1 & 9
- Pi pin 1 – Vcc to 10K pullup resistors to sensor pins 4, 5 & 7
- Pi pin 9 – Ground to Sensor pin 6 & 10
- Pi pin 3 – SDA to sensor pin 5
- Pi pin 5 – SCL to sensor pin 4
Sensor pins 2 and 3 provide optional interrupts. Pin 3 goes low when a quake is in happening. Pin 2 goes low to signal suggested shutdown due to expected significant damage. These pins are not used in this setup.
sudo i2cdetect -y 1
showed the chip at address 0x55. sudo python3 sample_d7s
ran as advertised.
I added a few line of code to have the output go to a Google Sheet and set the unit up in the basement. Details on how this works can be found in an earlier post.
The second library is for Arduino. It appears to provide much greater detail on the registers and parameters on the chip but I have not tested it.
An additional article on How to Make an Earthquake Alarm is a alternative approach.
The chip measures quake intensity not magnitude. The measurement correlates strongly with the Japan Meteorological Agency seismic intensity scale. A discussion on various seismic intensity scales can be found here or copied here.
Omron shared a more detailed datasheet.