Airbags have been in the news recently, partly because of the Takata airbag recall (which appears to be about to expand significantly in scope), and also because of a GM ignition switch recall to fix an issue that can lead to the airbags not functioning in a crash (as well as a loss of engine power, which can also lead to a loss of power steering). Pretty much everyone knows that properly functioning airbags can save lives, but not everybody knows exactly how they work (or what can cause them to fail).
Almost instantly after a crash occurs, sensors on the front of the car detect an impact and send a signal to the airbag computer. The computer uses the data from the sensors to determine the severity of the crash, and if it determines that they are necessary, commands the deployment the airbags. This part of the process takes only 10 or 20 milliseconds (one to two hundredths of a second).
When the airbag receives the command to deploy, a chemical reaction is started when the sodium azide (NaN3) inside the airbag is heated by the ignitor. When the NaN3 is heated, the bonds holding the molecule together are broken, causing the nitrogen to be released and expand quickly, inflating the airbag (only a small amount of the sodium azide is needed to inflate the airbag). The leftover sodium (Na) is reactive and could be dangerous, so a secondary reaction with potassium nitrate (KNO3) creates potassium oxide (K2O), sodium oxide (Na2O), and more nitrogen (N2). A third and final reaction adds in some silicon dioxide (SiO2) which mixes with the K2O and Na2O to create what is essentially glass. All of this takes around 20 or 30 milliseconds, and happens within four or five hundredths of a second from the beginning of the impact.