PORTFOLIO > Nerf Sentry Gun

Categories , , ,
When? February 2009 - May 2009

What is the Nerf Sentry Gun?

Sick of pesky intruders breaking into your secure facilities?  Worry no more!  The Nerf Sentry Gun uses MATLAB-based image recognition and motion tracking to identify trespassers and only permits entrance to those who present the proper credentials.  When a trespasser is detected, their image is uploaded to twitter and a website, then the gun tracks their motion and fires nerf darts at them until they have been “neutralized.”

 

This is one of my most popular projects, with over 300,000 views on youtube.  Be sure to check out the github link below – This project was extensively documented.  The blog post also includes lots of pictures.

System Walkthrough and Demo

Features

Authentication Mode: In this mode, anybody moving in front of the sentry is prompted to display their badge.  If they do not comply, the sentry gun will track their movement and fire darts at them.  Anybody who enters has their image uploaded to the web (cs1114.jeremyblum.com) along with the date of entry, and whether or not they were approved to enter. This information is twittered as well( www.twitter.com/nerfsentrygun).

Freefire Mode: Tracks and shoots anything that moves.

Panic Mode: Plays a siren, turns on the gun, and rotates the gun semi-randomly.

Manual Mode: Allows you to control the gun manually.  Arrow keys rotate the gun, and the space bar fires.

How it Works

MATLAB Image Tracking

A MATLAB program is responsible for performing all image tracking tasks.  A USB webcam and the image acquisition toolbox allow MATLAB to capture a video stream and analyze frames to ascertain velocity vectors.  Scale-Invariant Feature Transform (SIFT) image recognition software is used to identify a badge in authentication mode.  A custom MATLAB GUI is used to switch between modes, change color maps, and more.

National Instruments USB DAQ-6008

This digital I/O device was interfaced to MATLAB using the data acquisistion toolbox to allow for control of the trigger and gun.  Channel 0 outputs a 5V signal to a mosfet in the handle of the gun that activates the trigger.  Outputs 1 and 2 connect to a basic stamp motherboard for control of the rotation servo.  MATLAB can be used to turn these outputs on or off at the appropriate times.

Basic Stamp 2 and Motherboard

A basic stamp was responsible for controlling the rotation servo.  Upon receiving an input signal from the DAQ, it will rotate the servo right or left (depending on which input was activated).  It also interfaces to two hooks that sit behind the gun and act as limit switches.  When the gun rotates all the way in one direction, a hook on the gun attached to a 5V rail makes contact with a hook connected to the basic stamp.  This sends a 5V signal to the stamp on this channel so the stamp knows to stop rotating the motor.

Trigger Circuitry

A trigger circuit was assembled in the handle of the gun; it runs in parallel with the existing trigger, so the gun can still be fired manually.  Sending this circuit a 5V signal from the DAQ tells it to close the motor circuit and fire the gun.  The schematic for this circuit is included in the download below.

Physical Setup

A futaba servo is attached to the bottom of the gun.  Modifying the original tripod mount allowed us to attach it fairly easily.  Unfortunately, this motor does not provide a huge amount of torque.  This is why the gun turns somewhat slowly.  To compensate slightly for this, we made the battery pack external to reduce weight on the motor.  This motor setup is attached to two metal napkin holders (totally not stolen from a dining hall) using gorilla glue.  The entire setup is on a cardboard sheet to maintain proper spacing.

Nerf Sentry Gun Schematics, Source Code, and Documentation

The Nerf Sentry Gun is comprised of entirely open source hardware and software.  You can download all materials in the GitHub Repository.  This project is licensed under Creative Commons Attribution Share-Alike.

Creative Commons Open SourceOpen Source HardwareGet it on GitHub

My Blog Posts about the Nerf Sentry Gun:

Nerf Sentry Gun News: