Jump to content


Kingbob's Content

There have been 133 items by Kingbob (Search limited from 10-June 93)


By content type

See this member's


Sort by                Order  

#352457 Arduino gun controller mk3

Posted by Kingbob on 27 March 2016 - 02:53 AM in Modifications

The left side of the shell, has the safety switch, and 2x hall effect sensors for magazine size detection. There is an 8pin connector to disconnect it from the other side, makes it easier to work on.

 

stampede11.jpg

 

 

The right side of the shell. You can see all the various bits and pieces. In hindsight i'd have used a nano extension board and put it in the battery bay, would have made hooking everything up easier. The joystick isnt visible as its under the magazine release mechanism, and the voltage/current sensor is mounted flat on the bottom of the battery bay so cant really be seen. 

The magazine insertion switch, and jam door switch are the existing switches in the blaster, just re-purposed.

stampede12.jpg

 

 

The paint needs finishing and detailing (and stripping in the case of the trigger), but here you can see the screen and joystick. The joystick can be reached by the trigger finger.

stampede13.jpg




#352056 Arduino gun controller mk3

Posted by Kingbob on 08 March 2016 - 07:27 AM in Modifications

The little red one is the FET motor driver. Uses the PWM signal from the arduino to drive the motor directly from the battery.




#352296 Arduino gun controller mk3

Posted by Kingbob on 20 March 2016 - 06:36 AM in Modifications

Found a h=bridge locally!

 

Current state:

stampede9.jpg




#351868 Arduino gun controller mk3

Posted by Kingbob on 28 February 2016 - 08:26 PM in Modifications

Dont need to use a full size servo, a little micro servo will work fine as a pusher.

 

I've got a load of lipo's i can use. 11.1V 2600mAh, 7.4V 4000mAh, and 2x 7.4V 2500mAh. Plenty of room in the battery tray without 6 D cells!




#351148 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 25 January 2016 - 11:53 PM in Modifications

Ok, just a momentary switch. Did you happen to have a wiring diagram for the entire thing? I don't think I saw one on the front page.

 

Theres a full circuit diagram in post #14:

http://nerfhaven.com...ke/#entry349981

 

Also in the first post as an update/link.




#351112 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 25 January 2016 - 07:38 AM in Modifications

Source files here:

Rapidstrike: https://drive.google...iew?usp=sharing

Stryfe: https://drive.google...iew?usp=sharing

 

They're pretty much the same, but the Stryfe version is setup for a switch for the trigger counter. The Rapidstrike version is set to use a hall effect sensor and magnet for the counter. Both have the code for each, but commented out the non relevant part. You'll see when you look. They'll work in any gun, i just differentiate them by how the trigger counter is activated.

 

Its pretty well commented so you should be able to work out whats what, where to change pin assignments, timings etc. 

Its currently only setup for a 6, 12, or 18 magazine. But you can easily add 25 and 36 detection. 

 

Its also sensitive to the direction of the magnets (north or south) so test before gluing any in place.

 

You'll also need the LEDControl.h library from here: https://github.com/w...ontrol/releases

If you dont know how to install a library, info here: https://www.arduino....Guide/Libraries

 

 

Any questions, happy to answer, and any suggestions, happy to hear!




#351152 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 26 January 2016 - 09:26 AM in Modifications

Hi Kingbob

Thanks for sharing this information with the nerf community.

 

No worries.

 

Heres a peek at my next one :D

 

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




#351354 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 05 February 2016 - 12:05 AM in Modifications

Without wanting to sound insulting, if i still need to provide an Arduino, a power source, a counting mechanism, and trigger mechanism to make your counter work, then what does your counter actually do?




#348828 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 24 September 2015 - 11:22 AM in Modifications

Edit/Update 1: current circuit diagram here http://members.iinet...rf/circuit2.jpg

Please read this post about the 2 bits circled in red, they're optional: http://nerfhaven.com...trike/?p=349981

 

Edit/Update 2: Arduino sketches can be downloaded here:

Rapidstrike: https://drive.google...iew?usp=sharing

Stryfe: https://drive.google...iew?usp=sharing

Read this post for details: http://nerfhaven.com...e-2#entry351112

 

 

 

 

Hi all, a noob here.

After recently getting hold of a Rapidstrike, i decided i'd add a shot counter, in preperation for a repaint to look vaguely like an Aliens assault rifle. Figured while i was at it i'd make 2 and add one to my Stryfe as well!
I'm good with electronics, and decided an arduino would be the way to go, ordered everything on ebay and finally put it together over the last few days.

Breadboarded it first, used an Arduino pro mini since theyre small and cheap, added a 7 segment driver, couple of discrete components and the displays and voila! There are 4 switches on the breadboard, the 2 lever switches are for power, and triggering. The idea of the power one is it will only turn the circuit on when a magazine is inserted. And 2 small pushbuttons which will be used for magazine size detection. More on that in a bit.
1.JPG

Since theres loads of room in a Rapidstrike to the right of the magazine, i wired it all up on a single board that fits nicely. The leads are long but will shorten them when i actually install it. This has red digits.
2.JPG

I wire wrapped the back instead of soldering, far simpler when prototyping.
3.JPG

But that whole board is too big for a Stryfe, so i made a smaller version with the displays seperated. The little red/black wires you see disconnected go to the trigger switch and will be soldered at installation time. This has blue digits.
4.JPG

To save space, after soldering in headers to the Arduino to use for wire wrapping, i use double sided tape to stick the 7 segment drive underneath the arduino. Makes it nice and compact.
5.JPG
6.JPG

Decided to install in the Stryfe first, so cut out a hole for the displays and glued in the trigger microswitch. You can see here how the trigger mechanism presses against it.
8.JPG
9.JPG

I left the jam door switch connected, but bypassed the magazine insertion switch, and instead wired that up to turn the arduino on whenever a magazine is inserted. Wont drain battery that way, and acts to reset the counter when a mag is inserted.
Theres a space in the top of the gun above where i installed the trigger switch which is perfect for the arduino board, and obviously i sized the length of the cables to reach where the display sits. The display isnt fixed in place yet, just sitting there in the pic.
10.JPG

All assembled. The lighting makes the displays look superbright, but they're not, the brightness is controlled by the arduino and is actually turned right down. Just a camera lighting trick making them look super bright.
11.JPG


At the moment the Stryfe counter doesnt have magazine size detection, since i was going to try and make the placement of the switches the same in the Rapidstrike and Stryfe so i dont need to do much to the mags. Where i planned to put them in the Rapidstrike at the front of the mag wont work in the Stryfe. But i have now worked out how to do it, they'll be mounted on the left side of the gun near the top of the magazine.
Basically, all the magazines have molded ridges on them, like this:
7.JPG

So i'll just add a couple of notches to those ridges (where circled) to encode the magazine size. With 2 switches, i can set 4 sizes.
ie:
Pressed/Pressed = 18
Pressed/Not Pressed = 12
Not Pressed/Pressed = 6
Not Pressed/Not Pressed = 35 drum

And its just a matter of adding a notch (or not) on the appropriate ridge. Pressed means there is no notch and the ridge presses the switch. That way i dont need to do anything to my mags which are mostly 18's. And the 12 and 6's i have each only need 1 notch on the correct ridge, so minimal effort. The only one left out is a 25 drum, but that could be done by adding another switch. The arduino can do it, i just havent bothered since i dont have a 25 drum.


Not including wire/tools/time, the common parts cost (in US$) was:
Arduino Pro Mini with headers $2.92 each
7 segment driver $0.54 each
7 segment displays $0.79 each
Lever microswitch $0.65 each
Tactile switches $0.10 each

The larger one also has:
PCB $0.30
Wirewrap IC sockets $0.95 each, used 4
10k resistor $0.24 each
10uf 16V electrolytic capacitor $0.30
100n ceramic capacitor $0.32
(the 2 capacitors arent strictly necessary)

So total cost for the big one: $10.85
Small one: $6.13
Plus a few hours assembling and coding.




#350374 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 01 January 2016 - 01:47 AM in Modifications

Sonofa... just put my Rapidstrike back together after a paintjob, and looks like ive lost or thrown away the little white plastic piece that pushes the switch at the front of the magazine, which is normally used as a lock, but i re-purposed to turn on the arduino! Probably threw it out thinking it was a part i didnt need! Suppose i better grab some styrene and look at making a replacement!

 

