Jump to content


Photo

Ammo Counter: The Ultimate Simple & Cheap Guide


15 replies to this topic

#1 Ming Batt

Ming Batt

    Member

  • Members
  • 12 posts

Posted 27 November 2016 - 12:15 AM

*
POPULAR

After seeing, for a couple of years, the hype, and of course this community's want for an ammo counter, what I wanted to do here is provide a comprehensive, yet easy and cheap step-by-step overview and tutorial on how to make one, for anyone to follow. I am an advocate of free knowledge, and after seeing the ridiculous prices of the seemingly monopolizing of ammo counters, I feel that members of this community should have the resources readily available to make their own, with the ability to add their own little kick and little features to make it unique.

 

IMG_20161113_024233860.jpg

 

Here's how it will work:

It's simple. When the trigger is pulled, count down 1 from the ammo. When a magazine is inserted, refill the ammo. A button can be used to toggle through the different magazine sizes: 5, 6, 10, 12, 15, 18, 22, 25, and 36. The last mode is counts up, starting from 0, which can be accessed from the toggling the magazine sizes. The magazine sizes will increment, with the press of the button, from 0, 5, 6, 12 … 36 and will not decrement, for the sake of simplicity.  

 
 

A Little About Myself

I'm just another 16-year-old developer from San Francisco, and I make games. None of them are finished, and none of them will be. But I want to spread computer science, computer programming, to realms where I see are highly applicable. I am self-taught on hardware, so that will explain a lot on that aspect of it. Oh yea, and I modify NERF blasters.

 

All the photos I used will be available in this Imgur album.

 

Let's Get Started!

This will be demonstrated on a Stryfe, but of course, this basic recycled concept can be easily applied to any blaster. NO PROGRAMMING EXPERIENCE NECESSARY! In fact, no programming will be done. But you should know how to use a computer.

 

Internals-Components Circled.jpg

 

BLACK circle: The power switch of the ammo counter itself, not the entire blaster.

WHITE circle: The display, where the ammo will be visible to the user.

BLUE circle: The microcontroller, the brains of the counter.

GREY circle: The magazine lock, re-purposed to for magazine detection.

PURPLE circle: The jam door locked, re-purposed for trigger pull counting.

GREEN circle: The switch to toggle between the various magazine sizes.

 

With the recycled magazine lock, we can use it to send some useful information to the microcontroller: whether the magazine is inserted or not. Just like how it was as a magazine lock, when the switch is compressed, a magazine is inserted. When the switch is not compressed, there is no magazine inserted.

 

The circuit is incredibly simple as well (I don't really know how to make schematics):

 

Schematics.jpg

 
 

Parts and Tools:

 

Tools:

  • Laptop/Desktop Computer (To program and upload code to the microcontroller)

  • Micro-USB charger (To upload code to the microcontroller)

  • Soldering Iron + Solder

  • Wire

  • Dremel/Rotary Tool (Cut slot in shell for display)

  • File/Sandpaper (Smooth clot in shell for display)

  • Standard tools for modifications: Screwdriver, wire cutters, pliers, etc

 

Here's what I used, and this tutorial will use these:

  • 1x Stryfe - $20

  • 1x Adafruit Pro Trinket (An Adafruit Trinket($7) can be used instead and still easily be able to follow this tutorial) - $10

  • 1x Unbranded OLED Display - $3

  • 3x 15k Ω Resistors (10k can be used) - 1¢

  • 1x Rocker Switch - 5¢

  • 1x Push button switch- 5¢

  • 2x Nuts + Bolts (To secure display, more can be used to secure the microcontroller,  but the ones I used were too big for the Adafruit Pro Trinket) - #4 - 40 x 3/8in - 10¢

  • .001x Epoxy Putty - 1¢

Total Cost: $33.34

Total Cost of counter: $13.34

 

A cheaper microcontroller can be used, including some Chinese Arduino knock off or this >$1 microcontroller (I'm still testing it) to knock the price down to $4.34, but other components may be required to get it working, including a linear 5v regulator.

 

1) Programming the Microcontroller

Let's first program the mircocontroller for before we start doing anything else. The rest of this will be demonstrated using the Adafruit Pro Trinket.

 

a. Download and install the Arduino Integrated Developer Environment (IDE) and its drivers. This process is a little different for using an Adafruit microcontroller, so follow these instructions. If you're on Linux, follow these instructions instead. If you already have the Arduino IDE installed, you can skip this step.

 

b. Download the source code for this project here. There should be a green button on the right labeled "Clone or Download". Click on it, and a drop down will appear. Then click on download ZIP. (Feel free to follow me and star my repositories). Unzip the folder you just downloaded.

 

what buttons to press.jpg

 

c. You can delete the entire folder 'tests' from the code you just downloaded. It contains some stuff involving different parts of the project, including the buttons and starting up the display. Keep it if you just want to look at the code or are interested in learning its content.

 

d. Now you are going install the libraries from the source code downloaded. A library is basically code that other people wrote, but we can use it too. The libraries included will be used for the display. If you need help installing the library, follow the steps here, and scroll down to 'Manual Installation'. They will be exactly what I will be doing.

The libraries to use will be in the folder 'lib' in the source code you just downloaded, and it should contain 2 folders: 'Adafruit_SSD1306-master' and 'Adafruit-GFX-master'.

Make sure not to have a window of the Arduino IDE before doing this. Find the location of the Arduino folder. Mine is 'C:\Program Files (x86)\Arduino\'. Once located, open the the folder 'libraries'. Drag the 2 folders 'Adafruit_SSD1306-master' and 'Adafruit-GFX-master' from the folder 'lib' from the source code you downloaded. That's it! You're libraries should now be installed.

 

e. Everything for the microcontroller is basically done, now you just have to upload the code onto the microcontroller. If you're on windows, you have to install the appropriate drivers for Windows.

Once completed, you have to select your board, since there are so many Arduino and Arduino compatible boards. If you installed the Arduino IDE with the instructions above, you should have no problem doing this. If you already have already had the Arduino IDE installed and didn't follow the instructions above, import the Adafruit boards by navigating to Tools->Boards Manager and search 'Adafruit' into the search bar, and install the one titled 'Adafruit AVR Boards'.

Select the Pro Trinket 5V/16MHz (USB) board from the Tools->Board menu at the top. Next go into the Tools -> Programmer menu and select the USBtinyISP programmer.

Select your port by following the instructions in the image below.

 

select port instructions.jpg

 

Now plug in the Adafruit Pro Trinket into your laptop using a micro-USB cable into the specific serial port. A green LED, indicating power, and a red pulsing LED, indicating that the Pro Trinket has entered bootloader, should turn on. Once the red pulsing light stops pulsing, press the only button on the Pro Trinket and wait for the red pulsing light to start back up. Once it turns back on, press the Upload button at the top left the Arduino IDE, as identified by the right pointing arrow and to the right of another button with a check mark in it. Some text should print in the message area, at the bottom of the window. When a message, "Done Uploading" appears, your code has been uploaded onto the Pro Trinket! You should see a red LED on.

 

upload button.jpg

 

You are now done with everything on the computer and The Pro Trinket is completely set up!

 
 

2) Shellwork

Now let’s get started with the blaster!

 

a. Open it up and take out the internals. Needless to say, store them somewhere so you don’t lose them, etc. Don’t throw out any parts! There is a good amount of reusing of parts in this. Be careful with the switches too, as they will be repurposed.

 

b. Remove all locks, replace the motors/cage/flywheels or whatever you want to do here. Make sure the stuff you’re doesn’t get in the way of the ammo counter though.

 

c. Cut a hole in the shell where you want your display to be located. Not that only a certain part of the display is actually used to for displaying content, and that’s the part with the screen protector over it. Once the hole is cut, file it down for smoothness. It doesn't need to be that clean; just look at mine.

 

Here’s how I placed my display:

IMG_20161106_142653754.jpg

 

d. Line up the display to the slot you just cut, and drill some holes where the top screw holes of the display are. I recommend using only two, both at the top, because the vexing angle of the magwell may get in the way of using the bottom securing holes.

 

