Go Down

Topic: Using Arduino to output (via USB) to a nerf gun? (Read 1 time) previous topic - next topic

Tsirist

I'm wondering if it's at all feasible to program an Arduino board to fire a nerf gun via a USB connection. Basic setup is to run the Arduino from a battery with several inputs (motion sensor, RFID reader, etc.) and triggering the USB gun depending on the conditions. I'm not too familiar with the actual functionality of USBs, but I'm hoping that even if the nerf gun typically uses specialized software on a desktop to trigger the firing then the same signal can be copied for use by the Arduino. If this is at all possible, what is the best way to go about doing this? Or is it simpler than that?

PaulS

You have a nerf gun with a USB port? What is the port normally used for? Links are nice.

Far-seeker

While you are getting those links that PaulS mentioned... ;) 

Theoretically it would be possible, but you'd have to know the command signals sent over the USB's data line.  If they aren't in the documentation, you'd need an oscilloscope or logic probe and a little work to determine the necessary commands.  Basically you'd take USB (use a 2.0/1.1 cable, I'm sure this type of desktop toy doesn't need a 3.0 USB bus) with at least one USB plug A and cut that plug off along with some spare cable.  Attach the data lines (see here) to either the 'scope or probe so you can read the signals being sent.  Then plug the modified cable into your computer, start up the program used to control the nerf gun, and finally record the data pulses associated with each specific command sent by the program.

Tsirist

#3
Nov 06, 2012, 10:02 pm Last Edit: Nov 06, 2012, 10:03 pm by Tsirist Reason: 1
Whoops, my bad! Definitely should've included an example. I don't have anything specific in mind yet but this was the inspiration. Sorry, I meant a nerf gun that normally plugs into a USB port on a larger machine.

Attach the data lines (see here) to either the 'scope or probe so you can read the signals being sent.  Then plug the modified cable into your computer, start up the program used to control the nerf gun, and finally record the data pulses associated with each specific command sent by the program.
Thanks a ton for that. Would it be as simple as outputting a certain number through the data lines to the gun or would you expect it to be more difficult than that? I'm guessing it depends on the design of the nerf gun but I'm not sure if there's a standard used for this purpose or not.

MichaelMeissner

Well one way is to use a servo to fire the trigger.  That doesn't rely on knowing any details about the protocol used to fire the projectiles.  Here is a video on how to use a servo to fire a camera shutter that madmeco sent me today: http://www.youtube.com/watch?feature=player_embedded&v=FhRnf90AYJU

Then there is instructable on how to fire a Nerf Vulcan via arduino: http://www.instructables.com/id/Arduino-Controled-Nerf-Vulcan/

If you can figure out the protocol, there is this USB rocket launcher: http://www.thinkgeek.com/product/8a0f/

PeterH

Using USB devices is easy, but writing USB device drivers is hard. Presumably you could interface to the NERF gun mechanically or electrically rather than electronically, if you wanted. That would eliminate the hardest part of the problem.
I only provide help via the forum - please do not contact me for private consultancy.

MichaelMeissner


Using USB devices is easy, but writing USB device drivers is hard. Presumably you could interface to the NERF gun mechanically or electrically rather than electronically, if you wanted. That would eliminate the hardest part of the problem.

Another approach using a Leonardo is have it simulate a keyboard and/or mouse, and have it connected to the PC with the Nerf attached via USB and issue the commands on Windows (or whatever OS you use) to fire the Nerf gun.  You can probably do this on an Uno with a USB host shield.

PeterH


issue the commands on Windows (or whatever OS you use)


This is the part that is an unknown. If there is a utility/application/API that can be run on a PC to fire the gun, and it is feasible to include a PC in the solution, then all you need to do is send a command over the serial link to execute the command to fire the gun - no USB emulation needed, just use the standard Arduino USB drivers. Is such an interface available, though?
I only provide help via the forum - please do not contact me for private consultancy.

MichaelMeissner


This is the part that is an unknown. If there is a utility/application/API that can be run on a PC to fire the gun, and it is feasible to include a PC in the solution, then all you need to do is send a command over the serial link to execute the command to fire the gun - no USB emulation needed, just use the standard Arduino USB drivers. Is such an interface available, though?

The USB rocket launcher that I linked to earlier in the thread (from thinkgeek.com) includes programs on Windows and Mac to fire the rockets.  I don't own it, so I don't know how clunky it is.

Go Up