← Projects
raspberry-pi intermediate 16 days ago ◑ 28 views ◯ 5 min read

Build a DIY Seismometer: Sensing Ground Motion with a Raspberry Pi and Visualizing Earthquake Data

Build time: 1 weekend
Tools needed: Raspberry Pi with Raspberry Pi OS installed, a soldering iron for sensor connections, a drill for mounting the base plate, a level for setup, basic Python scripting for the data logging and visualization pipeline
seismometerseismographraspberry piearthquakeaccelerometercitizen sciencevibration sensinggrafana
Parts List

A seismometer measures ground motion — ideally motion far too small to feel, on the order of micrometers — and plots it over time as a seismogram. Professional seismic networks run very expensive, exquisitely isolated instruments buried in boreholes, but the basic physics is approachable at the hobbyist level: a sufficiently sensitive accelerometer, bolted to a sufficiently massive, well-coupled base, and logged continuously, can pick up everything from a truck passing outside to genuine regional and (for larger events) global earthquakes.

This build uses a Raspberry Pi and a low-noise MEMS accelerometer to build a basic vertical/horizontal motion sensor, continuously logging to a time-series pipeline you can graph, alert on, and compare against the public seismic record from agencies like the USGS. It's a genuine citizen-science instrument, not a toy — projects like the Raspberry Shake community have built an entire open seismology network on essentially this same approach, and a careful build on this scale can and does detect real earthquakes.

What You're Actually Measuring

Seismic waves arrive in a few recognizable types, and understanding them helps you interpret what you're seeing on a plot rather than just staring at a noisy line:

Wave typeCharacteristic
P-waves (primary)Fastest, arrive first, compressional motion along the direction of travel — usually the first sharp blip on a distant earthquake's record
S-waves (secondary)Slower than P-waves, shear motion perpendicular to travel direction, generally larger amplitude on the record
Surface wavesSlowest, largest amplitude, travel along the Earth's surface rather than through the interior — this is usually the big, obvious wobble on a strong regional event

The time delay between the P-wave and S-wave arrival at your station is actually useful data on its own — it's the basis of how real seismic networks estimate distance to an earthquake's epicenter, and you can do the same rough calculation with your own recorded arrival times.

Sensor Selection and Mounting

The single biggest factor in how useful this instrument is comes down to two things: sensor noise floor and how well the sensor is mechanically coupled to the ground. A low-noise digital MEMS accelerometer like the ADXL355 is specifically designed for this kind of application — it has a noise density low enough to resolve genuinely small ground accelerations, well below what a typical hobby-grade accelerometer (the kind sold for drone flight controllers) can pick out from its own internal noise.

Wiring and Data Acquisition

The ADXL355 communicates over SPI or I2C, both of which the Raspberry Pi's GPIO header supports directly — wire the sensor's data lines to the Pi's SPI bus for the higher sample rate SPI mode supports, since seismic analysis benefits from a reasonably high sample rate (the ADXL355 supports output data rates up into the hundreds of Hz, well above what's needed for teleseismic events but useful headroom for local, higher-frequency signals).

  1. Wire the accelerometer breakout to the Pi's SPI pins (MOSI, MISO, SCLK, CS) plus power and ground, double-checking the board's logic level is compatible with the Pi's 3.3V GPIO before connecting.
  2. Install a Python SPI library and write (or adapt an existing open-source) polling loop that reads all three axes at a fixed sample rate and timestamps each reading.
  3. Write incoming samples to a local time-series store — InfluxDB running on the same Pi is a natural fit here, mirroring the pattern used in other Pi-based environmental logging projects, since it's built for exactly this kind of continuous, timestamped sensor stream.
  4. Build a Grafana dashboard against that InfluxDB instance to plot the live waveform, which gives you a continuously scrolling seismogram view essentially for free once the data's flowing.

Filtering Out Noise

Raw accelerometer data is dominated by noise sources that have nothing to do with earthquakes: building HVAC vibration, foot traffic, passing vehicles, and the sensor's own electrical noise floor. A basic signal processing pass makes the data vastly more usable:

Noise sourceTypical frequency rangeMitigation
HVAC and appliance vibrationTens of Hz and upLow-pass filter in software, cutting off well above the frequency range of interest for regional/teleseismic events
Foot traffic / local walking1-3 Hz, sharp transient spikesMount the sensor somewhere with less direct foot traffic if possible; otherwise flag and visually exclude obvious transient spikes from long-term analysis
Long-term thermal driftVery low frequency, minutes to hoursHigh-pass filter or baseline subtraction over a rolling window

Comparing Against the Real Record

Once logging is running continuously, cross-reference your local seismogram against the USGS earthquake catalog for events that occurred during your logging window — a moderate-to-large regional earthquake, or a major teleseismic event from anywhere on the globe, should show up as a distinct, out-of-the-ordinary signature against your background noise floor, especially once you've filtered out the routine local vibration sources. Matching a bump on your own homemade instrument's graph to a real, published earthquake event is the payoff moment for this whole build.

From here, the most valuable upgrade path is adding a second sensor axis orientation or a second station entirely — triangulating rough direction and distance to an event gets dramatically more reliable with more than one data point, which is exactly why real seismic networks run dozens to hundreds of stations rather than relying on any single instrument.