Page 1 of 1

DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 1:11 am
by Fiddler
There's no software sub-forum, so I figure the hardware forum is as good as any. ;)

About a year ago I wrote some code for a shot timer running on an Arduino Uno R3.

EDIT: I've moved the code repository to Google Code GitHub https://github.com/hestenet/arduino-shot-timer

Here's a (really crappy) video demonstration of some of the features:

I WARN YOU NOW - THIS THING IS ENCASED IN AN UGLY HUNK OF SUGRU - I'm no sculptor. :wtf:

[youtu_be]http://youtu.be/lpuMynV3e8k[/youtu_be]

Features:
- 200 shots in a string
- Configurable sensitivity (gets sensitive enough for dry fire)
- Echo rejection
- Configurable beep - delay, with 2 random intervals
- Up to 10 configurable par times.

It does not at present store multiple strings of fire. I have code for a version that stores the settings and strings to an SD card, but the Arduino Uno doesn't have enough flash memory to run the SD interface along with the other libraries I'm using. I'm looking into trying it on a Teensy or an Arduino Due.

Anyway - I just thought I'd share. :thanks:

Re: Arduino Shot Timer

Posted: Sat Mar 22, 2014 1:37 am
by Fukshot
I'm definitely impressed. Nice!

Re: Arduino Shot Timer

Posted: Sat Mar 22, 2014 1:44 am
by Fiddler
Thanks!

I use it for my regular practice sessions, and apart from being ugly as sin it seems to work just as well as a Pocket Pro II or similar (stores more shots, actually..).

I think I have my heart set on buying the ShotMaxx watch-style timer eventually - but I had a lot more fun building my own.

Re: Arduino Shot Timer

Posted: Sat Mar 22, 2014 11:57 am
by Fiddler
[NOTE: Some of this content has also been posted at: Pistol-Forum, because the thread there has been one of the top google results for 'arduino shot timer' for years, but no one's ever actually shared code]

Re: Future development -- I'm almost certainly going to keep tinkering. If I don't have a project I tend to fill my time buying new firearms, so it saves me money to have something to do. :p

Re: SD Card support - I'd really love to get this running, because I've got code working locally that should allow an unlimited number of shots, and unlimited length of strings (you'll notice the timer display goes up to 99 hours..). I could probably also add in things like pre-programmed 'qualifier' par system that does multiple par times in sequence as you start/stop the timer.

The problem is this model of Arduino doesn't quite have enough program memory to run the SD code and the timer code(or else my I need to optimize my code better). 32kb is not a lot to work with. Going to try using a Teensy board or a Due which should be enough.

If you want to build your own: EXISTING CODE IS FOR THE NON-SD CARD VERSION ONLY
PLEASE BE SURE YOU'RE COMFORTABLE AROUND A SOLDERING IRON
I estimate the component cost for building the no-SD support version of these is:
- Arduino Uno R3 - $27.95
- Electret Microphone breakout with gain - $6.95
- RGB LCD Shield, with buttons - $24.95
- 9v batter pack for arduino - $3.95 or 3 AAA pack - $1.95
- Piezzo Buzzer - 3-24dvc - 95 db - $9.50 at amazon, but way cheaper at an electronic parts store or ripped out of something else. More like $3 or less
--- NOTE: you can only drive the buzzer so loud with the Arduino's voltage level - tuning the frequency to the resonant frequency of the buzzer helps, try and find a low frequency resonance if you want a lower pitched buzz.
--- There are a couple ways you could increase the voltage to drive a louder buzzer: Project 1, Project 2

That's $67.80 for the base components.
+ shipping for parts if you order online
+ whatever it costs you to build an enclosure/add a belt clip
+ whatever your time is worth

It is more capable than a Pocket Pro II or PACT Club Timer, just uglier (And you can fix that if you're a better craftsman than I!). Not quite at the level of the CED7000, but once I get the SD card version working... well that'll be something.

Just to put it out there, the SD card version will use everything above with the following changes:
+ Substitute the Arduino Uno R3 for an Teensy 3.1 - $19.80 (Yes, it's cheaper, smaller, AND more powerful - harder to work with though, and mine hasn't arrived yet, so YMMV) (How to Power a TEENSY)
+ Adafruit SD breakout board - $14.95-- (This I have used and tested - works great, just don't have the program memory to run it and all the timer code at the same time on the Arduino R3)
+ 4gb MicroSD card - $7.95

+ Of course a modified version of the code - which is still a work-in-progress.

Est. Cost for SD components: $82.55

Anyway - as I said before - I just wanted to share. Please feel free to build your own, use my code, fix my code if you think it's crap, sell kits(please provide attribution?), post your own code.. whatever. I may put the code up on Google Code so it's easier to collaborate on, or maybe Codebender will add version control and community commit features.

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 2:25 pm
by Sheepishlion
GUN NERDS!!! :clap:
Ordering Shapelock and parts now.
thanks.

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 2:46 pm
by Inquisitor
I was just messing with RPi. Figure arduino is next...

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 3:52 pm
by ErikO
Waiting on the SD. Well, and for circumstances to improve a bit.

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 3:55 pm
by senorgrand
Wow...great job!

Maybe you could code one for the new Samsung smart watch? I mean, it's on your wrist...it could probably detect a dry fire.

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 4:32 pm
by Inquisitor
This would make an awesome blog post on the website :)

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 4:42 pm
by Fiddler
senorgrand wrote:Wow...great job!

Maybe you could code one for the new Samsung smart watch? I mean, it's on your wrist...it could probably detect a dry fire.
Might be doable? Depending on what the hardware it'd probably work about as well as the iPhone and Android apps work. Those things are pricey though!


The watch size shot timer does now exist: Shotmaxx

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 4:45 pm
by Fiddler
Inquisitor wrote:This would make an awesome blog post on the website :)
Wuh oh! Now you're making me nervous :oops:

It feels pretty rough around the edges to me, but I guess I wouldn't mind putting something out on the blog. PM if you want me to clean up my post into something blog-worthy I suppose?

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 4:53 pm
by Inquisitor
If you wouldn't mind, yes please :)

Re: DIY - Arduino Shot Timer

Posted: Sat Mar 22, 2014 5:01 pm
by shinzen
Sweet! Nice write up and resourcefulness! I may have to build one of these doohickey's to keep me from spending money on other stuff.

Re: DIY - Arduino Shot Timer

Posted: Sun Jan 08, 2017 12:44 pm
by Fiddler
Just a random thread necro to indicate that the latest updated code is on github:

https://github.com/hestenet/arduino-shot-timer

Re: DIY - Arduino Shot Timer

Posted: Sun Jan 08, 2017 2:52 pm
by spara
Oh wow, I hadn't seen this thread. Definitely will build one now and test it out. Might even build several to keep around the club.

Re: DIY - Arduino Shot Timer

Posted: Sun Jan 22, 2017 10:28 pm
by spara
So I finally got around to building it, had to swap a couple of libraries because I'm using a Uno and it measures the first shot but nothing after that. I guess I'll have to poke a the code to see what's up. UTSL and all of that

Image

Re: DIY - Arduino Shot Timer

Posted: Mon Jan 23, 2017 12:29 am
by Fiddler
Hmm. I was using an uno as well (revision 3). You're using the 2.0.0 release, I assume. What libraries did you swap?

Mine's currently in bits because I cannibalized it for parts but I may be able to get enough of it back together to do some troubleshooting.

Re: DIY - Arduino Shot Timer

Posted: Mon Jan 23, 2017 1:53 am
by spara
Fiddler wrote:Hmm. I was using an uno as well (revision 3). You're using the 2.0.0 release, I assume. What libraries did you swap?

Mine's currently in bits because I cannibalized it for parts but I may be able to get enough of it back together to do some troubleshooting.
TinyWireM
Adafruit_TinyRGBLCDShield

Here's the repo: Adafruit_RGBLCDShield

Re: DIY - Arduino Shot Timer

Posted: Mon May 29, 2017 4:57 pm
by Fiddler
Hi @Spara - 5 months later I found your reply. :sorry:

Did you ever figure out the problem with those libraries? Only recognizing the first shot could be any number of things:
  • Running out of memory for some reason (Do you have all the EEPROM/EEWrap libraries properly working do you think) -- Are you able to hit 'select' and stop the string after recording just the first shot? What happens when you try to scroll through shots after that?
  • Is the constant kMicPin definitely set to the right input?
  • Have you set the sensitivity?
  • Do you get anything interesting in the debug output if you have the console open while running?
My Arduino is still a pile of bits. I need to rebuild it before I can properly test again myself.