Ammo Counter for airsoft

Hi there, new convoluted plans to aid me in being an airsoft nerd today. So I've already got this one working (a basic version).
Inside of my airsoft gun (right now a gas pistol that I particularly like) theres a little switch. When its pressed the arduino knows that theres a mag in. And when the arduino receives a rising signal (putting the mag in) it resets the ammo count to the 15 that my mags can carry. On top of this, on the trigger there is also a button that when hit while I pull the trigger pulls the number in the arduino of my ammo count down by 1. Currently it also records the number of mags I have at the beginning of the match (set by an encoder that I rotate till the number equals what I have with me. So it also shows me remaining mags (cause I care). And all of the info is printed for me onto an LCD screen (one of the adafruit 2x16 RGB ones) And stuck to my forearm in a manner that I jsut have to turn my wrist a bit from aiming the pistol position and I can see what it says.

Really its not too helpful to actually playing, but it got quite a few "thats kickass"'s from several of the players I was playing with this weekend.

Now for my next trick I'm working on one that'll output the info from the rifle I use and put the same thing on the screen (however that screen might be mounted on the side of the gun itself, its a Steyr AUG, also note, usually when I play, we play at a place with realistic magazine capacities so no winding problems... Usually).

What I'm wondering, other then maybe having a connector with a different pinout on it so when I pick up the gun and the connector on it that goes into my glove (which has a reciever because the arduino is in a box on my back) Or a switch that I have to manually flick to tell it which gun I'm using at a given time. How can I make the arduino know what I'm holding without having to build some big circuit board into every one of my guns?

If you did this wirelessly via Bluetooth, I think you would have a more workable system.

When you transmit data from the various guns, you include a header of some sort that identifies the gun. This would eliminate the need to hardwire the gun to the LCD.

This would require you to have a small circuit connected to each gun but you are going to have to do that anyway to some degree.

You could use RFID (put the RFID tag on the gun, reader connected to the Arduino, sensor "near" the tag on the gun - definition of "near" would depend on the specs of the tag and reader (it might be inches, it might be feet).

I understand the functioning and according to that i will suggest not to have the LCD screen on the gun and if you want to have one then please do check out the Nokia 6100 type LCD that is color and can aid you in other stuff too, if your gun is big (something like AK or M) then LCD would look good on it as it also has place to get mounted try to mount it on side with LCD facing you so you can have the stats always visible while Aiming then you can also insert in functions like infrared camera on the gun and showing stuff in LCD at night.Pretty cool i think

the small lcd would be awesome i use a flip down hud eyepeice for night vision i dont hook it to arduino(dont know how). rfid tags that work acouple of inches would be great
reader in your glove/wrist of shouldermounted for rifles wuth a shoulder rest.

btw if anyone knows how to get arduino to display on (spygear hmd) or similat let me know.

i dont know about bluetooth it would have problems with range right?(being too sensitive)
like when a sidearm is holsterd accidently triggering.
althoug if you need 2 way comm like night vision/ammo
use a hibrid blutooth to connect all devices available, and rfid to designate the active wepon

I got the impression that you are hardwired from your pistol to something that you wear on your wrist.

I also got the impression that you wanted to use the same display setup for both guns.

The wired setup is just blah!

Here is what I would do. Upgrade the wrist thingy to a GLCD. You can get a 128 x 160 for about $8 via adafruit. On this display, have all the info for both guns all the time.

Inside each gun you use bluetooth or simple RF. If you used RF, I would strongly urge the Anaren TI CC1101 modules they are only about 16mm x 6mm with a chip antenna. However, one of the big advantages of Xbee is that they can transmit data without a uController. If you use the Anaren, I am almost certain you would need something like an ATTiny to keep it small. For such really short range, the chip antenna in either case is going to be more than adequate assuming you mount the RF module in a plastic part of the gun.

So each gun transmits its own info when you change mags, shoot, etc... and it is updated on the screen. It's all wireless so no blah wires trailing from the gun(s) to the wrist.

I would be careful about getting excited about updating a visual site picture via an arduino. It will never be fast enough to make it useful.

And last, I have looked everywhere for a hack of one of those spygear video watches and everything I have found links to software hacks for the 'game' itself.

Upgrade the wrist thingy to a GLCD. You can get a 128 x 160

Don't you think its too big for a wrist even a GLCD 128x64 is Big also the size of a Wrist mountable LCD would be > Wrist watch as much big as it doesnot become a overhead on your wrist.

I think the LCD the one i attached is the most appropriate, rest is your choice :grin:

Sorry for taking a whole day to respond. Ok so to narrow some things down. I built it the way I have it now simply because it was 100% within my current arduino ability.

Yes infact the gun is hardwired to my glove at the time it makes connection. Though its a pretty weak connection so I dont have to forcibly unplug or plug things in when pulling out the gun. If you need to imagine something for what it looks like, look at the hands of like gundam models or something, the plug the mechs use to communicate with the electronics in their weapons is where I originally got the idea.

Also to clear something up. The screen I have now isn't on the wrist really, more of on my forearm facing sideways (if I stretch my arm out). Reason I said I'd mount a screen on the side of my gun. The Steyr AUG is a pretty big gun, and its the type where the firing action is back behind where you hold it, so I don't have a view of the screen on the arm when I'm using my rifle.

The current LCD screen I'm using because its what I had on hand, eventual plan was to grab one of those nokia ones, learn to work with them, then use that instead, maybe have it feed data from my friends guns at the same time if I switch to bluetooth or wifi (though I haven't played with them yet, kinda short on the cash at the moment).

Thing is though, I can't use RFID because then I couldnt get info on remaining ammo or mags from the gun (which was the original point) or at least I can't with what I know now. Bluetooth is what I'm going to look into to continue the project sometime next week (after paycheck day.)

For right now though what I'm doing is that I'm using a sparkfun 6pin polarized connector to get the info from the gun itself.
1pin is 5Vin, 1 is gnd, 1 is the trigger button's NO contact, one is the magazine slots NO contact. Then the way its working now is the 2 remaining pins, each gun I'm planning on building a voltage divider into, and depending on the analog output of that VD, itll tell teh arduino what gun I'm using, and call for its info to the screen.

Sorry for the wall of text thats out of order. Kinda typing this at random spots when I get a chance to.

Can you just add the RFID to your current setup? Keep all your hard-wiring, but simply add the RFID.

Marroond:
Can you just add the RFID to your current setup? Keep all your hard-wiring, but simply add the RFID.

What would I gain from using RFID to tell what gun is in my hand when I can just use the voltage divider that I'm going to try this weekend? Yeah an RFID tag is pretty cheap and all, but it adds a layer of complexity that is really unnecessary (even thought he whole setup is really unnecessary). And then whats to say that its not gonna start getting interfered with by the motor in the gun (I dunno if the interference from my own would be too bad cause its a metal gun that I havent been able to get interferance from, but I know one of my friends guns causes static on walkietalkies 10ft away when he shoots, and how harmful woudl that be to the RFID reader?)

NI$HANT:

Upgrade the wrist thingy to a GLCD. You can get a 128 x 160

Don't you think its too big for a wrist even a GLCD 128x64 is Big also the size of a Wrist mountable LCD would be > Wrist watch as much big as it doesnot become a overhead on your wrist.

I think the LCD the one i attached is the most appropriate, rest is your choice :grin:

The one you link is 128 x 128 plus the added size of the breakout which actually makes it larger than the bare 128 x 160 that I am talking about. So what exactly is the difference? I got the point that he had it on his forearm since having even a 16x2 on his wrist would be a bit wonky and a 128 x 160 on the forearm is not too big at all.

What would I gain from using RFID

I agree, it actually adds zero value to the project since the goal is to transmit data from the gun to the screen. If you are transmitting data, either hard wired or wireless, you can bypass this added expense. If you are going to stick to wired for now, just add a second connection so the guns plug into different 'ports'. Adjust your code appropriately and your problem is solved although it is still obviously a bit clunky. Also, RFID buttons may be cheap but the cheapest reader I have seen is $30. That is not cheap.

I really like the idea of adding the display to the gun itself. I have a 4D systems 1.4" and I have thought many times about adding it to one of my modded nerf guns to make it look cool. I have many but the Vortex Praxis is virtually made for this kind of mod. I already added an LED in the bottom of the magazines that light up when you insert the magazines into the gun.

If you are thinking of going this route then I would suggest using this same display. It can be used completely independent of a uController. You just need regulated 5V and you are in business. They aren't as cheap as other displays but since it drastically reduces the peripheral components and the project is really simple, the cost of this display would be well worth it. Sparkfun sells them but they are currently out of stock.

Sacman:
If you are going to stick to wired for now, just add a second connection so the guns plug into different 'ports'. Adjust your code appropriately and your problem is solved although it is still obviously a bit clunky.

Actually the voltage divider on the 2 extra pins is working out well so far, it tells the difference between my rifle and the 2 handguns I have (I made it so its within like 0-350 is handgun 1, 351-750 is handgun 2, and 751-1024 is the rifle, works great. But yeah clunky as hell. And it'd get worse if I started adding more and more guns to the collection of things it senses.

I really like the idea of adding the display to the gun itself. I have a 4D systems 1.4" and I have thought many times about adding it to one of my modded nerf guns to make it look cool. I have many but the Vortex Praxis is virtually made for this kind of mod. I already added an LED in the bottom of the magazines that light up when you insert the magazines into the gun.

Yeah kinda still contemplating if I want to do the screen on the rifle yet. Its a gas rifle, a steyr aug, which means the front handle by the trigger has lots of internal space to build something, and on it I dont have to worry about electrical interferences. I kinda like the bluetooth idea but anything towards that will have to wait. Only way I can see to get the screen on the gun to work right now is either do an arduino micro or something inside the gun that prints to that screen while the same data makes it to the arduino on my person. That way both screens are on the same page. Either that, or do what I've been doing, add several more connectors (and make it clunkier) and send the data to that screen as well (no shift registers on hand to try and 3wire operate the screens).

If you are thinking of going this route then I would suggest using this same display. It can be used completely independent of a uController. You just need regulated 5V and you are in business. They aren't as cheap as other displays but since it drastically reduces the peripheral components and the project is really simple, the cost of this display would be well worth it. Sparkfun sells them but they are currently out of stock.

Hmm thats actually a pretty boss screen, nice price too. Kinda sucks thought that I'll have to go and look into learning another language to work with it. I think I'll finish off getting the current project working, then step up to a better screen in a week or so. I'm guessing you write whatever program you want it to have to the SD from your comp though and then just load it into the screen and it runs. And its nice it can talk to other things with TX/RX, even my terribly small amount of experience so far can make that work. TY for the link though.

http://www.sparkfun.com/products/10090

Too bad they're out of stock right now.

But yeah so really what I've got now is kinda the tip of the "stupid projects to do over the course of the summer to make airsoft more fun." Eventually, how nice would it be to have wifi between my friends and I and be able to cycle through and see what they have for ammo left? Or better yet, why not throw in some GPS modules (way down the road) and have indicators on my helmet to show me the general direction certain teammates are in (of course they'd have to have the same system with their gear) on my visor with RGB LEDs and specific colors for certain teammates. Then put together a few fully working units (arduino, screen, GPS, wifi) and sell it as a kit that I can setup for people to use with their friends.

Perhaps bluetooth would be a good way to go with the gun signals in that respect. Have the wifi and all between the players as 1 kit. Then to get info off the guns, another kit: a couple buttons for the trigger and mag, bluetooth to talk to your other equipment. A screen to mount on the gun if the buyer wants. And an arduino micro or lilypad setup to run off the gun's battery, that runs everything on the gun.)

I dunno though,t ahts a little out there. But its fun to have a dumb idea to work towards isn't it?

Lots of cool ideas! I have been working extensively on a project to use with airsoft over the last couple of months. I'll share details as I get closer to done.

With the 4D Display systems, they have what they call a Graphics controller on board. It appears to be basically a micro controller of some sort and it handles the program similar to the Arduino. You can use the same display in two different ways depending on the firmware that you install. Either serially or stand alone. In serial mode (what they call SGC mode), all of the work is handled by the Arduino and you simply send it commands to tell it what to do. In stand alone (what they call GFX mode) you do have to use their IDE to write the program which is sent to the display's onboard controller. The SD card is used exclusively for data storage like images, music or data. They have their own software which will setup the SD card for you so it is fairly intuitive. They can play video at about 12-15 Frames per second.

The 4D IDE is also C based and while different is not too hard to learn. I have two of their displays the 1.4 and 2.4 w/touch and love them but for any kind of volume production they are a bit expensive. I am probably going to be buying a 4.3 w/capacitve touch ($250) soon for use on another part of the project I am working on.

For the wireless options, for your guns to the display, bluetooth would work but you would have to go with a different option to talk to teamates as you've already noted. So instead of using two different components, stick with one for both. One of the challenges of the Xbees is their size. They are extremely user friendly but they are also huge. I recently came across Anaren's Air modules which utilize the Texas Instruments CC1101 chip and these things are TINY!. 12mm x 6mm. But they are surface mount so a little more work to use them. They can also be had for $12.50 as compared to an XBee at $23. The CC1101 operates in the 433,868,or 915 MHZ band instead of 2.4GHZ. I chose 915 because it is less crowded and has less chance of interference. They might be a little more challenging to setup but they are not too intimidating plus I think they are smarter than the Xbee and once setup they are easier to use since they handle preamble, packetization and checksum for you unlike the Xbee where it has to be done by the Arduino to a large degree if you want to send data in a point to multipoint setup.

For GPS, talk about expensive. I have struggled with this in the past because it has so many cool options. Especially when tied to an iPhone or iPad since they have a built in MAPKit in their IDE. I bought a Mac Mini just so I could write programs for the iPhone. The cheapest GPS module I have been able to locate was through Mouser and I keep thinking that it is a fluke and eventually the price is going to jump. In fact it has gone up $6.00 since the last time I looked about 2 months ago http://www.mouser.com/ProductDetail/Fastrax/UP501/?qs=sGAEpiMZZMv%2FbGM7XKYHK5cWKPdkcWhM but this same module on Sparkfun goes for $49.95.

I think where you are going with all of this is awesome and there is no better way to learn all the ins and outs of programming than having an ambitious project to work on that will challenge you to learn more and more as it grows.

Sacman:
Lots of cool ideas! I have been working extensively on a project to use with airsoft over the last couple of months. I'll share details as I get closer to done.
sweet deal

With the 4D Display systems, they have what they call a Graphics controller on board. It appears to be basically a micro controller of some sort and it handles the program similar to the Arduino. You can use the same display in two different ways depending on the firmware that you install. Either serially or stand alone. In serial mode (what they call SGC mode), all of the work is handled by the Arduino and you simply send it commands to tell it what to do. In stand alone (what they call GFX mode) you do have to use their IDE to write the program which is sent to the display's onboard controller. The SD card is used exclusively for data storage like images, music or data. They have their own software which will setup the SD card for you so it is fairly intuitive. They can play video at about 12-15 Frames per second.
good to know. I think,though, before upping the screen size and capability I'm gonna try for getting the wireless between the gun and the arduino working. Since they dont have any of those screens in stock, and though xbee modules can be kinda big, shouldnt be too much trouble to work one into some part of the gun without getting in the way (I figure I'll get and arduino FIO to be the onboard gun controller for my first prototype of wireless)

