Nerf Chronograph and Rate of Fire Barrel

100

1

3

Introduction

As a tinkerer it is always very satisfying to see the numerical results of your tinkering. Many of us have modified Nerf guns before and who doesn't love flinging pieces of foam across the house at over 100fps?

After modifying many Nerf guns throughout my life, starting when I was ~10 with my Dad until now when me and my roommates continue to fling foam across the apartment at each other, I've always wanted to know exactly how fast the darts are flying, and how many darts per second my roommates Rapid-Strike shoots. There are commercial chronographs available for Nerf and Airsoft, but the high precision ones are expensive, and it fun to build one on our own. If you do want to buy one, Nerf released a barrel nearly identical to the one featured in this project (with some better industrial design) and it can be found here:

Nerf Modulus Ghost-Ops Chrono Barrel

The Nerf version is also battery powered, and displays a counter for darts fired. The Instructable here also includes a screen and a reset button, however relies on dart length for speed calculation, and doesn't appear to use interrupts. The main focus of this project will be on the serial communication (as a simple example such as this was not the easiest to find online), and the use of interrupts for accurate timing. This can likely be easily converted into an airsoft chronograph for the same reasons with a tighter enclosure and a better mounting system for airsoft guns. Without using interrupts the code can be slower and less efficient, it is also much more difficult to time in regard of microseconds accurately as milliseconds will not produce accurate values for dart speed.

I will not focus too much on the enclosure design although STL files are available in the GitHub, because anybody can just buy the Nerf version which is definitely better for actual game play, but a future version of this may mitigate the results.

Basic Principles (Learning Outcomes):

  • Has the form of a standard Nerf Barrel
  • Use of phototransistors as timing gates for the dart.
  • Shows the use of Adruino interrupts for timing
  • Use of Processing with Arduino for Serial Communication

Project Scope:

I plan to go over mostly specifics to this project with some brief overviews and recommend reading the references for Arduino and Processsing for more specific info. This will not teach you how to solder, but more of a how to integrate Arduino and Processing and use interrupts. Much of this learning will be through reading the actual commented code so please ensure that you read through all of the code before blindly uploading and attempting to get it to work.

