I built a gunshot detection system for indoor use using Raspberry Pi (Pi) and multiple Arduino sensor units (ASU) connected in a local area network to provide an accurate early warning in case of a shooting. Each ASU consists of microphone, high pressure and low pressure sensors.

A gunshot produces a loud sound and a shock wave that can be measured by ASUs with software I wrote (Arduino IDE). The software also enables ASUs to send microphone, high and low pressure readings to Pi.

I built an artificial neural network model using Google’s Tensorflow on Pi. This is a fully connected ANN with 1 input layer, 1 hidden layer with 8 nodes, and an output layer with 3 outputs. The input layer accepts 3 inputs – microphone, high pressure and low pressure readings from ASUs. The output layer provides probabilities of rifle gunshot, handgun shot or no shot. To build the model, I divided my data into training and test datasets. I trained my model with training data and evaluated against test data, achieving an accuracy of 99.4%. The model can also differentiate between a rifle shot and a handgun shot.

Pi continuously scans ASUs with software I wrote (Python) and feeds data to the model. If a gunshot is detected, it raises alarm and sends warning texts and emails providing much needed early warning. I hope this system will help save lives and I am currently exploring opportunities to make it available to schools and businesses for user trials.

What inspired you (or your team)?

About 31% of mass shootings worldwide take place in the United States, and this percentage is only increasing. This is a horrific problem we all endure as a mass shooting occurs about every 60 days. In addition, the majority of mass shootings occur indoors–in businesses and schools–which makes this problem even more tragic and personal to me because I am a student. I can only imagine what my fellow students must go through when such an event occurs in their school. I wanted to do something about this problem by inventing a detection system that can provide an early warning to the police/authorities so they can save lives much more quickly during a mass shooting.