The 4D IDE is also C based and while different is not too hard to learn. I have two of their displays the 1.4 and 2.4 w/touch and love them but for any kind of volume production they are a bit expensive. I am probably going to be buying a 4.3 w/capacitve touch ($250) soon for use on another part of the project I am working on.

For the wireless options, for your guns to the display, bluetooth would work but you would have to go with a different option to talk to teamates as you've already noted. So instead of using two different components, stick with one for both. One of the challenges of the Xbees is their size. They are extremely user friendly but they are also huge. I recently came across Anaren's Air modules which utilize the Texas Instruments CC1101 chip and these things are TINY!. 12mm x 6mm. But they are surface mount so a little more work to use them. They can also be had for $12.50 as compared to an XBee at $23. The CC1101 operates in the 433,868,or 915 MHZ band instead of 2.4GHZ. I chose 915 because it is less crowded and has less chance of interference. They might be a little more challenging to setup but they are not too intimidating plus I think they are smarter than the Xbee and once setup they are easier to use since they handle preamble, packetization and checksum for you unlike the Xbee where it has to be done by the Arduino to a large degree if you want to send data in a point to multipoint setup.

interesting, that is in fact pretty small. I wonder about their range though, I know some of the Xbee stuff (for between players) can get up to 1-2miles with clear LOS (So maybe a quarter of a mile or so in the woods). These smaller ones are pretty nifty though, 3.6v max though. So fir the data IO on it would that mean I need to cut the power coming from the arduino pin a bit so as to not damage it?

