The Cyberstrike


I'm a college student, and a game that some of us like to play is a game called HvZ. Since I also enjoy doing electronics projects, I decided that I'd mod a nerf rapidstrike into something with a little more punch. as I began taking apart the gun, I noticed something unusual.
The buttons were useless. They fell apart as soon as I exerted any force on them at all.
So I decided to gut it and use power electronics for all the switching!
The gutted rapidstrike. Notice the high voltage transformer in the top-left. Another post for another time.


I decided that I'd use the IRFP260N hexfet by Linear because I had a bunch of spares floating around my parts bin. In order to save space, I found a neat dual channel low-side fet driver chip called the ICL7667 by Intersil. After adding some diodes and capacitors to cut down on the transients, I soldered the circuit up. 
Not my best soldering job (the perf boards I was using were probably the cheapest boards I've ever used in my life), but I was happy with the performance. The two Rhino motors that I'd replaced the stock flywheel motors with were drawing about an amp total at no load, and the mosfets weren't even getting warm.
Later on, I decided to switch to the IRF540 in order to reduce the size and on-resistance. They likewise had no problem at these power levels. 


In order to interact with the microcontroller I'm going to be placing inside the board, I was going to need to mount some pushbuttons to the outside of the gun. Most pushbutton circuits are fairly simple though, and require polling in order to interface a large number to the MCU. Instead, I decided to use a more complex design that would enable the board to be responsive when it needed to be, and still have some extra cycles to devote to running other functions of the gun. 
The circuit, as I designed it, would enable the interfacing of up to six pushbuttons to the arduino through a 7-pin jack. The lines were all active-low, and there was a seventh pin on the bus that would go low whenever any of the individual buttons were pressed. By attaching this to an interrupt pin, the microcontroller would only need to poll the buttons when one of them was actively being pressed. 
Testing confirmed that the board worked exactly as I required it to. Another portion of the project was now complete. 


The rapidstrike, as any nerf aficionado will tell you, is a fully automatic device. It does this by having a piston mechanism inside that shoves darts off of the magazine and into the flywheel cage, where the wheels grip them and accelerate them towards the zombie menace.  It has a fairly complex wiring setup inside, because in addition to supporting the logic necessary to keep the piston out of the way of the darts when you're done pulling the trigger, it also has numerous safety switches that the nerf engineers insert to make sure your gun jams at the maximally inopportune time. The latter were easily ripped out and burned. The former was a little bit harder to replicate, and one of the primary reasons I was doing this project in the first place. You see, as soon as the first switch broke, I thought to myself "well, at least the switch that actuates the plunger mechanism isn't broken. That would be quite a bother to replace."
Of course the switch would break as soon as I attempted to desolder it from the pcb it had been embedded on.
I was going to have to figure out a different way to get the plunger to return to the starting location after the trigger had been pulled. Thankfully, I was already planning on using a microcontroller to control the motors, so all I had to do was use a switch to send a digital input. The question was simply how to do it.
I already had some limit switches on their way from amazon prime when I realized I had some reed switches and small neodymium magnets floating around my parts bin. A couple of hours of testing and hot glue (and a lot of broken reed switches) later, and I had this:
I was able to hook the motor up to the power supply, and the reed switch up to my oscilloscope, and the waveform finally looked good enough to use to actuate the plunger. I desoldered one of the diodes on the interface board and used one of the six jacks to plug into the reed switch, so that it wouldn't interfere with the operation of the pushbuttons. 


I had everything ready to go. All of the boards had been soldered and the wires connected. I wrote about fifty lines of code, which soon blossomed to two hundred as I began organizing my thoughts better and realized just how many safety mechanisms I was going to need to incorporate to make sure that
1.) It performed in a responsive manner
2.) It wouldn't jam/short itself out at any point and slag itself
After some testing it was working fairly well. There was one issue though: the plunger would often go so fast that it would overshoot the back of the mechanism and keep going, forcing the drivers to push it all the way out again so it could slow down enough to come to a stop on the next revolution. This equated to firing two or more rounds from a single trigger pull, which was unacceptable. The dual channel power driver wasn't going to be enough--I was going to need to add something.
The first thing I tried was a PNP BJT connected across the motor's terminals. The theory was that if I turned off the driver and turned on the BJT, I could short the motor into itself and brake it. This gave me limited success--I could drive the motor a lot faster, and it performed better, but it would still occasionally overshoot because of the large amount of momentum the plunger built up. I was going to need a bidirectional drive.
Thankfully, I had some L298N H-bridge drivers I had been saving for a rainy day. They can handle two different channels of 1.5A each, at up to 10V. I used two diodes to reduce the 12V of the lipo I was using to 10.6 volts, and it seemed happy enough. Then I combined the two channels with a shield I soldered up. 
I chucked the new module into my test setup, made a few modifications to the code, and finally got the gun working at a level that satisfied me for the moment. It was time to bring everything together. 


 Shortly after I finished soldering up the shield for the second motor driver, I realized that I probably wasn't going to easily be able to fit all the electronics inside the gun chassis. This left me with two options:
1.) Design some new kind of enclosure that would strap to the side of the gun and house the electronics
2.) Slap the electronics on the side of the gun with hot glue and hope nothing breaks.
A couple of years ago, I might have gone with option 2. Seeing as I'm not a total barbarian anymore, I decided to go with option 1.
Since my team mates and I are going for a "Brotherhood of Steel space marine" aesthetic, I decided to take the opportunity to fill my art quota for the year and slapped their insignia on the side of the electronics box. I did a quick test run of my 3D printer to make sure it was able to print the logo well. 


In my rush to get the firing mechanism to work, I had mostly ignored the nitty gritty of how I was going to take power from the battery and distribute it over the network of motor drivers, sensors, microcontrollers, and other assorted technobabble throughout the gun. It didn't matter a huge amount though--since I had a nice new enclosure for extra space, I soldered up a simple header board, slapped some smoothing capacitors on it, and had it ready for business before my enclosure had finished printing. The board had four header rails: one for five volts, one for twelve volts, and two for ground. Each rail had six ports each, which would allow me to plug in up to six devices of each voltage level. 
In order to supply the five volt power line, I wanted something beefy, and with good power decoupling, but also something that was small and cheap. I decided to use the Turnigy 12V 3A UBEC module, which is commonly used in RC devices. This meant it was perfect for my gun, as RC devices also commonly have big noisy motors on their power lines. I got one for a couple of bucks on Ebay. 


  1. Very nice. Using the bridge drivers was ingenious!


Post a Comment

Popular posts from this blog

UMPC Adventures: the Mix Yoga

The Wearable Computer--A Synopsis

Smart LED Strips: Revisited