Introduction: Simple Arduino Autofire Nerf Gun

Picture of Simple Arduino Autofire Nerf Gun

Introduction

This is a nerf elite hyperfire gun modified with a constant power source and that constant power source is controlled by an arduino grove Bluetooth and relay. This project was born out of youthful wonder, turned into adult pragmatism. In other words, I found a project I liked and tried it, but it was too hard so I modified it (cut corners). I find often instructables focus on the specifics of building something and can sometimes get lost in specifics. Fact is you could be reading this from anywhere in the world and it may not be possible for you to get your hands on the exact same parts as I am using. With that in mind, this instructable is really ideal for someone who is starting out as a "primer of sorts." To the more trained user it might give you some basics to build on and make some interesting versions. At the end I will hit on some variations of this project that I have made and would like to make, but my hope is that you can see a core of an idea and make something interesting for yourself out of it.

Step 1: Ingredients

Nerf Elite Hyperfire

grove arduino shield (https://www.seeedstudio.com/Base-Shield-V2-p-1378....

grove bluetooth (http://wiki.seeed.cc/Grove-Serial_Bluetooth_v3.0/)

grove relay (http://wiki.seeed.cc/Grove-Relay/)

arduino uno

Smart phone (I used an android, but an iphone would work to)

battery power cable to ac receptacle

ac adapter

tape

Step 2: Back Story

Picture of Back Story

I am a trained classic scholar and I sell mobile phones for a living. I love all things electronic, but would not describe myself as having a gift per-se. Rather I cling to the idea that if I work hard enough at something and study I can figure it out. A few years ago I found this project

http://hex-machina.com/hw/mindbullets

It uses the mindwave eeg brain sensor. I got one of these sensors and played with this and it was always in the back of my mind to build this mind controlled nerf gun. I dont have a ton of spare time, but when I was able to I would spend time with this project trying to get it working. I dabbled with arduino and programming, but I wasnt getting anywhere. I used a variety of different devices, but could never find things that would work properly. Maybe I went about it all wrong, but I spent quite a while trying to make sense of the mindwave code and fix programming issues that I did not have enough knowledge to fix. Then it hit me in a wave of pragmatic relief. If you break this project down to its basic components you have 1:the user trigger (the headset) 2:the guns trigger (the arduino) 3. the gun itself. I was struggling with 1 and 2 and I had not even gotten to number 3. The answer to number 3 was pretty simple: simply take the wires going to the battery terminal and put them towards a constant power. In stead of wiring it to behave a certain way, just tape the trigger down (I will comment on this later). 1 and 2 were a little bit different. The challenge with arduino was to find the right kind of bluetooth that would work similarly to this project, but since this project was 6 years old when I started it the technology and code had changed. To make things simple, I used the grove system by seeed studio. This allows you to do quick prototyping and not have to worry about wiring. That solved that. The final problem was the user trigger. I found the most versatile trigger was in the palm of my hand. My android phone. Android phones have so many programs written for them there is really no end to the different things you can use it for. I made the arduino code simple and the wring of the gun simple and, with the android phone, the user trigger became simple.

Step 3: Step1: the Gun and the Mods

Picture of Step1: the Gun and the Mods

The project that I referenced in my back story was a nerf vulcan gun. I couldnt find it at wal-mart so I bought this one. I cracked it open and examined the guts. These guns designs can be surprisingly challenging for a novice like myself. I couldnt find specifics on how to modify the gun so I was left trying to "reinvent the wheel" by figuring out the insides of what this particular gun does. My first step was to take the wires that went to the battery and move them to a terminal that could produce constant power. I took the number of batteries and the voltage they required and found an ac adapter to match. This part of the process is straight forward. Not much to it. Once I realized the rest of the mods i wanted to do would not be easy, I decided to take a short cut. To create the autofire effect I just taped the trigger down. Is it ugly? Is it lazy? Is it cheap? Yes! 100%. But it works. This is meant to provide a primer, if you are able to design something more elegant please do. I know there are people who are better at this, but I'm not and sometimes a functional solution is all a person can manage.

Step 4: Step 2: Arduino Hardware

Picture of Step 2: Arduino Hardware

This ended up being pretty easy. It can sometimes be tricky if your inexperienced or dont have the necessary hardware to be able to make your arduino work. Thats where the grove system comes in very handy. I used the relay, expansion board and Bluetooth. Pretty straight forward. No wiring required. Plug it in and your done.

Step 5: Step 3: Arduino Software

This is the program I used for my gun. I mucked it together from stuff I found online. Basically you connect to the arduino and once it receives a 0 the relay turns off (gun receives power) and a 1 turns it on (cuts power).

#include //Software Serial Port

#define RxD 6 //marked as D6 #define TxD 7

#define PINLED 5 //marked as D5

#define LEDON() digitalWrite(PINLED, HIGH) #define LEDOFF() digitalWrite(PINLED, LOW)

#define DEBUG_ENABLED 1

SoftwareSerial blueToothSerial(RxD,TxD);

void setup() { Serial.begin(9600); pinMode(RxD, INPUT); pinMode(TxD, OUTPUT); pinMode(PINLED, OUTPUT); LEDOFF(); setupBlueToothConnection(); }

void loop() { char recvChar; while(1) { if(blueToothSerial.available()) {//check if there's any data sent from the remote bluetooth shield recvChar = blueToothSerial.read(); Serial.print(recvChar); if(recvChar == '1') { LEDON(); } else if(recvChar == '0') { LEDOFF(); } } } }

/*************************************************************************** * Function Name: setupBlueToothConnection * Description: initilizing bluetooth connction * Parameters: * Return: ***************************************************************************/ void setupBlueToothConnection() {

blueToothSerial.begin(9600); blueToothSerial.print("AT"); delay(400);

blueToothSerial.print("AT+DEFAULT"); // Restore all setup value to factory setup delay(2000); blueToothSerial.print("AT+NAMESeeedBTSlave"); // set the bluetooth name as "SeeedBTSlave" ,the length of bluetooth name must less than 12 characters. delay(400); blueToothSerial.print("AT+PIN0000"); // set the pair code to connect delay(400); blueToothSerial.print("AT+AUTH1"); // delay(400);

blueToothSerial.flush();

}

Step 6: Step 4: User Trigger

This is one that can use a ton of creativity.

With any smart phone, download a Bluetooth terminal program and connect to your Bluetooth. Enter a 0 and enjoy!

Step 7: My Variation and an Idea for Another Version

The way I set up my gun is I used a program called autovoice and autoinput (android) and created a series of events where I could say the phrase "say hello to my little friend" and have the gun start firing.

One variation I might want my like to do is I was thinking of building an alarm system that would cause the gun to fire. Another one is to create a game for my kids- put a punch of pennies on a board and aim the gun at the board and see how many coins the kids can pick up without getting touched by the nerf gun.

Step 8: Conclusion

I hope you enjoyed my instructable. I was quite satisfied with the end result because it was neat and because it left the door open for some future projects. If you make something fun using my general guide please post it. If you have any ideas or thoughts on this project please post it. I like to think instructables is a place of people who want to learn from each other. If you liked my instructable I would love it if you would be willing to vote for me. Thanks for reading.

Comments

Kris82 (author)2017-08-16

Great Idea. I would like to see this gun in action though.

About This Instructable

492views

5favorites

License:

More by TylerV17:Simple Arduino Autofire Nerf GunFiber Optic Concrete Lamp
Add instructable to: