All projects
Completed2023
MLHardwarePublic SafetyPyTorch

GuardianShot

A $100 gunshot detection system that outperforms $90,000 commercial alternatives

G

Photo with Police Chief Terry Sult or the GuardianShot device

photo / screenshot coming soon

Why I built this

While biking to the gas station for ice cream, my friends and I heard a gunshot. "What was that?" we wondered. "I'm scared..." We pedaled home fast. My high school was in Durham — one of the highest crime rate cities in America — and I'd already lived through gun threats and watched school shootings on the news. I felt compelled to do something. When I discovered that existing gunshot detection systems cost $90,000 per square mile per year — pricing out the exact schools that need them most — I knew what I had to build.

Overview

GuardianShot is a Raspberry Pi-based gunshot detection device that listens to audio in real time, analyzes it with three convolutional neural networks, and alerts security and law enforcement via email and SMS within one second of detecting a shot. It achieves 98% accuracy at a fraction of the cost of any commercial alternative.

The Problem

What's broken

Every day, 12 children die from gun violence in America. 74% of shootings don't stop until law enforcement intervenes — meaning faster detection directly saves lives. Yet the commercial gunshot detection systems used in cities cost $90,000 per square mile annually. Schools, especially in high-crime areas, simply can't afford them.

The Solution

What I built

A portable Raspberry Pi device with a USB microphone and three trained CNNs that runs 24/7, costs roughly $100 in hardware, and alerts administrators within one second of detecting a gunshot. The hardest part wasn't the model — it was reducing false positives from everyday sounds like door slams, fireworks, and students. I solved it by collecting real-world audio in different environments and iterating on the training data until the system was reliable enough to deploy in a real school.

Technical Approach

The system uses a cascade of three PyTorch convolutional neural networks trained on a custom dataset — a combination of online audio sources and real-world recordings I made across different environments. Audio is captured via USB mic on a Raspberry Pi Zero W, processed locally, and classified in real time without any cloud dependency. When a gunshot is detected, the system triggers immediate email and SMS alerts to pre-configured contacts. I validated the system live at the Cary Police Department gun range to confirm performance under real gunshot acoustics.

Stack

PythonPyTorchRaspberry PiCNNsSMTP / TwilioNumPyLibrosa

Process

1

Research

Spoke with the police chief, city council members, and legislative experts to understand the problem space and what a realistic solution looked like.

2

MVP 1 — Acoustic Sensing

Built first prototype with an acoustic sensor + microcontroller, graphing amplitude values in real time on Arduino serial plotter to understand sound signatures.

3

MVP 2 — Neural Network

Trained a PyTorch CNN on audio data and ran it on a Raspberry Pi Zero W with an i2s MEMS microphone breakout. Got the model working but false positive rate was still too high.

4

MVP 3 — Multi-Device System

Scaled to multiple devices with consistent power supply, live dashboard, and real-time email/SMS alerting. Iterated on training data to hit 98% accuracy.

5

Validation

Tested at the Cary Police Department gun range with Chief Terry Sult and Councilmember Sarika Bansal. System performed under real gunshot acoustics.

6

School & Policy Outreach

Presented to school board for deployment consideration. Authored a research paper on gun violence prevalence in schools. Also ran safety workshops and participated in school shooter drills.

Results & Impact

  • 98% gunshot detection accuracy with sub-1 second alert time
  • Validated at Cary Police Department gun range with live fire
  • Received Award for Excellence from Police Chief Terry Sult
  • 1st Place at NC Science and Engineering Fair (NCSEF) 2024
  • 1st Place at NCSAS Science Fair 2024
  • Presented to school board for potential deployment
  • Estimated hardware cost ~$100 vs. $90,000/sq mile for commercial systems
Back to all projects