I want to build a punch counter for my son's martial arts club. It will count the number of hits to a punching board (bag) in 45 seconds.
Ideally, what I envision is a reset button, triggering a set of warning beeps......
beep, beep, beeeeeeeeeeeeeep, a small counting display 1-45 seconds and a much larger display for the count (3 digits would suffice) followed by a long beep and stop and freeze the count until the next reset.
Although it might be possible to trigger it with a switch, I think an accelerometer might be the way to go.
I have all the parts to build, but I am a complete beginner on the programming side and I could use some help. I want to learn this stuff, but I need this project sooner than later.
Have you thought about which is the best way to determine that the bag has been hit?
A tough button on the inside of the bag might be all ya need.
There is another issue that stings newbies - debouncing. Practically all switches bounce when you open or close them. Not much - we can't see it, but the computer does.
You can get hundreds of on/off triggers when the kid punches once. There's lots of ways to sorta deal with that - using a capacitor to smoothen stuff out - or polling slowly, etc. Check out 'eevblog's video on debouncing with a monkey toy. it helped me out a bit.
I was thinking an accelerometer might give you a lot of false positives or be too fragile.
On the display/beep side of things, there are libraries available which control little LCD screens (LiquidCrystal library) and there's also libraries for the bleepy bleepers too.
I would guess that the main part of your program would be dealing with sniffing for punch signals - and you would have subroutines which every now & then update the display or turn the bleeper on/off.
I was wondering if my idea of the accelerometer would work..... a switch would be simpler but I wondered about bounce as well...... my concern is someone figuring out how to manipulate the results with technique somehow.
I have an arduino stater kit with MANY parts as well as other stuff I have waiting for me to aquire a few
"round tuits" lol.
I have mega 256's, uno's, mini and nano's ..... I have 2 and 4 line displays with and without buttons, like the 1602 and the 2004. The usual switches and stuff.
I do plan to learn this stuff from square one, but my son need this in the next 6 weeks for a competition that his do-jo is hosting.
The hit rate will be very high..... in the order of 300 hits in 45 seconds.
Your options depend on how the pad is set up. Is this going to be a stationary rig or will it need to be portable so a person can wear/hold up the pad?
My first thought without much thought is to spring the pad with a solid backing, which allows you to solidly limit its range of travel. Hinge along the top edge and that's it. Then it's just a matter of putting in a switch or even more simply diy a couple of contacts as the whole rig would be the switch. Springs only need to be strong enough to push the weight of the pad and should easily be overcome by any punch.
Heck you can skip the Arduino process altogether and just buy a cheap digital tally counter and mount that up in there.
Using accelerometers might not be such a bad idea. put an accelerometer in the front of the punching bag close to where it gets hit, and one on the opposite side.
a wobble by the punching bag would give equal values to both accelerometers.
a punch would give a stronger G force change to the front one.
in fact i think if you put a whole bunch of accelerometers in the thing near the edges, you'd even be able to tell which one got hit.
just look for any accelerometer to have a very large G force on it above all his mates. that'd be a hit.
but then again a little tactile switch with a huge face plate might also do the trick. could have like 3 or 4 of those guys.
and assume that punches will never be more than say 20ms apart (50 per second!), so only consider a switch depressed after 20ms of constant on-time.
and consider a punch to be 'one or more switches pressed at once'.
basically like
every time a switch goes hot, note down the time.
when was the last time a switch was activated? X
is it more than 20ms since X? yes? hitcount=hitcount+1. otherwise simply push our timer back another 20ms.
and while looping, constantly check the clock. wait for that 20ms timer to eventually run out then consider your button 'depressed'.
this way if two very quick switch-hits occur, even on the same switch or other switches, they'l be counted as the same event.
Try using a piezo disk on the back of the bag, tapping a bare disk on a desk is enough to flash a led.
With the right circuit you can get a measure of how hard the bag was hit.
Piezos are used to detect door knocks in some projects and as acoustic instrument sound pickups for decades now.