Here’s what mine looks like, from the outside. The cut itself isn’t too smooth and it may not be too aligned, but it does the job.

IMG_20161106_150306727.jpg

 

e. Drill some holes for the two switches required: magazine size selector and power switches. I attach the switches just yet, as it will be much easier to solder them first and then adhere them into the holes.

 

I put mine like this

switch placement.jpg

 

The BLACK is where I put the magazine size selector switch, and the BLUE is where the power switch is, with the little nub of the rocker protruding from the hole. Keep in mind, if you place the power switch where I put mine, you will have to shave off a little of this nub on the other side so the blaster can close:

The nub has already been removed here.

nub to remove.jpg

 

f. All the shellwork is now completed, and now the blaster must be rewired for recycling of the switches. Rewiring is not completely necessary, if you want to use different switches for the magazine insertion detection and trigger pull detection. Make sure to keep the magazine release switch and the jam door lock switch, as they will be repurposed.

The jam door lock switch has three pins, while the rev switch and the magazine lock switch should have two.

 

g. Reassemble the blaster, make sure it all works, but don’t close it up.

When reassembling, this part does not need to be reinserted, the covering of internal wires in the magwell, as it will get in the way of the display:

IMG_20161126_154535736.jpg

 
 

3) Electronics

Now that the blaster is complete, the electronics portion of it has to be done. This is the last step(s).

 

a. Make sure to desolder the headers pins, the little pokey legs sticking out of the board, of the display and the Pro Trinket, if they came with it. They will get in the way of soldering the wires, and trust me, it’s a lot easier to solder them onto the tiny holes than onto the header pins.

I desoldered the headers by first, pulling off the black spacers from the pins, and then desoldering each and every pin off. Don’t worry about getting all the solder out, It won’t be an issue.

Headers pins are often used while testing, so the entire board itself can just slide right into the breadboard.

 

b. Let’s solder all the switches individually before soldering them onto the Pro Trinket. Make sure all the wires are long enough, 4” - 5” should be plenty and keep track of which switch is which.

Here’s how I soldered them:

IMG_20161126_160436006.jpg

 

c. With the switches all soldered, let’s hit the display now. Make sure all the wires are long enough, 5” - 6” should be plenty. It should be something like this, with the wires long enough to be able to be soldered onto the Pro Trinket:

IMG_20161126_161445815.jpg

 

d. Now that the soldering is done on all of the components, solder them onto the Pro Trinket, with the wires of each going into the board as specified by the images.

As a reminder:

input wiring.jpg

 

I solder them by first stripping and tinning a tiny piece of the wire, a little less than ⅛ an inch. Then, I slide it through the hole of the pin I want to solder it to, and warm up the upper part of the wire. Once the wire is hot enough, I melt some solder onto the base, where the hole of the board meets the wire.

If there is already solder in the holes, possibly from the removing of the header pins, that blocks the insertion of a wire from the first method, simply warm up the solder, which can be done by either touching the solder itself or touching the gold color surrounding of the hole, until the solder liquifies. Then, while the solder is still in liquid form, push a tiny piece of the wire through it. Once the solder cools, it should be strong, but if it’s not, simply repeat the second part of the first method to get more solder onto the connection for extra strength.

 

e. The soldering is almost all complete! Now we just have to install the components as a whole. Let’s put the display in first. Feel free to remove the screen protector now. Insert the nuts and bolts into the holes you drilled and the screw ports of the display. I actually placed a dab of hot glue on the nuts to prevent them from loosening under the vibration of the motors.

 

Mine look like this:

display installed internal.jpg

Apologies for worse image quality, but I zoomed in from another image.

 

f. The power switch can simply be placed where the jam door lock used to be, but a bit of dremeling may be necessary. Solder it to the correct leads of the NERF battery leads. If placed in this spot make sure to shave down some of a protruding nub from the jam door, like so:

jamdoor nub.jpg

 

g. Next is the magazine size toggle switch. Simply place it in the hole, and make sure it’s still pressable. Use epoxy putty, or any adhesive or your choice, to attach it, but don’t use hot glue as it is extremely weak and will fall apart fast. It’s fine if the epoxy putty spews out. That’s what mine is like.

 