For GPS, talk about expensive. I have struggled with this in the past because it has so many cool options. Especially when tied to an iPhone or iPad since they have a built in MAPKit in their IDE. I bought a Mac Mini just so I could write programs for the iPhone. The cheapest GPS module I have been able to locate was through Mouser and I keep thinking that it is a fluke and eventually the price is going to jump. In fact it has gone up $6.00 since the last time I looked about 2 months ago http://www.mouser.com/ProductDetail/Fastrax/UP501/?qs=sGAEpiMZZMv%2FbGM7XKYHK5cWKPdkcWhM but this same module on Sparkfun goes for $49.95.
yeah I'm gonna write GPS off as a project for later this summer, after i have guns talking and peoples gear talking spreading gun info. From there it shouldnt be too hard to get the units to communicate GPS info since the network will already be in place.

I think where you are going with all of this is awesome and there is no better way to learn all the ins and outs of programming than having an ambitious project to work on that will challenge you to learn more and more as it grows.
And yeah, if your not being ambitions then whats the point. Theres no fun in it if you aren't trying to do something that they haven't done before (though the military probably has something like this already in place to share GPS data, but well, who doesn't want their airsoft team to have paramilitary tech.

Actually that kinda leads me to a side project that kinda might support this. So say I get a bunch of this stuff working. Then here we are playing a match spread otu over a large area. An area we know is too big for the wifi gear we all have with us to transmit.
Now I know that there are wifi bridges you can get for houses and office buildings. Plug them into a wall outlet, and they act as a repeter for teh wifi so you can use it from farther away. I wonder what it would take to build a repeter like that. Just a little box that you could carry (all its got in it is a controller and a wifi module, and maybe a GPS to help you find it later after the game is over). And by take to build it, what kind of stuff would need to be coded. just have it take in signals and put them immediately back out?

edit. Goes and reads a bit about it.

Wow it practically is that simple to make a repeater. Perhaps add in some micro SD to it then and log players positions and other info just so you can go over what happened during the game later on.

I have done a lot of C#.net and VB.net programming over the years and have tried to find a nice Interface with something like Google maps that would allow you to place objects in real time. Sadly, what I have found has not really been what I needed.

One of the cool things about the iPhone MapKit is that it takes the existing Google Maps SDK and can pinpoint your location based on your phone's GPS or even based on your WiFi signal. So taking that to the next level, you can add pins or other types of marker over the top of the map. So if you fed GPS coordinates from your GPS units back to your app, you could map the players realtime and view it via an iPhone or iPad. I have never worked with the Android system and I wonder if the same type of object is available in the SDK. There is a cable that can be used to attach directly to an iPhone through which you can transmit and receive data. A small 'backpack' attached to the back of an iPad that does this would be AWESOME!

It all comes down to cost. Just the GPS unit is a minimum of $30. Then you need WiFi or RF comms from the remote unit to a receiver unit. Using Xbee this is $20 or more. Add in peripheral components like a Atmel328p, crystal, caps, at least one switch, battery power (assume lipo), battery charging and charge monitoring circuit, a custom circuit board, and a case to hold it all and you would be in for a minimum of $80 for one unit at cost. So unless you have the ability to buy in volume to take advantage of the price breaks and even then you might knock off only $10 or so, this is going to be a tough sell. And I am probably missing some things.

I have put a lot of thought into this in the past and just can't justify the expense since a single unit just for me is kind of pointless. I know that a lot of people put a lot of money into Airsoft and this has such huge potential, however, I cannot see where it would ever be cost effective since the market is pretty small. This is not something you would be able to farm out to China or Taiwan since the total sales volume would likely be in the hundreds if you were really successful and likely only in the 10's.

The single gun tracking app with a gun or wrist mounted ammo tracker is much more cost effective and still a really cool idea. I could see this having potential in the real world as a marketable item.

If you ever think you are going to sell something like this, be cautious of what type of wireless comms you use. Make sure you read the data sheet. For example, LINX makes some very reliable radio modules. But they are very clear on some of their modules that they are not setup to meet US, Canadian, or European requirements for their modules. Xbee and the Anaren Air modules on the other hand only require that you post a specific warning on the device (they give you the exact text in the spec sheet) and it is legally allowed to be used in all three as long as it is setup within the guidelines of the spec sheet.

Also, do some research on RF. The 2.4Ghz Xbee's are great because they are so simple. However, they have 2 significant drawbacks, one is that they are really big. I am looking at two of them as I type and I have never plugged them in because I realized as soon as I opened the box that they will never work for me because of their size. The other drawback is how 2.4GHZ waves propagate. It is more likely to be attenuated by terrain and heavy foliage than lower frequency devices. On the other hand, a 2.4GHZ antenna is really small compared to one for 433MHZ. So maybe there is a tradeoff. I have personally settled on the 915 and 868 MHZ ranges. 915 is for the US and 868 is for Europe. This band is much less crowded than 433 and propagates better than 2.4GHZ. 318Mhz would be an even better choice but it is not as widely supported which is arguably why it is the least crowded of the ISM bands (Industrial, Science, Medical).

I have done lots of research on this subject and still have a lot to learn. I recently purchased several of the Anaren Air modules in 915 and these things are so ridiculously small. I have two of their test platforms in route now because the modules themselves are too small to use without a breakout. Anaren also offers a 433 and 2.4 module. Keep them in mind as you move forward since size is going to be very important to you. I would also be happy to share my knowledge as I learn how to use them and what kind of range I get from them.