A powerful earthquake strikes off the Pacific coast of Mexico. Within seconds, radio transmissions, megaphones and smartphone apps blare warnings to the capital's 20 million people before the ground shakes.
After the loud "seismic alert!" alarm, Mexico City residents have as much as a minute to flee their homes, offices and schools before buildings start to sway.
But such technology was not available on September 19, 1985, when a massive 8.1-magnitude coastal quake rocked the metropolis, crushing buildings and killing thousands.
It can take more than a minute for the seismic waves to reach the capital hundreds of kilometers away. But once they arrive, buildings start moving back and forth because the soil below—a former lake bed—is soft.
When the country marks the 30th anniversary of the tragedy on Saturday, the early-warning systems will be switched on during a national drill.
For two decades, a civil association known by its initials CIRES has provided the city with a system that automatically interrupts radio broadcasts and triggers alarms inside buildings thanks to some 100 sensors placed along the western coast.
For the first time this year, the alarm will sound on 8,200 street megaphones.
The surge of smartphone technology now gives Chilangos, as the capital's residents are known, the ability to receive warnings in the palm of their hands with apps such as SkyAlert and Alerta Sismica DF.
Within two seconds that a quake hits, SkyAlert's sensors send a broadband signal to phones, triggering a loud sound with a voice that repeats "seismic alert" and a message indicating the temblor's intensity.
Launched in 2013, the app has three million users.
"This type of system carries great responsibility," SkyAlert's 29-year-old founder, Alejandro Cantu, told AFP.
"Every morning I wake up and think I go to work with a commitment to my country and my people," said Cantu, whose company also sells devices for homes and offices that receive alerts via satellite.
SkyAlert split from the CIRES system last year after Cantu traveled to Japan and brought back the Asian country's sensor technology for his app.
In May, the company charged users 59 pesos ($3.5) a year to personalize their alerts, gaining 30,000 paid customers so far.
While SkyAlert quickly became a popular application, it jolted its customers in July 2014 when it issued a false alarm.
At the time, the app was still connected to CIRES, which Cantu blames for the error. But the civil association says it was SkyAlert's own doing.
Cantu said the risk of failure for SkyAlert is very small as the signal uses speedy data networks instead of phone lines. The city government failed at its own app experiment.
US eyes Mexico example
For CIRES's director general, Juan Manuel Espinosa Aranda, old-school radio signals are more reliable.
The veteran engineer showed a screen that monitors little green dots across the coast representing the sensors—fenced-in areas with two antennas and a box containing the technology.
From a three-story house in Mexico City topped by an antenna, CIRES's servers await the dreaded warning, which is automatically relayed to alarm systems via radio signals.
CIRES was launched in the aftermath of the 1985 earthquake, as authorities sought to avoid another major tragedy.
US experts were traveling to Mexico this week to learn more about the capital's system as they develop something similar for America's quake-prone West Coast.
"When we talk to people about the importance of an early-warning system, we hold up the Mexican and Japanese systems as examples of functioning systems," said Jennifer Strauss, external relations officer at the Berkeley Seismological Laboratory in California.
Since its system was launched in 1993, CIRES has issued some 60 public alerts, sounding the alarm for strong earthquakes of 6.0 magnitude and higher.
In 2012, the city government-funded association designed a small radio that sells for $150 and has been distributed in schools. Bigger, more expensive speakers have been used since 1993.
But Espinosa warned that an alarm is not foolproof.
"If we get an alert at 3:00 am when everybody is deep asleep, the efficiency of the warning can be very questionable," he said.
"We can't get to this degree of perfection because it doesn't just depend on technology, it also depends on one's attitude in an earthquake."
Explore further: California needs Mexico's seismic warning system