16b.jpg




#356567 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 02 November 2016 - 02:06 AM in Modifications

Occurred to me i never posted a pic of what my Rapidstrike ended up like. I ended up adding nerf sights, and made a suppressor out of some pvc pipe from a hardware store. 

Put a 9 LED flashlight on the right hand side, which just has a rear mounted pushbutton switch.

Put a laser on the left hand side, which has a momentary switch on the grip in just the right spot for the thumb. (Its the red dot behind the motor switch).

 

DSC_0150.JPG

 

DSC_0151.JPG




#351115 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 25 January 2016 - 09:55 AM in Modifications

What kinda trigger switch did you utilize for the stryfe trigger counter?

 

Just a micro lever switch, some pics on the first page.

 

9.JPG




#350350 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 31 December 2015 - 11:45 AM in Modifications

The 2 hall effect sensors i used are capable of detecting 9 different magazine sizes between them (and only using 2 inputs in the arduino). Thats more than enough for all the nerf magazines: 6, 12, 18, and 18, 25, 36 drums. But yes could add a 4 bank dip switch accessible from outside somewhere. But the magnets i used were like $3 for 50 on ebay, and only takes a few seconds to add one to a clip.

 

Btw if anyone wants the Arduino code for the circuit above, happy to share.




#348874 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 28 September 2015 - 01:02 AM in Modifications

And, yes, circuit diagram/parts list/arduino code would be most welcome when you get a chance.


Voila. It really is absurdly simple really.

Theres still 8 unused digital pins on the Pro Mini, so still plenty of scope for expansion, and i didnt use the analog inputs at all. Though i'm thinking of adding a light sensitive resistor which will automatically adjust the brightness of the display for day or night use to one of the analog inputs. The pro mini does need a USB to TTL cable to program it since it has no onboard usb controller. But, theres no reason the pro mini couldnt be swapped for an Arduino Nano or equivalent.

The MAX7219 LED driver can actually drive 8 digits, so other things could be displayed. Mighty handy that it fits under the pro mini! I even managed to squeeze the brightness resistor underneath between the MAX and the arduino pins.

I built my prototype without the 2 recommended capacitors, and had no issues, so the version i've installed doesn't have them. I've yet to have any issues without them so can save $0.50 if you want to skip them!

The pin numbers i chose for the 3 switches, and for connection to the MAX are based on the physical layout of the pro mini and were convenient to group. Can really use any pins, as long as they're defined correctly in the software.

Posted Image



#348841 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 25 September 2015 - 10:00 AM in Modifications

I had thought about using that switch.
I spent a while dismantling the trigger assembly etc and seeing what pushed what, locked against what, etc. And i technically could use it.

Good thing about the arduino is that i can set the code to look for a high or low, open or closed circuit so its possible. But, since i haven't yet done any power upgrades to the switches, wiring and motors, i decided to use a seperate switch in case that switch doesnt end up staying once i do the upgrades. If that makes sense?



#348836 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 25 September 2015 - 12:48 AM in Modifications

Great job, it seems very simple and efficient (in terms of functionality and cost).

This arduino is 5V logic, correct? Are you just powering the whole blaster (including motors and the arduino) off of alkalines, then?

Its one of the things i love about arduino's can use a simple tiny little board, and do so much with it. All the smarts around sensing the trigger, working the counter, detecting magazines etc can be done in software, without the need for loads of additional electronics. As it is, the pro micro has 14 digital IO pins, and i'm only using 6! Could easily add more features to it.

And yes it is a 5V version, but another handy feature of the arduino is an onboard 5V regulator. It can happily run off up to 12V, so a 3 cell lipo setup at 11.1V would be no problem. And with the addition of a $1-2 external regulator, could handle up to 25V! And yes at the moment it is just running off alkalines, I havent yet done any voltage mods to the motors, or replaced the wiring. Thats the next stage.



Expected BS noob post. Got awesome working counter. Was not disappointed.

Where do you go for resources on this stuff? I have an arduino but coding isn't my specialty.

Heh, thanks. I have an electronics and software background, so its quite simple for me. The official www.arduino.cc webpage is a great resource, but it helps if you know what you're looking for there. Another great resource is www.adafruit.com which sell parts, but have a great learning resource section. Check out https://learn.adafru...getting-started for the first of their arduino lessons.