Benefits over Similar Projects:

  • Use of Interrupts for accurate measuring of high speed
  • Extensive debugging section for phototransistors
  • Rate of Fire (ROF) Calculation outputting Rounds per Second (RPS)
  • Fullscreen computer interface - not useful during battle, but great if you want to show others the results on stream or Youtube with a screen recorder.
  • Potential to be adapted for Airsoft or Paintball by modification of just the enclosure
  • No need for custom PCBs (Would be nice in a future update but anybody can make this for relatively low cost
  • Total cost of under $10 when parts are parted out and if a 3D printer is available - On par with the commercial cost, with ROF addition

Step 1: Required Parts and Tools

If you have a 3D printer this will be a great project for you as I will be providing the files for the enclosure. Feel free to update the enclosure. I didn't have any LCDs on hand, but a second version will hopefully have an LCD and utilize a WEMOS D1 or similar WiFi/BT enabled board, and a battery. This will allow for data logging on mobile and real time feedback - for example, how many darts are left in the gun. Some soldering experience is recommended, if you don't feel comfortable I recommend following an Instructable for soldering and probably buying extra electronic components just in case.

Required Tools:

  1. Soldering Iron
  2. Hot air blower/ Heat Gun/ Lighter (If using heat shrink)
  3. Wire Strippers
  4. Mini - B USB Cable (or whichever cable is required for your micro controller)
  5. Hot Glue Gun or Similar (I used a 3D printing pen to attach all components to the 3D printed enclosure)

Required Materials:

  1. 22AWG Solid-core wire ex: Solid Core Wire Set 22AWG
  2. Arduino Nano (or similar, I used a clone) ex: 3 x Arduino Nano (Clone)
  3. Resistor Kit (2 x 220 ohm, 2 x 220k ohm) You may be able to use lower value pulldown resistors such as 47k with success, I just happened to find that I needed this value for it to work. The troubleshooting guide outlines how to determine if the pulldown resistor is the correct value for your specific phototransistor and LED set. Because of this I reccomend getting a set: ex: Resistor Set
  4. 2 x IR LED ex: IR LED and PhotoTransistor Set
  5. 2 x PhotoTransistor
  6. 1 x 3D printed Enclosure - In an IR Opaque Filament (Hatchbox Silver Worked and was the only color I tested)
  7. Full Project Files are available here on GitHub as well as in the attached Zip File. The STLs are also availabe on Thingiverse here.

Step 2: Breadboard Testing

Once the electronics have arrived, solder leads to the phototransistors and IR Leds ~20-30cm for debugging, I recommend heat shrinking these. I didn't have the correct size heat shrink and had to utilize electrical tape for this prototype. This will allow for you to use them for testing in the enclosure. If you have printed the enclosure and have LEDs and photo transistors in the correct positions you can begin testing.

Ensure you have Arduino and Processing installed.

The zip file at the beginning has all the code as well as the STL files for printing the enclosure.

Use Arduino to debug at first and only use processing for final testing (you can see everything in serial monitor from Arduino).

You can try simply firing a Nerf dart through the chronograph with Chronogrpah_Updated.ino installed on the Arduino. If this works then you are all set. If this doesn't work then you will likely have to adjust the resistor values. This is discussed in the next step.

A little bit on how the code works:

  1. Interrupst stop the code whenever a dart goes through a gate and determines the time in microseconds
  2. The speed is calculated with this and the time is stored
  3. The time between shots is calculated and converted to rounds per second
  4. The time between gates is calcultated and converted to feet per second based on gate distance.
    1. Use of two gates allows for better results with identical timing (how much of the sensor must be covered) and reduces hysteresis
  5. The speed and rate of fire are sent via serial seperated by a comma to either the serial monitor in arduino or the processing sketch allowing for a nice UI (focus on processing when everything else works!).

Step 3: Testing and Debugging

If you did not have success with the initial test, then we need to figure out what went wrong.

Open the Arduino example AnalogReadSerial found in File-> Examples->0.1 Basics -> AnalogReadSerial

We want to ensure that the phototransistors are working as we expect them to. We want them to read HIGH when the dart is not blocking them, and LOW when the dart is not. This is because the code is using Interrupts to record the time when the dart is passing the sensor, and the type of interrupt being used is FALLING, which means it will trigger when going from HIGH to LOW. To ensure the pin is HIGH we can use use the analog pins to determine the value of these pins.

Upload the Arduino Example AnalogReadSerial and jump from the digital pin D2 or D3 to A0.

D2 should be the first sensor and D3 should be the second sensor. Choose 1 to read and begin there. Follow the guide below to determine the correct solution based on the readings:

Value is 0 or very low:

The value should be around 1000 initially, if it is reading a very low value or zero then ensure your LEDs are wired correctly and not burnt out, as well as aligned well. I burnt out my LEDs in testing when using a 100 ohm resistor instead of the 220 ohm. It is best to refer to the datasheet for the LEDs to determine the correct resistor value, but most LEDs will probably work with the 220 ohm resistor.

LEDs Work, and Value is still 0 or very low:

The issue is likely in the pull down resistor being too low in resistance. If you are having an issue with the 220k resistor, you could maybe increase it higher than this, but may get noise. You should ensure your photo transistor is not burnt out.

Value is a middle range:

This will cause a great deal of problems, mostly false triggers, or never causing a high. We need to ensure that a HIGH is received, in order to do this we need a value ~600 but lets aim for 900+ to be safe. Being too close to this threshold can cause false triggers, so we want to avoid any false positives. To adjust this value, we want to increase the pulldown resistor (220K). I already did this a few times in my design and you likely won't have to do this as this is a very large value for a pull-down resistor.

Value is very noisy (jumping around a lot with no external stimuli):

Ensure your wiring is correct with the pull-down resistor. If this is correct, you may need to increase the value of the resistor.

Value is stuck at 1000+, even when blocking the sensor:

Ensure your pull-down resistor is wired correctly, this is likely to occur if there is no pull-down. If this is still an issue, try reducing pull-down resistor value.

Value is high and goes to zero when blocking the light:

This should be sufficient for the sensor to work, however we may not be a fast enough response as the dart crosses the path. There is some capacitance in the circuit, and with the 220K resistor it may take some time for the voltage to fall below the required threshold. If this is the case, reduce this resistor to 100K and see how the tests work.

ENSURE ANY RESISTOR CHANGES ARE CONSISTENT BETWEEN BOTH SENSORS

Ensuring identical circuits for both sensors maintains the same latency between the resistors which will allow for the best accuracy in measurements.

If you have any additional issues, drop a comment below and I'll do my best to help you.

Step 4: Hardware Assembly

Solder the components to the small PCB as seen here:

The leads for the LEDs and the PhotoTransistors should cut to length, approximately ___.

Solder the Arduino onto the board, and wire the resistors from the ground to accessible pins. Additionally ensure that the 4 Positive wires can be easily attached together. If you are having issues with this, you can strip a piece of the wire and solder it across all the leads at the end.

I wired the sensors to the opposite side of the enclosure, however feel free to wire either as long as you keep the sides consistent. I cut the wires to lengh and soldered the wires to each of the diodes last. I updated the wire routing slightly to provide more room and less worry for having some wires under the PCB and others over it for easy of use. The STLs are in the full project zip file at the beginning of the project.

Step 5: Final Assembly

If your PCB Holes don't match-up with the holes on the main chronograph body, you can likely secure the electronics in the enclosure with some tape or hot glue, I found it didn't need to be secured after the wire and USB were in place, however your results may vary. It is designed to allow for the pressing of 1.75mm filament into the screw holes for heat staking, however the PCB can also be screwed in or glued. The most important part here is ensuring the USB port is accessible.

Cover the electronics with the electronics cover, The updated Files should fit better than mine did and will hopefully press into place, however I utilized a 3D printing pen to weld the covers in place. You are now ready to fire some darts!

A future update may use internal routing for the wires, but the covers in this case yield slightly to the Nerf aesthetic.

Step 6: Chronograph in Action

Opening the Processing File: Chronograph_Intitial_Release will allow for a really nice user interface for the chronograph displaying both FPS and RPS (Rounds per Second). If you are having trouble connecting ensure you closed your Arduino serial monitor, you may also have to change the serial port in the code, but this is commented and should be simple. To reset the max values simply press the space-bar on your computer.

A little bit on how the code works (Photo of UI can be seen above):

  1. Receives input from the Arduino
  2. Compares this to past input to find the max value
  3. Displays the current and max values in full screen for easy visual feedback
  4. Resets max value when space is pressed

Step 7: Future Plans

A future update for this will include the following improvements. If you have additional features that you would like, let me know and I'll try to implement them.

  1. Include LCD Screen
  2. Include Batteries
  3. Nerf Compatible Attachment points
  4. Updated Enclosure
  5. Iron Sights

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • Fandom Contest

      Fandom Contest
    • Pets Challenge

      Pets Challenge

    3 Discussions

    0
    None
    MrGwillickers

    Question 16 hours ago

    Ok. I have a few questions after trying this.
    1) in the picture it looks like your phototransistor is 3 pin, but the link you provided is 2 pin and I only see 2 pin on the wiring diagram. Are the 2 pin ones sufficient?
    2) the wiring diagram shows one phototransistor with the resistor going to the - and the other going to +. Which is correct?
    Thanks for this awesome project, otherwise.

    1 answer
    0
    None
    MrGwillickers

    Question 1 day ago

    I'd like to make my own case for this. How far apart are the sensors?