Jump to content


Photo

My Nerf shot counter V2


49 replies to this topic

#1 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 26 January 2016 - 09:23 AM

Edit: circuit in post on page 2 here: http://nerfhaven.com...er-v2/?p=351846

 

 

 

So heres a peek at my next Arduino Nerf round counter. Will have some extras this time...

 

http://www.youtube.c...h?v=Xj6GkkIPjXw

 

Its not fitted to a gun yet, so im pressing switches manually.


Edited by Kingbob, 28 February 2016 - 02:08 AM.

  • 0

#2 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 27 January 2016 - 07:47 AM

This looks impressive man. I actually have a oled and was considering it for a project and doing something like a cross between your set up and the gryphon.
  • 0

#3 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 27 January 2016 - 09:00 AM

I've had it a few months but hadn't done anything with it, so sat down on the weekend and knocked that up. I'm still playing with the layout though.

 

That oled is purely blue,  can get white too. The only red one I've seen is too big for most nerf guns. But I'm tempted to get a full colour one so I can do a mix of red and white. 


  • 0

#4 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 27 January 2016 - 10:26 AM

I like the fact it shows mag size, number of shots (with reload indicator), and battery %. The only other thing I would add is maybe a rpm indicator for the motors so you can easily tell full review or not.

The problem I keep having is figuring out the code I need to use. Right now I'm working on a basic setup to put into a mega centurion with a RGB LED to indicate if the guns got a mag or not, and if therected is a dart chambered or not.
I'm thinking of useingredients a optic ir sensor for the dart detector and one for the mag detection [though if I can figure the circuit out, might use a reed switch], and having the LED change to green if unloaded and uncocked, and yellow if a mag is in but uncocked, and finally red if mag loaded and cocked.

Edited by DjOnslaught, 27 January 2016 - 10:32 AM.

  • 0

#5 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 28 January 2016 - 12:00 AM

The way it works at the moment is that if there is no mag inserted, then it says INSERT. This is detected by a switch, once inserted it detects the mag size the same way as my other one, using hall sensors and micro magnets, and then shows mag size and rnds remaining. The rnds remaining assumes you inserted a full mag.

Then the shot counting works the same as before, using a switch or hall sensor on the trigger, which will depend on the gun. Once it reaches 00 it flashes the reload sign.

 

Its currently setup for battery supply V and A draw, but i might make that just the voltage, and add an RPM indicator like you suggested. I'd do that via an IR sensor on one of the flywheels. Not sure how fast it could update the display though, probably only once or twice/second max.

 

For your plan, an RGB led is easy to drive. For mag insertion detection in my stryfe and rapidstrike i just re-purposed one of the existing switches used as part of the locking mechanism, but the Centurion may not have that available. A hall effect sensor would be easier than a reed switch though, they're smaller, and dont need as large a magnet to operate. The magnets i'm using are only 1mm thick, 3mm round disk magnets that can fit anywhere. Cost me about $3 for 50 on ebay.

 

To use a reed switch you could use a digital or analog input, detecting when it closes in the presence of a magnet, completing the circuit and driving the pin high or low as you prefer. I'd go low, as you can set the pinmode on the arduino to use its internal pullup resistors. A hall effect sensor would only work on an analog input, as it outputs a voltage relative to the magnetic field. With a 5V supply, it outputs 2.5V with no magnet present. In the presence of a north or south magnetic field, the voltage either drops, or rises. That way it you can detect even a weak field, and dont need a full contact like a reed switch. It also lets you do two detections from one input. So a mag marked with a north magnet may be a 6 shot. A mag marked with a south magnet might be a 12.

 

You'd definitely need IR to check that a dart is chambered though, thats something i hadnt considered doing. I had thought about detecting how many rounds are actually in a magazine, but i'd need to modify every magazine for it.


  • 0

#6 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 28 January 2016 - 01:18 AM

Btw if you do want any arduino help, happy to assist.


  • 0

#7 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 28 January 2016 - 07:22 AM

Btw if you do want any arduino help, happy to assist.


I would love some help with the coding. The centurion is a springer so it has no electrical locks, but I have a ton of button switches and a stockade I'm tearing down completely for parts, cause it doesn't work.

