Earthquake Pi
By Russell Barnes. Posted
This clever box of tricks rumbles to alert you to earthquakes anywhere in the world
Advertisement
Head to head: Raspberry Pi + Raspberry Pi Zero + Raspberry Pi Pico.
Russell Grokett has been fascinated by earthquakes and geology ever since he was a child, when his father built him a simple swinging beam seismograph. However, since Russell now lives in Florida, known for hurricanes but not quakes, he’s created the Earthquake Pi to satisfy his interest. Rather than acting as a detector of local tremors, like some Pi-powered projects, it’s a neat alert system that uses real-time open data from the United States Geological Survey (USGS) to detect earthquakes around the globe.
The full article can be found in The MagPi 49 and was written by Phil King.
“I had seen fancy maps and graphs of their data,” explains Russell, “[but] I wanted to ‘feel’ (safely!) when an earthquake occurs. So I came up with the idea of taking their data and building a device that rattles and rumbles when an earthquake occurs. This is different from the typical detection on a chart or graph.”
The Earthquake Pi comprises a wooden box containing the electrical components, including a Raspberry Pi Zero and a vibrating motor recycled from an old battery toothbrush to make the box rattle during an alert: “I found that just loosely taping the motor down worked best, as it bounces around a bit while running.” To complete the effect, an external speaker plays earthquake sounds, while a strip of NeoPixels light up and an LCD display shows details of the seismic event.

“By default, the vibrating motor alerts run for a few seconds per magnitude: about two seconds for mag. 1 and up to about ten seconds for a mag. 9 (never heard that, luckily!).” The LCD display and NeoPixel bar graph then come on, displaying the quake location and magnitude. Lastly, the earthquake audio sound effect plays for a few seconds more. “You just set the box on your desk or table where is sits quietly… until boom! The first few times it goes off will probably scare you, as it’s completely unpredictable!”
Russell’s Python program includes a variable that can be set to the minimum magnitude for alerts. “If you set it to alert on even the smallest (magnitude 1.0 or greater) earthquakes, then it will be going off almost every hour or so.” He tells us his is set to magnitude 3.0 and higher and goes off a few times per day. “When I hear it rattle, I run in to see where the earthquake is located. I especially perk up if I hear it rattle for many seconds, as that means a big one occurred somewhere. After watching it for a while, you do see a pattern of where many earthquakes are occurring. It’s also a good geography lesson, as I’ve never heard of many of the cities or islands where they are, and so I look them up on a map.”
To ensure the Earthquake Pi doesn’t wake him during the night, Russell uses a cron job to only run the program between 8am and 11pm: “You DO NOT want to run it while trying to sleep. It would probably scare everyone in the house!”

Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Teka-Sketch
This all-new e-ink-based Etch-a-Sketch can play Pong, and it also has an undo button
Read more →
Raspberry Pi vs Raspberry Pi Zero 2 vs Raspberry Pi Pico in Raspberry Pi Official Magazine 159
Without an operating system, any computer – including your Raspberry Pi – is just a dumb lump of sand. Put Raspberry Pi OS on it however, and you’ve got yourself a working system that can handle games, web browsers, emails, programming and everything else we bang on about here all day every day. The latest […]
Read more →
Win one of ten M.2 HAT+ Compact
The ability to connect NVME SSD drives to Raspberry Pi 5 is very cool, although it does slightly limit the cases you can use. With the M.2 HAT+ Compact, you can even fit an SSD-powered Raspberry Pi into the official case – and we have ten to give away below. Win one of ten M.2 […]
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.