Jump to content


truglodite

Member Since 23 Mar 2017
Offline Last Active May 02 2017 05:44 PM

#359163 Another Nerf-puter project

Posted by truglodite on 11 April 2017 - 04:34 PM

Hey all, I recently rigged up this ammo counter/chrono/voltmeter/volt alarm gadget to add to my 9yo son's collection of nerf things (yes, he did ask me to put this circuit in his red dot scope). This project is more in line for the custom builders/diyers, especially those adept with Arduino stuff. The pinout is written at the top of the code (please note this is ported 328p specific). This should be more than enough info for those willing/able to make one of these to proceed with success. I hacked up one of my son's red dot scopes to house the circuit; this way it's modular for use with many guns. Although it would actually be easier to build in to a gun if you prefer (usually there's much more room than inside a rail attachment anyways).

 

What does it do: It constantly measures voltage and warns the shooter of a low battery (long beep + highlighted Voltage value). The low voltage alarm threshold is automatically set (for 2s and 3s lipo only, as coded... I may add more chemistry/cell count options if ppl need). It measures and stores FPS, RPM, and voltage for every dart fired from the clip. After the clip is empty, min/avg/max values are displayed for FPS/RPM/Volts, then tables are scrolled through showing all of the dart data in the order fired (max/mins values are highlighted). The method of timing used for FPS yields +-65nsec precision (~30000 counts for a 100FPS Elite dart... overkill really). More details are written in the comments in the top of the code. Other than that, it's a pretty dumb code that could be improved upon for your specific application (recode it for clip reed sensors, etc...)... and oh yeah, it does also show rounds left. It also does 1-beep&lights and LED when there's one round left... then 3beeps when empty... but what Nerf arduino thing doesn't do that?  ;)

 

How do we get FPS with 1 sensor: We know more or less the dart length, so we know how fast it is from how long it blocks a single sensor. This means variances in dart length go in to speed calculation. This is not a problem with 2 sensor FPS measurement, but the simplified hardware is well worth it as long as we understand we get some relative measurement errors due to dart length. Note that if we are really needing to go 2 sensors, we could wire both sensors to the same pin using a simple circuit, and change the code to interrupt on a pair of falling edges instead (vs a falling then a rising edge). Then a 2 sensor barrel can be used with this code no problem.

 

Some folks would say I'm not smart for sharing this code here. I personally hope that posting my open source code will result in it being 'borrowed'... hopefully we'll see these ideas make their way in to the current crop of commercially available ammo counters. Those folks making those things probably won't charge extra for these features anyways (takes less time to solder i2c than 7-seg anyways, LOL). That would be IMHO a big plus for Nerfers. I'm not putting time in to make/sell these myself, so please don't bother asking.

 

Items needed:

 

16MHz 5V 328p (I used a spare pro-mini)

OPL550 IR photo logic sensor

OP240a IR photo diode + 100ohm 1/4W resistor

128x64 I2C SSD1306 monochrome display

5V regulator (I used a spare LM7805 TO-220 sans heatsink... this circuit won't draw much over 100mA unless beeping (very brief & low duty), so the smaller package will also work fine)

0.1uF & 0.33uF output & input anti-ripple caps for the above regulator

5k6 & 3k3 resistors (10% is OK... you should be calibrating the vbattRatio anyways)

LED + limiting resistor (stay under 20mA since it's pin driven... I hacked the PCB in my son's red dot scope so I could wire in the stock LED instead... this involved cutting a trace and soldering some wires)

5V peizo buzzer (doesn't require tone libraries... 5V in = buzzzzzzz)

3@ momentary NO buttons

A power switch (again, 100mA... I hacked the stock switch on my son's red dot Nerf scope to work as my on/off switch)

Nerf Scope of choice (must obviously be big enough fit everything, and hacked as needed... or I guess you could just put it in a box and velcro it to your gun LOL)

Electrical project tools & sundries (connectors, solder & iron, dremel, hookup wire, hotglue, bits of proto PCB to mount your buttons & regulator, plastic/foam/glue/paint to make it aesthetically pleasing... whatever else you need to git'r'done)

 

Notes:

1- The 5k6 and 3k3 resistors make a voltage divider which is used to read your main Nerf battery. These values are good for batteries up to 13.4V, which should work for most. If you need more (like 4s), please adjust the values accordingly... vbattRatio will also have to be adjusted to match your divider.

 

2- A 100ohm current limiting resistor for the photo diode was needed for a 1 1/4" PVC barrel adaptor I made for mega darts. However this may result in a somewhat shorter doide life. If your sensor/diode will be less than 1" apart, 150ohm will work and will last forever.

 

Oh yeah baby... modular nerftec!!! The Deans plug taps in to the Stryfe's 2s lithium battery, for both power and voltage monitoring (velcro a tiny 2s to the front of the 'scope' for the springers)

20170411_132318.jpg

Erm, yeah the cat6 guts aren't sehksee, but it's what I had and I wanted my son to be able to use it on several guns (thus not built in to this Stryfe, which would be very sehksee... the Dupont plug in the middle is for 'built in' setups)

20170411_132337.jpg

 

Fugly breadboard action... that extra multi-turn poti is there just to simulate low battery alarms for testing/debugging (not installed):

20170407_094940.jpg

 

Dry fitting the guts in the scope before cutting and soldering the wires... my favorite part of any project is the dry fit/brainstorming stage:

20170407_172159.jpg

 

Shameless blocking splash screen, LOL...

20170411_132233.jpg

 

Setup mode after boot, we see live voltage, and can setup clip capacity and dart length...

20170411_132225.jpg

 

Fire mode, with live voltage, round counter, 1 round left LED (w/ single beep), 0 rounds left 3 beeps... (LED not on since there's 8 left in the clip for this pic)

I think the format of this screen can be improved upon by putting volts, fps, and rpm on the left, and enlarging the counter font so it reaches the bottom of the screen... todo list.

20170411_132254.jpg

 

Empty mode min/avg/max values, and live voltage... (yes this photo was shot before I fixed a typo bug in the avg& max voltages;) )

20170409_131706.jpg

 

Empty mode per dart data tables, with highlighted max/min values... yeah using the stock red LED for the 1round left/empty warning wasn't such a great idea (better off mounting a wide angle LED pointed toward the shooter's face, instead of using reflection of the stock LED off the foam paneling as I did)

20170409_134341.jpg

 

Some prototype 1-sensor housings, alongside a more traditional 2-sensor housing which I use for faster stuff (& to verify the 1-sensor thing works well)

20170407_125319.jpg

 

Here's the open source code (I'm compiling with Arduino 1.8.1):

Attached File  nerfGunU.zip   12.69KB   122 downloads

 

Spoiler
Hope this leads to a more Nerfy world... please, if you make yourself one I'd love to see pics!

 

Cheers,

Kevin


  • 2