How Grillo Uses Grafana to Visualize Its Cloud-Based Earthquake Detection System
"There are only two national earthquake early warning systems in the world, in Japan and in Taiwan. Mexico has a system, but it's only partial. Chile had the biggest earthquake in history, a 9.5 in 1960, and Chile doesn't have one. Which is why we went there this year."
Grillo, a social enterprise startup largely funded by the international development aid agency USAID, built its earthquake-detection technology based on the Internet of Things. "We have our own sensors that we've created, the software, and the firmware which drives the sensors, and that data from the sensors is sent to the cloud," says Meira.
And thanks to cloud technologies, including Grafana, "that are very, very affordable and very scalable," Meira says, "we've been able to create something that historically would have just required a team of hundreds of people." Not to mention potentially hundreds of millions of dollars; Japan's earthquake warning system cost $1 billion to build.
On the Ground in Mexico…
Fifty Grillo sensors, which record ground motion, have now been placed in some of the poorest, most rural parts of Mexico along the Pacific coast fault line, in schools, hospitals, fire stations, and government buildings – anywhere there is a reliable Internet connection. (There are also about 10 sensors in Chile now.) "Once we have that network established, all of our sensors transmit large amounts of data every second," says Meira. Using algorithms written by the four PhDs and mathematicians on the team, the Grillo system determines "whether it's an earthquake or a truck that's moving by," he says.
If it's an earthquake, an alert is sent out via Twitter (@GrilloAlerta) and Grillo.app, a website with the user experience of an app that can easily be accessed on smartphones as well as desktops. (There's high smartphone penetration in both countries.) Potentially, the company could also work with local governments to issue alerts via loudspeaker or other methods. Grillo is currently working with a beta group of 20,000 users, but hopes to release the product to the general public soon.
And Meira plans to expand beyond Mexico and Chile. "Once we created the sensors, the software, and the cloud system, I think we can just roll it anywhere," he says. Of course, "it's a huge feat just to install one sensor. It's not like going to Los Angeles or New York where you could find a million people. You're in this little village of three people, and no one has Internet, so you have to get to the next one."
"It's a huge feat just to install one sensor. It's not like going to Los Angeles or New York where you could find a million people. You're in this little village of three people, and no one has Internet."
…And in the Cloud
One of the things the team is continually working on is maintaining as low latency as possible. "With the software we wrote, we make sure that all the data that's being recorded onsite is properly moved into the cloud, and that we don't lose any of it as it goes in, and if the power goes out, that it recovers properly and is always synced in terms of time," says Meira. "We make sure that we process it with as little latency as possible, so if there's an earthquake, we don't waste any milliseconds."
That's because every millisecond can make a difference. "An earthquake isn't particularly fast: It travels about 4 kilometers a second, whereas when you send something via the Internet, it's light speed," Meira explains. "When one of our sensors detects an earthquake in Oaxaca, we send the alert immediately via the cloud. From the time people get the alert, it will take approximately 80 seconds for that earthquake wave to be felt in Mexico City, because it has to travel that distance. If you have one in Acapulco, it's a lot closer, so you might only get 60 seconds [lead time]."
Currently, using Microsoft Azure Cloud, the Grillo system has a latency of 70 milliseconds. "The data center just needs to be as close to the sensor as possible," he says. "Potentially we could even have a server in country, but we just like using the cloud. It's not that much data per second; more than the size of the telemetry, we're interested in the reliability, which is really hard. Rainy season in Mexico typically means that the internet gets a bit spotty. Whereas in Chile, the Ethernet, which we typically use, is not good, so we use 4G, and 4G there is amazing."
Once delivered to the cloud, the raw data is stored in one large database. It's also put into an InfluxDB database "because that works really nicely in Grafana," says Meira.
Visualizing the Data
Earthquakes, when visualized, are very distinctive: The seismograph shows a clear wave. But for a long time, the Grillo team wasn't regularly visualizing the data it was compiling. "We were able to plot them out using just some Python code, but we weren't automating that or doing it all the time," says Meira. When they decided to look around for a visualization solution, Meira came across Grafana and liked that it seemed very nimble and lightweight.
"We thought, ‘Let's see how much it can handle,'" says Meira. "So we pushed all of our sensors. We've got about 60 sensors and each one of them sends about 90 readings every second. It's a huge data load, not normally seen in IoT. And actually, it went really well. So now we have in our office a number of panels that show us the different stations and their status and all of the real time feed from the earthquakes. Obviously we don't use this to send earthquake detections. We use it just as a visual inspection in the office."
From that office in Mexico City, Meira and his team are pushing the limits of what can be done both in the world of IoT, as well as in scientific research. "Typically people who make these earthquake detection systems are governments, and they have huge research institutions and huge budgets," says Meira. "But with tools like Grafana, the cloud, and all of the IoT available technologies that we use, we just thought we can do this ourselves, and we can do it better. For us, the impact of what we're doing is the key driver."