Raspberry Pi Turns Nerf Gun Into A Beastly Call Of Duty Weapon But Still Needs Work

nerf gun call of duty news
Whether it's playing Duck Hunt on the NES with a Zapper or pumping quarters into Area 51 or Time Crisis in arcades, just about everyone is familiar with light gun games. The simplicity of these games is born from their "on-rails" design where players are automatically taken from area to area, and then just point and shoot. The trouble with them is you can't really dodge incoming fire, or control where you're going. However, one clever maker has built a way to play Call of Duty with a very familiar shooting device, and complete with player movement. 

It all starts with Fortnite -- or rather, a Fortnite-licensed Nerf gun. Alfredo Sequeida wanted to build a control interface into a Nerf gun, and the Fortnite-licensed Nerf AR-L Rippley seemed like a perfect starting point. The trigger is used for firing, while the secondary button handles reloading. He then used a 3D printer and some aluminum foil to create a series of additional buttons and built them into the front of the body, which allows for movement, switching weapons, and so on. He covers the whole construction process in depth in his YouTube video... 

Sequeida uses a Raspberry Pi 4 as the brains of this operation. It has a 40-pin GPIO block that can accept the signal from each button. When the Pi registers a button press or the trigger being pulled, it sends a signal to the host computer via its onboard Wi-Fi using a Python script that Sequeida has published to GitHub. The host PC runs its own server script to receive data from the client, which is the Pi 4 in this case, and translates it to input for the game. 

The last piece of the puzzle is movement. The Nerf gun doesn't have any sensors to send accelerometer data to the Raspberry Pi, but any old Android smartphone has the sensors and makes the data easy to read. Sequeida used an old Nexus 5 and wrote a small Android app with Google's Android Studio IDE to read accelerometer data and log it. The Pi 4 script uses logcat to read the accelerometer data and transmit that to the host PC as well. This movement then translates to mouse controls, so the player aims and turns based on the phone's accelerometer. This can -- and does -- result in the player pointing the gun away from the screen, but this is still a work in progress. 

The last few minutes of the video are dedicated to a play test, which is really fun to see. He's able to turn, fire, move, and do just about anything else in the game. Unfortunately, the accelerometer data needs a little massaging, as in the video it's definitely quite jumpy and not really ready for competitive play. All the same, it's a really creative idea and it's executed pretty well. If you want to try it for yourself, head on over to Alfredo Sequeida's GitHub page and grab a copy of the code.