If tried and tried to get the reed switch to work in my circuit (I have some with just 2 connection points and some with 3) with no luck. I was able to get the optical ir sensor to work though.

I'm thinking the hall effect and reed switches might be more then it needs, since it will only be using a single mag (12 shot from the buzz bee air max tyrant) since the 6 mag sucks, although I could always include it and have it set up just not use it.

Could I use a ir led - sensor set up instead of the optical for the with a piece on each side as mag detection, or do you think it's getting to complicated at that point? I only want a shot detection as jam notification really, since I'm not using the front barrel.
  • 0

#8 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 28 January 2016 - 02:30 PM

For the rpm ndicator you can prolly make your own optical IR tachometer for it, and utilize a reflection off the flywheels to get your measurement.


  • 0

#9 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 29 January 2016 - 01:11 AM

2 wire reed switches are typically normally open, a 3 wire reed will have a normally open, and a nomally closed pin. Easy to check which is which with a multimeter. May also want to test the switch with multimeter while applying a magnet to make sure the switch works.

Then I'd connect one end to a digital pin on the arduino, other to gnd. 

So try this. 

 

int reedPin = 1;  //or your preferred digital pin #
 
void setup() 
{
  pinMode(reedPin, INPUT_PULLUP);  //to set that pin to input pullup mode, so by default it should read high
  Serial.begin(9600); //setup the serial port so you can use the monitor
}
 
void loop() 
{
  if (digitalRead(reedPin) == LOW) { //check to see if the pin the reed switch is on has gone low
    Serial.println("The reed switch has been closed by a magnet.");  //output a message to the serial monitor
  }
  delay(50); //wait 50ms before proceeding, this will help debounce the switch
}

 

 

 

Apologies if thats really basic, i dont know how well you know arduino or coding.

 

Assuming your reed switch works, and magnet is strong enough, load that with your reed switch connected, and open a serial monitor (under the tools menu). It should then output "The reed switch has been closed by a magnet." continually while the magnet is present.

 

 

You could use an ir led to optically check to see if a mag is inserted, but its kind of overkill when a switch will do.


  • 0

#10 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 29 January 2016 - 09:04 AM

Picked up a 1.5" full colour OLED today. This is red but the camera makes it look orange, and im still toying with the layout.

 

17.JPG


  • 0

#11 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 29 January 2016 - 09:59 AM

2 wire reed switches are typically normally open, a 3 wire reed will have a normally open, and a nomally closed pin. Easy to check which is which with a multimeter. May also want to test the switch with multimeter while applying a magnet to make sure the switch works.
Then I'd connect one end to a digital pin on the arduino, other to gnd. 
So try this. 
 
int reedPin = 1;  //or your preferred digital pin #
 
void setup() 
{
  pinMode(reedPin, INPUT_PULLUP);  //to set that pin to input pullup mode, so by default it should read high
  Serial.begin(9600); //setup the serial port so you can use the monitor
}
 
void loop() 
{
  if (digitalRead(reedPin) == LOW) { //check to see if the pin the reed switch is on has gone low
    Serial.println("The reed switch has been closed by a magnet.");  //output a message to the serial monitor
  }
  delay(50); //wait 50ms before proceeding, this will help debounce the switch
}
 
 
 
Apologies if thats really basic, i dont know how well you know arduino or coding.
 
Assuming your reed switch works, and magnet is strong enough, load that with your reed switch connected, and open a serial monitor (under the tools menu). It should then output "The reed switch has been closed by a magnet." continually while the magnet is present.
 
 
You could use an ir led to optically check to see if a mag is inserted, but its kind of overkill when a switch will do.


Hadn't even considered using a voltmeter to check the switch, thanks for the tip. The optic IR is a tcrt5000 and is a 4 pin sensor the combines the ir led and detector... it works off reflection for detection, you can use that for your rpm sensor, because of how the color detection.

Eventually I'm gonna get hall effect sensor to use instead of the reeds, and my magnets might be to thick for how I want to apply them. Do you have a link to what you used?
  • 0

#12 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 29 January 2016 - 10:02 AM

Picked up a 1.5" full colour OLED today. This is red but the camera makes it look orange, and im still toying with the layout.
 
17.JPG


Is the mag: 00 a way to count how many times you've reloaded? Maybe a timer to show how long it's been running
  • 0

#13 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 29 January 2016 - 08:41 PM

Hadn't even considered using a voltmeter to check the switch, thanks for the tip. The optic IR is a tcrt5000 and is a 4 pin sensor the combines the ir led and detector... it works off reflection for detection, you can use that for your rpm sensor, because of how the color detection.

Eventually I'm gonna get hall effect sensor to use instead of the reeds, and my magnets might be to thick for how I want to apply them. Do you have a link to what you used?

 

I always have a good multimeter on hand, even just the continuity tester can help solve problems.

 

I bought 3503UA hall effect sensors since i had one of that type so could test before they arrived.

http://www.ebay.com/...eQAAOSw34FVDN2u

 

And 2x1mm rare earth magnets: 

http://www.ebay.com/...KEAAOxy63FS0K3R

 

I did also get some 3x1mm magnets as well, and some square 6x6x1mm ones. 

 

Is the mag: 00 a way to count how many times you've reloaded? Maybe a timer to show how long it's been running

 

Mag: 00 shows the currently loaded mag size. In this case no mag is inserted so it says 00, but i might just make that blank unless a mag is inserted.

Im not happy with the layout of the bottom section yet though. Spent an hour making it work, 3 hours playing with the layout lol


  • 0

#14 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 30 January 2016 - 02:10 PM

 
I always have a good multimeter on hand, even just the continuity tester can help solve problems.
 
I bought 3503UA hall effect sensors since i had one of that type so could test before they arrived.
http://www.ebay.com/...eQAAOSw34FVDN2u
 
And 2x1mm rare earth magnets: 
http://www.ebay.com/...KEAAOxy63FS0K3R
 
I did also get some 3x1mm magnets as well, and some square 6x6x1mm ones. 
 
 
Mag: 00 shows the currently loaded mag size. In this case no mag is inserted so it says 00, but i might just make that blank unless a mag is inserted.
Im not happy with the layout of the bottom section yet though. Spent an hour making it work, 3 hours playing with the layout lol


I have some square ones that seem like they are to thick (technician gimmick linked em to me from his gryphon project) but they seem like they will be to thick, especially since I'm gonna be using a clip that's not nerf made with the mega centurion.

I'm definitely gonna look into the ones you've linked. The hall effect sensors seem more reliable and easier to use then reed switch.
  • 0

#15 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 31 January 2016 - 05:35 AM

The good thing about the small round magnets, can drill a small hole to recess them into the mag.

 

Decided the blue OLED would be good in an old Rayven i picked up for cheap since it didnt work. Turned out to a loose wire so no biggy.

Removed the jam door lock switch, and disconnected the magazine lock switch, though I re-purposed that one for the Arduino magazine detection. Also used a microswitch for the trigger. The cable hanging out the top plugs in to the other side of the gun. Having a connector makes disassembly simpler, and the wires are nice and long so can fold open the gun without disconnecting it if not needed.

18.JPG

 

Mounted the display up the front, and a switch above it. I used an Arduino nano, purely because it has the usb port on it. I just poked around until i found a spot i could mount it easily with the usb port accessible from outside so i dont have to open the gun up to modify the software. Hall effect sensors mounted in the magazine slot on a piece of styrene that puts them at the right distance. You can see the connector for the cable on the other half of the gun top right, as well as the power switch.

19.JPG

 

Close up. I used right angle header strips on the Arduino so the pins dont interfere with the internal barrel tube.

20.JPG

 

Mounted a display mask on the outside to cover the non active areas of the screen. Mounted with some nice stainless hex screws through the body and pcb of the screen. Also repainted the gun black and white, though the paint isnt finished yet. Added the power switch at the top. Wanted to put in an illuminated switch but couldnt find one to fit.

21.JPG

 

Powered up.

22.JPG

 

 

The RPM counter isnt yet functional, but will use an IR led/receiver pair on a flywheel. Have the parts, just not wired in or written code for it yet.

 

Will also pick out the RAYVEN and NSTRIKE molded text in black paint, and add a few silver details here and there. I left the trigger/motor switch/mag eject switch/and barrel orange. 

 

23.JPG


Edited by Kingbob, 31 January 2016 - 06:16 AM.

  • 0

#16 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 31 January 2016 - 05:40 AM

Oh, and i plan to use that full colour OLED in a Stampede.


  • 0

#17 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 31 January 2016 - 09:59 AM

I'm looking at doing a full bore electronic mode to a stampede once it arrive also, including a full 18ga rewire, battery mod, everything but motor change out. Maybe we could collaborate on it.
  • 0

#18 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 01 February 2016 - 12:17 AM

I'm looking at doing a full bore electronic mode to a stampede once it arrive also, including a full 18ga rewire, battery mod, everything but motor change out. Maybe we could collaborate on it.

 

Nice, i actually have 3 stampedes i picked up 2nd hand locally for $50. Ive painted 2, one red/black, one white/black, but they're still works in progress, im not hugely happy with the flat red i used. Ive removed the AR from one, and tweaked the spring pre-load a bit, but nothing major. Havent poked around the inside much beyond that.


  • 0

#19 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 01 February 2016 - 09:39 AM

Mine hasn't gotten here yet from the ebay. But from what I understand about it, it's a battery powered springer basically? Or is it flywheel driven like most battery powered blasters
  • 0

#20 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 01 February 2016 - 08:53 PM

Yeah its a battery powered springer. Has a geared motor that drives a toothed slider to retract/load/fire the dart. I only had a brief look around when i took it apart to paint. Did have a look at mod guides or anything, but given the plastic gears and slider, wont be able to juice that motor up too much. 

 

I was thinking of using a high torque servo instead.


  • 0

#21 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 02 February 2016 - 12:40 AM

I just ordered a couple of these to try out.

 

http://www.sainsmart...mel-atmega.html

 

Bargain at $10 if they work. Little bit more complicated than the blue one i used which is i2c, but will see how they are when they arrive.


  • 0

#22 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 02 February 2016 - 07:33 AM

Oh lord, that screen is awesome, seems like it might be easier to use then the oled too.

Got my mega centurion firing again, it's got some umph, the range is meh and a 3/4 pvc barrel didn't improve it, though I did notice that the dart tooth/breech doesn't always want to align right.
  • 0

#23 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 02 February 2016 - 08:01 AM

There are actually a load of options for screens, all the way up to 7". Found a nice 2.8" touch screen that has my interest, but needs at least an arduino uno, so certainly needs a larger gun to fit that in. Might fit in a stampede.


  • 0

#24 Kingbob

Kingbob

    Member

  • Members
  • 133 posts

Posted 07 February 2016 - 12:16 AM

Well I finally got the RPM counter installed and hooked up, so thats been properly added to the oled display now. Updates every 500ms so its not as rapid to change as i'd like, but the faster it updates, the less accurate it is. Ideally i'd only do it once/second, but that really looks slow. Not entirely sure how accurate it is, running on 4x alkaline AA's i get a max of around 6000 rpm, that sound right for stock motors?

 

Also my little arduino compatible voltmeter arrived this week, so tested it out and works nicely. Will also work out current draw, but im not using that, and it sends it all over i2c to the arduino so only needs 2 wires to connect (besides power etc).

 

BUT, hit a snag when i integrated it into the main code. I'm using an arduino nano which like most arduinos has 32k of flash. The longer the code, and the more libraries it uses, the bigger it gets. The library for the OLED is quite big and i was already around the 29k size. When i add the 2 libraries that the voltmeter uses, i end up about 2k over.

 

I need to include the libraries otherwise the voltmeter simply doesnt work. I'm trying to trim down the code, get rid of anything unnecessary, but it doesnt look good.

Only other option is to use a different arduino that has more flash, but to get one thats small enough means using a $20 arduino instead of a $4 one. Ironically it'd be cheaper for me to add a second nano, and a second oled, which im half tempted to do.


  • 0

#25 DjOnslaught

DjOnslaught

    Member

  • Members
  • 350 posts

Posted 07 February 2016 - 08:11 AM

Can you use a SD card and SD card shield for it?
  • 0


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users