Here’s what my magazine size toggle and power switches look like:

IMG_20161126_170837794.jpg

 

IMG_20161126_170846041.jpg

 
 
 

h. Make sure the ground of the NERF battery lead is connected to the power switch, and the other connection from the power switch is connected to the ground pin of the Pro Trinket. Also, the + pin on the Pro Trinket should be connected to the + lead of the NERF battery tray. Soldering is now complete! Insert some batteries, flick the power switch, and a green LED from the Pro Trinket, indicating power, should light up, with the display powering up shortly!  If not, make sure the circuit is correct and the program is uploaded.

 

i. Place your Pro Trinket next behind where the trigger mechanism goes, underneath the roof of the shell. There is a ton of extra space here where nothing will get in its way, like so:

microcontroller placement.jpg

 

j. Place the magazine insertion detection switch where the magazine lock switch used to be, underneath the panel near the magwell in front of the main trigger, and make sure it is pressed by the little angled piece that sticks out. This will make sure that all magazine insertions and removals are registered by the Pro Trinket. This switch is secured with the panel, previously keeping in the locks, so epoxy putty or any type of adhesive is not necessary here.

 

k. Next is the switch to count the trigger pulls. Place it wherever you want, but make sure that when the trigger is pressed, so is the switch.

Epoxy putty it into place. Here’s where I placed mine, where it won't get in the way of any moving parts:

trigger counter switch placement.jpg

 

l. Your blaster should already be reassembled, just place the other half of the shell and it’s ready to go!

 

m. This step exists because the first letter of my name starts with ‘m’.

But here's a final internal picture for reference:

IMG_20161126_114417252.jpg

 
 

Using Different I/O Pins: (Requires “coding”)

At line currently 79, there should be a line like this:

changing IO Pins Code.jpg
 

Simply change the values of the numbers. The first value, corresponding to the trigger counter switch, should correspond to the pin you are to solder the trigger counter switch input wire to. The second value corresponds to the magazine detection switch; the third magazine size toggle.

There are comments in the code to help you with this.

 

Changing the Various Magazine Sizes: (Requires “coding”)

Underneath the code storing the values of the pins is the code to store the values of various magazine sizes, currently line 96:

Edit the values to whatever you want. You can even remove some of them or add your own. But remember, when the magazine toggle switch is pressed, it selects from left to right, and then starting back at the first(zeroth) value when it reaches the end. Also, the first value will be the default value, this is what the current ammo will be when the microcontroller turns on.

 
magazine sizes code.jpg
 

There will be comments in the code to help you with this.

 

 

Notes:

- The resistors for the buttons may not be completely necessary, as in my testing, I saw their absence didn’t change much.

- Both the Pro Trinket and Trinket can be directly powered by the same battery as your NERF blaster, unless it exceeds 16v. If it does, consider a way to drop the voltage or power it from another battery source.

- With the use of other mircocontrollers, many other components may be needed, including a linear voltage regulator and its other corresponding resistors, capacitors, etc. That’s why I chose the Pro Trinket, as it doesn’t require these.

- The current draw of this entire ammo counter is low, so you don’t have to worry about that

- I am aware that the code isn't that good. It's not my best, not my neatest, unconventional, and it's not too efficient for working with microcontrollers, but it should be fine for this application.

- There are comments in the code, so the inexperienced can read it and see what's happening

- No special magnetic magazine size detectors. I just think they're too much work and not worth it. But don't worry, a new and better method is coming soon.

- This will not work on some blasters. I am developing a method for those, too.

- When a magazine is not inserted, the display will always show 0.

- A magazine has to be inserted before toggling the magazine sizes and having their values show up on the display.

- Clearly visible display outdoors, due to the decently high brightness of the display as well as the high contrast between the black background and white text, as well as nicely lit up indoors, without being too bright.

- Be sure to keep the magazine lock switch as the magazine insertion detection switch, as the pins are connected when the switch is not pressed and disconnected when the switch is pressed, so I anticipated that in the code.

- When using the Adafruit Pro Trinket, once the power is turned on, it will enter bootloader before turning completely on, so the display will not power on until a few seconds.

 

Links:

Website: In Development

Overview Video

Video Tutorial - Shell Modifications (Part 1)

Video Tutorial - Electronics & Software (Part 2): In Development

Uploading the Code: In Development

 

 

Closing Remarks:

Purchase:

Spoiler

 

MANY more features soon to come, with complete tutorials for all of them, stay tuned!

Any questions, comments, problems with this, please PM me or comment below.

 

Thank you so much for reading!


Edited by Ming Batt, 01 January 2017 - 08:44 PM.

  • 2

#2 The2ndBluesBro

The2ndBluesBro

    Member

  • Members
  • 576 posts

Posted 27 November 2016 - 12:19 AM

Very well written tutorial.
  • 0

Nerf, Gaming, knives: https://www.youtube....FjcObRZTl2KReDQ

 


#3 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,192 posts

Posted 27 November 2016 - 03:39 AM

Interesting. I'm (slowly; oh so slowly) working on a strayvan build and am considering adding an ammo counter. This will either help tremendously or solve that step for me (if you decide to sell, your forcasted price is pretty reasonable IMO).

My only fairly minor suggestion is that you either consider removing 5 and adding 20 or add a note on how to change the counter values to the tutorial. You've probably commented it and it's probably in the code, but still. I think buzzbee mags are 20 rounders, and I don't know of any 5 round mags. I'd also probably only ever use 6, 12, 18, and count up, so if it was easy to change/eliminate values in the counter on the user's end that'd be awesome.

Edited by Meaker VI, 27 November 2016 - 03:41 AM.

  • 0

#4 Psylocke

Psylocke

    Member

  • Members
  • 28 posts

Posted 27 November 2016 - 10:21 AM

Really cool, I love the concept.
  • 0

Psylocke


#5 jwasko

jwasko

    PowerBeard

  • Moderators
  • 1,021 posts

Posted 27 November 2016 - 08:29 PM

You know more than I do, but you linked to a 5V logic pro trinket and a 3V3 logic regular trinket. Is it cool to use either/or, or did you mean to link the 5V version?


  • 0

-Jwasko, STILL Sole Surviving member of Steel City Nerf and Sober Sister of the Sex Dwarves
We NERF ON all day, and FUCK OFF all night


#6 Ming Batt

Ming Batt

    Member

  • Members
  • 12 posts

Posted 27 November 2016 - 09:15 PM

Thank you everybody for your positive feedback!

 

 

Interesting. I'm (slowly; oh so slowly) working on a strayvan build and am considering adding an ammo counter. This will either help tremendously or solve that step for me (if you decide to sell, your forcasted price is pretty reasonable IMO).

My only fairly minor suggestion is that you either consider removing 5 and adding 20 or add a note on how to change the counter values to the tutorial. You've probably commented it and it's probably in the code, but still. I think buzzbee mags are 20 rounders, and I don't know of any 5 round mags. I'd also probably only ever use 6, 12, 18, and count up, so if it was easy to change/eliminate values in the counter on the user's end that'd be awesome.

If you would like to use this, or something like this, with your Strayven, I highly recommend you place the USB port somewhere easily accessible without opening the blaster. The area in the upper part of the Rayven stock, with the port accessible through the Rayven's jam door, is where I placed my microcontroller in my Demolisher-Rayven integration, if that portion of your blaster is free.

 

The price may also still drop, and I'm planning an even lower price for those who pre-order.

 

Yes, I have updated the code to accommodate for the 20 round magazines. I've seen somewhere of people modifying their 6 round mags for 5, so that's why I added the 5 round as a option.

I have also edited the post for users to input their own magazine sizes.

 

 

You know more than I do, but you linked to a 5V logic pro trinket and a 3V3 logic regular trinket. Is it cool to use either/or, or did you mean to link the 5V version?

Apologies, the link has been fixed and now directs to the 5V version. Thanks for catching that. Although, in my testing, this project worked completely fine with 3V logic.


  • 0

#7 Silly

Silly

    Member

  • Members
  • 244 posts

Posted 29 November 2016 - 10:25 AM

Buzzbee has/had 5 round Clipazienes if im not mistaken.
If it wasnt buzzbee it may be airzone.

Edited by Silly, 29 November 2016 - 10:26 AM.

  • 0

Co-Owner of the History of Nerf Modding research project, moderator of r/Nerf, owner of BlasterWiki, maker of 3d printed blasters (GitHub/Thingi) and Nerfy art.


#8 Daniel Beaver

Daniel Beaver

    HQRSE CQCK

  • Moderators
  • 2,097 posts

Posted 29 November 2016 - 01:45 PM

This is great, thanks for posting. This would be a cool feature to have on a Vulkan with an extended box mag.


  • 0

#9 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 02 December 2016 - 09:45 AM

You're right in that the 3 resistors on the buttons aren't really necessary. The ATMEGA328 has internal pullup resistors, so when you set the pinmode in software, if you set it as pinMode(pin#, INPUT_PULLUP) to use the internal pullup instead. 

 

Save a few cents! lol


  • 0

#10 Ming Batt

Ming Batt

    Member

  • Members
  • 12 posts

Posted 02 December 2016 - 11:41 PM

You're right in that the 3 resistors on the buttons aren't really necessary. The ATMEGA328 has internal pullup resistors, so when you set the pinmode in software, if you set it as pinMode(pin#, INPUT_PULLUP) to use the internal pullup instead. 

 

Save a few cents! lol

Good point, but I would like to make this as versatile as possible, so in the situation where I, or someone else does not use the ATmega328, this code would still be able to work with them.


  • 0

#11 ENP10

ENP10

    Member

  • Members
  • 49 posts

Posted 03 December 2016 - 12:27 AM

How will they be sold, In kits? Pre-installed?
  • 0

I Found some epoxy putty hidden in the basement and freaked out.


#12 JospehSquared

JospehSquared

    Member

  • Members
  • 35 posts

Posted 03 December 2016 - 12:42 PM

I believe he is planning on selling kits.

I followed the tutorial though and it didn't take to long. It was fairly simple and well explained.


  • 0

#13 Ming Batt

Ming Batt

    Member

  • Members
  • 12 posts

Posted 03 December 2016 - 10:20 PM

How will they be sold, In kits? Pre-installed?

I will be selling both self-install kits and pre-installed into the available blasters of the customer's choice. More details to come in the future!


  • 0

#14 ENP10

ENP10

    Member

  • Members
  • 49 posts

Posted 03 December 2016 - 10:45 PM

I will be selling both self-install kits and pre-installed into the available blasters of the customer's choice. More details to come in the future!


Ok thanks!
  • 0

I Found some epoxy putty hidden in the basement and freaked out.


#15 Meaker VI

Meaker VI

    Member

  • Moderators
  • 1,192 posts

Posted 11 January 2017 - 06:25 PM

I will be selling both self-install kits and pre-installed into the available blasters of the customer's choice. More details to come in the future!

 

You still thinking about making/selling kits? I'm still interested, preferably in something largely pre-assembled, as I have only ever done house wiring and want to avoid soldering so many tiny things with 0 experience.


  • 0

#16 Ming Batt

Ming Batt

    Member

  • Members
  • 12 posts

Posted 14 January 2017 - 11:14 PM

 

You still thinking about making/selling kits? I'm still interested, preferably in something largely pre-assembled, as I have only ever done house wiring and want to avoid soldering so many tiny things with 0 experience.

 

Yes, I'm still selling the kits. I'm actually in the process of making a new kit, one slightly based off the modulus line.

I will try to make many options available for suitability of a wider audience. Some options I'm considering are completely assembled kits in the blaster, and some self-installation kits, to varying degrees. I will of course include a pre-assembled kits where assembly is simply soldering a few wires into the blaster.

I'm also working on a website for this, check it out: http://mingbatt.tech/. It's not complete yet, and I don't have an estimated time of completion, as spare time for my development projects is severely limited, especially since I have so many to complete. When it is complete, I plan to display my kits/projects, along with a tutorial for each and every one of them.


  • 0


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users