Recommended sensor to detect rifle shot

Subject closed and completed.

Threshold detection ought to be viable. A small electret mike module with the gain turned down is another
candidate for sensor.

Suggestion: One of each. A piezo/shock sensor to detect recoil, and a sound sensor for the report. If both happen together (within some timeframe) a round was launched.

I think you need the display to say “ do you feel lucky punk” when you are maybe at your last shot

Accelerometer, I have used these in the past to detect when a shot is fired.

Personally my first choice would be an accelerometer but a good accelerometer. While I haven't tried it my next simple and inexpensive approach would be a cheap piezo sensor like those found on Amazon. Matter of fact I would use a flexible piezo sensor which I have seen from distributors like Sparkfun:

That or a small diameter sensor. The next trick is mounting the sensor to the rifle. Make yourself a magnetic base and super glue the sensor to the magnetic base and place it wherever it easily fits on the rifle action. We are talking a little 22 rimfire so it's not like recoil will cause it to go anywhere. Place a simple diode in series with the output so the negative going portion of the sensor out gets clipped. Even the small bang of a 22 rimfire should be adequate to get a pulse count. If this is the same rifle each time I guess that you could just put a number to count down from in your code. Additionally you need to consider a display of sorts. Anyway as I mentioned my first choice is a quality accelerometer but I can see where a piezo crystal will do just fine.

In the chance your rifle does not have a steel exposed action where a magnetic base is not practical just get creative. Keep small in mind. :slight_smile: All depends on the rifle action and what is easy to mount.


Please search the forum for "clap detector". Your requirement is exactly the same.


I had a feeling 22 AR was going to figure into this. :slight_smile:

When all is said and done the objective is to get a shock to a sensor and while a 22 version of an AR is not covered with magnetic surfaces it does have surfaces which have shock at the bang. That's all you need. While I have several AR types I lack having a 22 AR.

Yes, absolutely you can breadboard everything and with any luck there is not much to breadboard. Decide on a sensor choice, I like piezo but it is your project. I would use a piezo as I previously mentioned along with a 1N4148 or 1N914 diode. If your AR uses a shock buffer or recoil buffer you may be able to grab signal off the stock opposite your cheek rest point. What you want is just a count down from N and halt or do something on halt (0 count).You can run the whole scenario less rifle and bang by just flicking a piezo transducer with a finger nail.

You run your piezo output into an analog channel and set a limit. Each time a spike (bang) exceeds the limit the count decrements by one.


an accelerometer at the flash suppressor, theory it should get a major bump from a round going out, and much less from normal handling.

One of the major problems with sound pressure level measurements, especially with gunfire is failing to mention where and how the measurements were taken. Just using this chart as an example I see a bunch of db numbers tossed out there but no point of reference? Where were the measurements taken? I can buy a "sound meter" and make a list but unless I define how my measurements were taken all I have is useless numbers. Where with respect to themuzzle were the measurements taken?

Something I like and use is the Howard Leigh Impact Sport muffs. They allow amplified sound but remove gunshots, pretty cool. Between range trips and aircraft around me my hearing is not what it was but at my age I am happy with what I have. :slight_smile:

When you get some sensors, and ordering a few types was a good idea, you can see what works best.


add SCUBA for the total tinnitus package. 24/7/365 eeeeeeeeeeeeeeeeeeeeeeee

Maybe a muzzle brake with built-in IR breakbeam sensing system?

That's an interesting idea. Would I be right in thinking both would be wired up and operating in parallel (correct term?).

I was thinking wired separately to the processor. That way any needed timing adjustments/calibrations could be made in software.

We have barrel mounted chronograph systems using optics so an optical pickup should also work just fine. Easily attached to the muzzle.


Add marriage.

Just so a knuckle dragging neanderthal like me can understand, what are the capability differences between these two accelerometers?

IIC I2C SPI MPU6500 MPU-6500 6-Axis Gyroscope Accelerometer Sensor Module Replace MPU6050 For Arduino With Pins GY-6500

GY-61 ADXL335 Acelerometro 3-Axis Analog Output Accelerometer Module Angular Transducer 3V-5V

Neither is really what you want but in a nutshell the ADXL 335 is a 3 Axis accelerometer:

The MPU 6500 is a 3 Axis accelerometer but also includes a 3 axis gyro making it a six axis device.

Neither is really designed as an accelerometer for detecting shock and vibration and if you take the accelerometer route for a sensor you want the latter, shock and vibration. The sensors you mention are pretty nice sensors but not so much for detecting a bang or shock like rifle recoil. That is a very brief overview, very brief.


What sort of accelerometer would I be ideally looking for? I take it there would be a particular set of specs I would need to search for that would make it stand out as suitable for detection?

Incidentally, most of my ordered bits and bobs turned up late this afternoon (much sooner than I expected to be honest), though no sign of the Arduino Uno or KY-002 that was supposed to be part of it. Will have to chase up with the seller. Grrr.

Still won't be able to do much until our club range opens back up again once lockdown restrictions are lifted. Till then, lots of loud clapping and smacking a heavy hammer off my steel workbench may have to suffice!

What sort of accelerometer would I be ideally looking for?

You would ideally be looking for an IR emitter and receiver to make a muzzle breakbeam like in my previous reply

Yeah, the problem is coming up with something inexpensive. Inexpensive yet having enough sensitivity to pick up the action cycling on a .22 caliber AR type rifle. I have been tapping one of these with my finger nail and I get about 8 volts pk to pk.

Certainly cheap enough I just don't know how well they would work. If you go with anything like these you want a diode in series with the output cathode towards the Arduino input. Any diode like a 1N914 or 1N4148. Trying to keep this inexpensive and simple configuration.

I also wouldn't rule out an optical pick up at the muzzle. A Google of "optical slotted sensor" should bring up some hits. They have a fast response and should catch a bullet passing by no problem. Vishay, Omron or other manufacturer. I see plenty as modules off the boat and inexpensive, just make sure the slot width well exceeds the 5.56 mm (.224") bullet diameter which will be passing through it. :slight_smile: