Introduction: 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.

Version 2

Since my original instructable I decided to make some small modifications on the gun and overall design. I basically made it so you could power it like a normal nerf gun, but instead of regular D batteries this would run on a mobile power bank. I also fleshed out what i had originally designed. I had designed the gun to fire when you heard the phrase "say hello to my little friend." I have also included a little clip of it working. Finally I have included the workings of a little prank I pulled on an office co worker. I didnt include tons of pictures in the version 2 because I wanted you (the reader) to be able to grasp the idea and apply to your scenarios more loosely because i feel thats more organic and natural to how to come up with some of this stuff. I also left my original instructable unedited so that there would be some continuity in the development of the idea.

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

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

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.

Version 2

I added a couple of variations to my original wiring.I wanted to be able to have an independent power source as well as a Bluetooth one. To accomplish this I added a usb cable and a power bank (ideally I found a power bank having power over 1amp is ideal). Rather simply you remove the cables from the + and the - (located very obviously in the picture). You should take 1 short black chord from the AC connector and bind it to the black chord on the usb and the bind it to the negative of the gun. I found the best tequnique to be using a little bit of solder as the wires can be delicate and solder can add some durability. Next take the power wire and solder it to a red power wire leading from the + power originally attached battery. Bind the usb power adapter to this group. Take another power wire and add it to the AC adapter and lead it outside the gun. You should now have two red wires leading out of the gun and a usb adapter left inside. I took a Mobile power bank and attached it with tape so it could be removed if need be for charging and what have you.

Step 4: 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.

Version 2

The whole idea of plug it in and your done is never that simple. I realized there were some issues with the code so you might need to tweak it a bit to have it fit your parts just right.

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!

Version 2

So my original user trigger changed to using an android app called tasker. Tasker is an app that is restricted to android. Tasker is a simplified app program that allows you to create miniature programs that dont involve using the heavy work of programming "language." The tasker add ons that were needed to create this effect was "auto voice" and "auto input." Auto voice was fairly straight forward to create the command. Auto input is a little more tricky. Essentially you have to work through each of these layers to create the objective you want. Its worth tinkering with. ITs good learning.

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.

Version 2- My prank. My concept was to put my modified nerf gun and to have it shoot at the person who opens the door. The only additional element that I needed to come up with was creating a sensor that needed to be tripped. I used an old android phone-added tasker and added an accelorometer to trip the trap. Just a fun idea.

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.

Version 2

Hope some of these mods have been interested. Thanks for reading

Bluetooth Challenge

Runner Up in the
Bluetooth Challenge