Raspberry Pi Motion Tracking Airsoft Turret

Introduction: Raspberry Pi Motion Tracking Airsoft Turret

Learn how to build a motion tracking airsoft (or nerf gun) turret with a raspberry pi 3. The airsoft turret is autonomous so it moves and fires the gun when it detects motion. There is also an interactive mode so that you can control it manually from your keyboard. This project is small, lightweight and entirely battery operated.

Since this device fires projectiles, please use the necessary safety precautions while operating the turret.

Step 1: Materials

You will need a few materials for this project.

1 x Raspberry Pi: https://www.arrow.com/en/products/raspberrypi3/ra...

1 x Electric airsoft gun

1 x Raspberry Pi compatible webcam (We used a Logitech C210)

1 x Stepper Motor HAT: https://www.arrow.com/en/products/2348/adafruit-i...

2 x Stepper Motor NEMA 17 200 steps/rev: https://www.adafruit.com/products/324 or https://www.adafruit.com/products/324

1 x Single Relay: https://www.amazon.com/gp/product/B00VRUAHLE/ref=...

1 x Step up converter: https://www.amazon.com/gp/product/B011EBSKK0/ref=...

1 x Mobile cell phone battery: http://www.ebay.com/itm/12000mAh-Dual-USB-Portabl...

1x Female to female jumper wire kit: https://www.adafruit.com/products/826

2 x Micro usb cables

2 x 90 degree metal brackets

10 x #8 1/2" screws

16 x #8 washers 8 x M3 screws

1 x 2' by 2' 1/4" MDF sheet


- Soldering Iron

- Solder

- Speaker wire

- Saw or jigsaw

- Drill

Step 2: Instructions

We created a step-by-step guide on how to construct the turret, load our custom code on the raspberry pi, and calibrate the turret. No coding experience is necessary, but you can modify our code to add more functionality if you want.

Step 3: Resources

Get the code and the project instructions on our github page: https://github.com/HackerHouseYT/Tracking-Turret

Download the 3d printable files on our Hackaday.io project: https://hackaday.io/project/18665-motion-tracking...

I2C setup guide: https://learn.adafruit.com/adafruits-raspberry-pi...

Adafruit stepper motor HAT: https://github.com/adafruit/Adafruit-Motor-HAT-Py...

OpenCV 3 on a Raspberry Pi 3: http://www.pyimagesearch.com/2016/04/18/install-g...

If you don't have access to a 3d printer and you would like to support us by purchasing a set of parts we made on our 3d printer: http://www.ebay.com/itm/332049674170?ssPageName=ST...

Be the First to Share


    • Hide It Challenge

      Hide It Challenge
    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge



    6 months ago

    That must hurt. Would be cool to make paintball one.


    Question 7 months ago

    Hey, could a raspberry pi zero work with it? I know the raspberry pi 3 is super affordable, but it'd be cool to have a $5 computer work with it. Thanks!


    Question 1 year ago

    can we get a basic block diagram of the project??


    4 years ago

    Awesome! I've been looking for a stepper version of this for a while. I'm going to use nema 23's and seperate drivers with a smallish 12v portable supply for a paintball sentry.


    4 years ago

    I built one of these back in 2013 using an Arduino Uno and a laptop. The laptop ran a Processing code that analyzed the webcam plugged into the laptop. Then via serial it would tell the arduino where to aim the pan and tilt servos. I used a wide angle webcam since the code I was using required a stationary webcam. My airsoft turret in 2013 was big due to the fact it required a laptop to run it autonomously. This one is almost exactly what i've been looking for.

    Mine used the same electric airsoft gun that you are using. I took my gun apart to wire directly to the motor to shoot. When I took it apart I realized there was a ton of empty unnecessary space in the gun so I sawed off the fake magazine and most of the handle. The only thing that would make your design better is to print your own basic airsoft gun using only the crucial components. You can make the turret a whole lot smaller if you could do this. I'm slowly learning how to create things in 3D, but I plan on making a 3D model of the inside of that airsoft gun to print the crucial parts necessary to fire the gun. Then I will make a simple small housing for it so I can reduce the turret size to be a lot smaller than using an off the shelf airsoft gun. I have a Raspberry Pi 3 since i'm a huge nerd and like to play with the latest stuff. The Raspberry Pi 3 is a ton faster than the original. What makes this project so cool is that you were able to use only the Raspberry Pi 3 to drive your whole project. This wasn't possible with the original Raspberry Pi since it was too slow and lacked compatibility with many webcams. I've been waiting to see a standalone solution for an airsoft turret like yours. I am going to take apart my old turret and build a new one based off of your code. I will power it off of lithium-ion 18650 batteries to give it plenty of power and make it rechargeable and most importantly completely wireless. Since the Raspberry Pi 3 has built in WiFi I can easily remote connect into it if I had to change anything. It might take me a while to do everything I want it to, but my goal is to have it as simple and as small as possible so I can easily use it in airsoft battles with my friends. Heck maybe I will make multiple turrets and place them everywhere if I can get them small enough to carry.


    4 years ago

    Hey man I love the project. Been looking for something like this for a while. However I am tight on my budget, what is the total cost for all of the components including the 3D printed parts.