In a marriage of technology and earthquake safety, BART has become the first U.S. transit system to install an early-warning system that can detect major earthquakes seconds before the ground begins shaking and then slow trains to reduce the risk of derailments, injuries and deaths.

The system, developed with the help of scientists at UC Berkeley, can give a warning that ranges from a few seconds to up to a minute before a quake hits, depending on how large and how far away an earthquake is. A similar network is already in use in Japan, where it has saved lives in major quakes.

“We think of earthquake prediction as being the Holy Grail, but given that we cannot predict earthquakes and may never be able to, this is the next best thing,” said Richard Allen, director of the UC Berkeley Seismological Laboratory. “It allows people to react and put themselves in a safe place before the shaking starts.”

In recent years, scientists from Berkeley, the U.S. Geological Survey, the California Geological Survey, Caltech Seismological Laboratory and the California Emergency Management Agency have built a network of about 400 sensors around the state called the California Integrated Seismic Network.

Its sensors measure sensitive seismic waves at the beginning of large quakes, called “p-waves” and “s-waves,” sending alerts to computers in central locations such as the Berkeley campus.

BART officials tapped into 200 of the sensors that are spread out from the Oregon border to Parkfield in Monterey County, connecting them to the central computer network that operates BART trains.

As a result, when a quake of magnitude 5.0 or greater occurs far away, or a nearby quake of 4.0 or larger hits locally, within roughly 2 seconds an alert from the sensors speeds over an Internet connection to the central computers, sending an alarm to BART’s computers — which then slow every train on the line by about 2 miles per hour per second.

A train traveling at the normal top speed of 72 mph could be slowed to 32 mph with 20 seconds of warning, said Carlton Allen, BART’s chief engineer.

“We’re in earthquake country. If we can buy time, why shouldn’t we?” he said. “Any opportunity to slow down the trains before a quake hits reduces the risk of derailments.”

Recalibrating the BART computer network cost between $40,000 and $50,000, he said. The system has been tested since 2009 and went live on the whole BART network last month.

BART has 104 miles of track, 44 stations, 669 cars and nearly 400,000 riders a day.

The latest experiment is being closely watched by geologists and emergency experts around the nation.

Robust early-warning earthquake systems already are at work in Japan and Mexico City. Smaller systems are online in Istanbul, Taiwan and at a nuclear research facility in Romania.

Scientists and emergency planners say that although the systems aren’t perfect, providing people with even a few seconds of warning before a large quake can make a significant difference. If the California network were expanded, for example, equipment could be installed in tall buildings so that the moment the sensors detected a large quake, elevators would stop between floors so people wouldn’t be trapped in power outages.

Rolling doors at fire stations could be programmed to open when the sensors go off, ensuring that fire trucks could get out to respond to quake damage quickly. Alarms could go off in hospital emergency rooms so that doctors doing sensitive work — like brain or eye surgery — could have a few seconds to pull back their scalpels.

Google also has been working with scientists in a partnership that could potentially result in a mobile phone app that would alert people that a quake was coming in a few seconds so they could dive under a table or stand in a doorway.

But the system has been slowed by a lack of funding. Last year, the Gordon and Betty Moore Foundation donated $6 million to help deploy more sensors on the West Coast and fund research to improve the complex algorithms that measure the amplitude and other characteristics of the seismic waves.

But deploying a fully operational West Coast system would cost about $150 million, and state and federal political leaders have not provided funding. On Friday, Berkeley’s Allen, along with USGS scientists, will make a presentation to congressional staff members in Washington, D.C., updating them on the technology.

“It’s a challenge we always face with earthquakes,” he said. “Because they occur on a time scale of decades, we forget the hazards we face. We are always responding to the last event rather than recognizing we have new technologies. Hopefully we’ll have the system in place before the next major quake.”

Paul Rogers has covered a wide range of issues for The Mercury News since 1989, including water, oceans, energy, logging, parks, endangered species, toxics and climate change. He also works as managing editor of the Science team at KQED, the PBS and NPR station in San Francisco, and has taught science writing at UC Berkeley and UC Santa Cruz.

In a video clip recorded by a student, a psychology instructor at Orange Coast College told her class that the election of Donald Trump was “an act of terrorism” – prompting an official complaint from the school’s Republican Club.

Homegrown tech entrepeneurs and educators from West Contra Costa County participate in an Hour of Code event Wednesday at the Richmond Police Activities League aimed at getting more African-Americans, Latinos and minorities into the tech field, as part of Computer Science Education Week, from Dec. 5 to 11.