Very cool but remove the locks in the blaster. They only make operation less smooth, and especially the dart lock can be a real pain which could cause problems with the counter if you get a jam.

TLDR; Remove locks to improve operation.

I have removed some of the locks in the Stryfe and RS, but not all yet. At the moment my aim is to get the counter installed and working, then i'll look at going through and doing voltage mods, re-wiring, and remaining lock removal. The RS once painted and modded to have the Aliens pulse rifle look will probably be more a show piece than play gun anyway.



Ive been test fitting the bigger counter in the RS. Removed the orange wire cover in the middle, was taking up too much space. I'm re-using the switch that was one of the electronic locks to detect a magazine is inserted, to turn the counter on instead. (the bottom left). The plastic lever isnt inserted at the moment, keeps falling out when i move the gun, same for the magazine release lever. You can also see a small 4 pin connector just to the right of it, that will go to the magazine detection switches on the left shell of the gun. A connector will make it easier to disassemble/reassemble. I was going to use a little micro switch behind the trigger to detect firing, but then remembered the RS is full auto, so that wont work. Instead the switch now sits in front of, and to the right of the pusher arm, and gets pressed whenever it extends to push a dart. It does safely clear the magazine there.
Posted Image

I have however found that the counter is thicker than i had planned on. As a result some of the pins actually rub against the magazine, and push it a little off centre. When the gun is closed up the mag will be straight, but will probably bend the pins it touches. They do scratch the top of the mag. So since the parts are cheap enough, and i have the design working fine, i'm going to make another counter for the RS, but compact it down like the one in the Stryfe. Will sit in the same place, but take up less room and wont interfere with the magazine.
Posted Image

So watch this space.

Btw, happy to provide a circuit diagram/parts list/arduino code if anyone wants them.



#348928 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 02 October 2015 - 03:05 AM in Modifications

What about magnetic switches instead of levers or pushbuttons? Glue a magnet onto the clip in the appropriate position. That would reduce the moving parts issue that may develop from repeated lever switch use - though i don't know how rugged magnetic switches are...

Very impressive work btw.


Actually i was sitting test fitting, and umming and ahhing about how to mount things, and magnetic was starting to appeal to me as well. Not necessarily because of moving parts failing, just that it would be less intrusive, and less of an issue if the magazine wobbles.

So i jumped on ebay last night and ordered some little magnets, and some hall effect sensors. Good thing is that by using them, i can move the connections on the arduino to analog pins instead, and free up a couple of digital pins for something else. Be 2-3 weeks before the parts show up though. But since i got 10 sensors for $2 with free delivery from china, versus $8 each locally, i'm happy to wait!



#348876 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 28 September 2015 - 06:48 AM in Modifications

All installed. You can see a little black 4 pin socket in the bottom right, mates up directly with a male plug on the other half of the shell, makes it easier taking it apart all the time. Also trimmed the rails the jam door rides in so it opens all the way now.

Posted Image

Installed the switches to detect the magazine, running to the connector to the other half of the shell. I used pushbuttons, but i'm not happy with them, the actual button piece wobbles too much, and can be pushed aside instead of pressing in. So i think i'll replace both with lever type microswitches.

Posted Image



#348992 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 08 October 2015 - 07:55 AM in Modifications

Got bored waiting for my parts to show up from ebay, so picked up a sensor and magnet from the electronics shop to test with. $7.75 for one sensor locally, or $2 for ten from china!
With a neodymium magnet, the sensor can detect it from at least 15-16mm away! So wont have any issues with wobbling magazines causing misreadings.

Also when coding the arduino, i worked out that i can get more values by using a magnet that a switch. Two switches gives me four readings:
off/off
on/off
off/on
on/on.

But because of how the hall effect sensor works, i can detect no magnet, or north or south polarity. Which with two sensors gives me nine combinations:
none/none
none/N
none/S
N/none
N/N
N/S
S/none
S/N
S/S

At the moment I only have 18, 12, and 6 shot magazines, so really i can get away with using a single sensor and magnet, and just code those 3 sizes. Or lose the 6 and replace with a 25 or 35. And the 18's will be set to none/none, so dont need to mess about with them, and will only use a single magnet on each of my remaining 12's and 6's.



#349981 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 13 December 2015 - 05:21 AM in Modifications

Here is an updated circuit diagram. The 2 parts circled in red are mutually exclusive, its one or the other. Can use a switch, or hall sensor for the trigger depending on the gun.

 

circuit2.jpg




#350309 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 30 December 2015 - 03:42 AM in Modifications

Wow dude, have you considered a different type of display or even doing a "camera" sight which would route a small camera in front to a display in the back? Kinda like that nerf gun with the camera but minus the recording option...

 

This one was specifically going for the counter look from Aliends for a RapidStrike, but I'm currently playing with a couple of small OLED displays. One is a blue monochrome 128x64 dot display thats about 1" wide, another thats an awesome red but about 2.5" wide and doesnt really fit most Nerf guns, and a small 1.3" full colour OLED.

 

Looking at things like displaying batt voltage/maybe current draw, mag size, rounds used, possibly motor RPM etc. Also add a switch for single/rapid fire and have that mode displayed. Could also add a purely fun switch/display to select ammo type such as Normal, Armour Piercing, Tracer, Explosive etc :D

Plus when the rounds reach zero it can flash "Reload" or something.

 

Am looking at fitting one to a Stampede or a Rayven once i work it out properly.

 

I did even consider adding a range finder, and have the range displayed, but the cheapest suitable components i can find are about $100. Dont want to spend that much.




#349918 Shot counters for my Stryfe and Rapidstrike

Posted by Kingbob on 09 December 2015 - 05:32 AM in Modifications

So I finally had some time to sit down and swap the switches out for hall effect sensors. Works a treat! Put them in the Rapidstrike and Stryfe, configured the same so the magazines detect the same in either blaster.

I also swapped out the switch i was using for the trigger counter in the Rapidstrike. It was detecting the movement of the pusher arm but i found if the blaster was held at an angle, the lever on the switch would jam against the pusher arm. So i swapped that out for a hall effect sensor too.

 

This is the insides of the Stryfe, you can see the hall sensors on the left half of the shell, connected to a 4 pin socket, which mates with a 4pin plug on the other half. Makes assembly/disassembly easy. And all works fine. They're on a piece of white styrene glued in to put them at the right distance from the mag.

 

stryfe1.jpg

 

stryfe2.jpg

 

And heres a short youtube clip showing the detection in action. Theres a slight delay of a second or two after insertion because putting the mag in turns on the Arduino, which has to boot.

 

https://www.youtube....h?v=DUmSJL-isHE




#351509 My Nerf shot counter V2

Posted by Kingbob on 14 February 2016 - 08:51 PM in Modifications

I suspect its the IR receiver, i did some testing with a spare one, and if the signal it gets is constant, its output stops. So yeah i figure its detecting so frequently that as far as its concerned its a constantly ON signal.

 

I do have a couple of other IR receiver/transistors to try, see if they're more capable. 

 

I'm half inclined to just tweak the software to say "MAX" instead of the RPM if it exceeds the RPM its capable of reading




#351494 My Nerf shot counter V2

Posted by Kingbob on 14 February 2016 - 02:34 AM in Modifications

Spoke too soon. Whilst i did solve my power issues, i've found another.

The rpm counter is using a standard IR LED/receiver pair mounted on each side of a flywheel. Theres a hole in the flywheel allowing the IT receiver to get a signal once per revolution. All pretty standard.

 

The code im using counts the number of signals received every 250ms, and multiplies it out to give an rpm count. The reason i do it every 250ms is so the display updates at that rate. Whilst its more accurate if I count for say 1 second, it also means the display would only update every second which is very slow.

 

The way the arduino counts the signals is by using one of its interrupt pins, so whenever the IR receiver gets a signal, it interrupts the arduino and forces it to count, before going back to what it was doing. Thats what the interrupt pins are designed for, and work well. 

BUT, what ive found in practice, is that when the motors are at max RPM, (somewhere around 25,000rpm) the counting fails.

 

It could be the IR sensor not being able to output fast enough, its rated to 37,000hz, which seems coincidentally close to the 25000 count as the max i've seen.

 

OR, the interrupt pin cant interrupt and execute fast enough to count the signal its getting.

 

I'm inclined to think its the IR sensor since the interrupt pin would count as much as it could so i'd still get a high count. Instead at high RPM the count simply drops off to almost zero, implying the sensor cant get a clean "sense" of the LED. 

I'm going to look for an IR sensor with a higher frequency, see if that helps.

 

I also have a new arduino on its way that runs at 48Mhz instead of the 16Mhz of the nano. Possible it may be able to keep up with the interrupt counting if thats the issue.

 

Thoughts?




#351484 My Nerf shot counter V2

Posted by Kingbob on 12 February 2016 - 11:36 PM in Modifications

Success!

 

So I re-jigged the wiring, its now using the 4xAA's for just the arduino side of things. The motors are now powered by a 7.4V 4000mAh LiPo stuffed in the butt of the gun.

The displayed voltage is for the LiPo, and the RPM counter now works heaps better, though it has a bit of trouble keeping up at full RPM!

 

So all my issues solved, and a nice little performance boost as well :D

 

Pics and a video soon.




#351846 My Nerf shot counter V2

Posted by Kingbob on 28 February 2016 - 01:50 AM in Modifications

This is the circuit (i think), hall sensors for magazine size detection, one switch for magazine insertion detection, and other switch for trigger.

 

The IR LED/transistor for RPM counting are still connected in the Stryfe, and the code is still there, but i'm not displaying it on the screen until i can get a hold of an oscilloscope to work out why it drops out.

 

The OLED screen also needs a 3.3V source, and fortunately the nano has a regulated 3.3V output.

 

 

stryfecircuit.jpg




#351732 My Nerf shot counter V2

Posted by Kingbob on 23 February 2016 - 10:24 PM in Modifications

I hate to admit it, but the RPM counter has me beat.

 

It works fine but only when the arduino is connected to USB.

Tried running it all off a higher Ah capacity battery, upped tthe voltage, added in a 5V regulator, ran everything off that. Tried applying power via the usb port, even tried running it off a usb battery. 

 

Gonna have to live with it until i can get an oscilloscope to see whats going on. Might mock another one up on breadboard and test different types of arduinos too.




#351584 My Nerf shot counter V2

Posted by Kingbob on 17 February 2016 - 07:14 AM in Modifications

Just about there, I cant be bothered swapping the IR sensor, so just gotta write some code so it says MAX instead of dropping to zero.

 

On the plus side, these just arrived:

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

 

Works great. Havent used the SD card to load an image yet, but hooked it up for testing and its all good. Does need some extra double sided tape between the LCD and PCB though.




#351234 My Nerf shot counter V2

Posted by Kingbob on 29 January 2016 - 01:11 AM in Modifications

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.




#351239 My Nerf shot counter V2

Posted by Kingbob on 29 January 2016 - 09:04 AM in Modifications

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




#351191 My Nerf shot counter V2

Posted by Kingbob on 28 January 2016 - 01:18 AM in Modifications

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




#351190 My Nerf shot counter V2

Posted by Kingbob on 28 January 2016 - 12:00 AM in Modifications

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.




#351165 My Nerf shot counter V2

Posted by Kingbob on 27 January 2016 - 09:00 AM in Modifications

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. 




#351249 My Nerf shot counter V2

Posted by Kingbob on 29 January 2016 - 08:41 PM in Modifications

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




#351263 My Nerf shot counter V2

Posted by Kingbob on 31 January 2016 - 05:35 AM in Modifications

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




#351414 My Nerf shot counter V2

Posted by Kingbob on 09 February 2016 - 06:46 AM in Modifications

Debouncing is mostly for switches, gives you a small delay so that it only gives you one reading instead of potentially multiple.

The problem i have is that its almost not reading at all when the motors are going.




#351382 My Nerf shot counter V2

Posted by Kingbob on 07 February 2016 - 12:16 AM in Modifications

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.




#351293 My Nerf shot counter V2

Posted by Kingbob on 02 February 2016 - 08:01 AM in Modifications

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.




#351290 My Nerf shot counter V2

Posted by Kingbob on 02 February 2016 - 12:40 AM in Modifications

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.




#351424 My Nerf shot counter V2

Posted by Kingbob on 09 February 2016 - 08:48 PM in Modifications

If it was resistance it wouldnt change when the usb port is plugged in.