The utility companies recommend to shut off gas immediately after an earthquake if one smell gas. If you are at work or away when an earthquake hits, then you may not be able to get home in time. So a automatic system is required to shut off gas flow to avoid fires or explosions due to gas line breaks which may worsen the situation after an earthquake. An earthquake valve will take care of this instantly for you. An earthquake valve or seismic valve is an automatic way to shut off the low pressure regulated gas supply to a structure during a major earthquake and/or if a pipe is broken. These are applicable both to utility supplied natural gas and to gaseous liquefied petroleum gas (LPG).
A natural gas earthquake shut-off valve automatically shuts off your gas service when an earthquake of a sufficient magnitude occurs at your home's location. After the quake has stopped and you have determined that it is safe to do so, follow the manufacturer's instructions for restoring your gas service. You will need to make sure no gas leaks exist and re-light your pilot lights. You must ensure that your appliances are safe before operating them. The Gas Company charges a fee to reset valves and re-light pilot lights when your seismic shut-off valve has closed due to a non-seismic occurrence.
The Gas Company recommends that you contact a licensed, qualified professional or The Gas Company to reset the valve, and to verify that no gas leaks exist, to ensure that all of your gas appliances are safe before being placed back in operation and to re-light your pilot lights. Remember that following a major emergency it may take many days or even weeks before someone can come to your location.
The strange little red thing on the gas pipes (left) is an earthquake valve. It shuts off the gas automatically if there is an earthquake.
There are Two types of valve, one is sensitive to motion and the other to excessive gas flow. The most secure installations would use one of each type connected in series.
Excessive flow sensor: A valve is closed when the flow exceeds a certain limit appropriate to the application. This will only operate when a pipe is broken, and so may not operate if a small (yet potentially dangerous) leak is present. If activated, any faults in the piping must be first repaired.