Author Topic: Rip me a new one, how bad is my circuit? (Bang-O-Meter)  (Read 14467 times)

0 Members and 1 Guest are viewing this topic.

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« on: April 30, 2016, 02:26:00 am »
This turned out to be a long read... i would appreciate if someone made it through this wall of text.
This is the first circuit i ever designed on my own, from the ground up and that i am a bit proud of.

Edit...
I found a picture of what it looks like when you take a breadboard to the gun range:


And how the last iteration looked like that i used to test the circuit:


Hello!
I am a avid shooter and like to compete in matches, one particular class requires to measure the time between shots.
This is done with a microphone based "stop watch", here are a few common devices that can be seen in the field:

https://www.ipsc.org/store/storeel.htm

Switches, transducers, sensors on the targets are *not* and option, you have to use a microphone.

The dynamic range is allways a problem with these things, they need to work with annything from a rimfire rifle (fairly quiet, relatively spoken) to a magnum Revolver (mighty boom, really loud).

Since i like to twiddle with electronics and the cheap common ones (perticuarly the smartphone apps)  have problems with sensitivity i decidet to build my own.

The only important part about this is, how the impulse of the shot is registered.
I wanted a pure "analog" solution for a few reasons, so i can only use a edge triggered interrupt on the logic side.

After *A LOT* of trial and error, reading, research, scientific/forensic papers and measuring with scope and microphone my first solution looked like this:

PCB:

Schematic:


Component values were chosen by wich parts i had, trial and error and my calculator.
The sensitivity is only changed by a trimpot and the trigger level of the comparator was adjusted by a smoothed PWM signal.
The first design had a DAC for that but a PWM signal worked just fine, one part less to populate.

After the first range visit i was a bit bummed, it dit not work like it should, i had intermitten problems with the dynamic range and echo.
I dit some more soldering, changed component values and went back to the range.
It worked fine with the big guns now, but the small ones... not so much.

So i wanted something with the possibility of "auto tuning", no extra "knobs" to change the settings and i dit not want to etch another board.
So i botched in a digital potentiometer:

Botched Board:

Modified circuit:


This thig works extremely well, i have only run it though 500 shots of various calibers but it registered every last one without a hitch and under various enviromental conditions.

The R-C on the input of the amplifier serves as a high pass filter, the amplification is trimmed by one channel of the digital pot.
Then comes a half wave rectifier and envelope generator, the decay of the envelope gen is determined by another channel of the digital pot.
Third is a buffer stage, why not, i had one channel on the quad op amp to spare.
Lastly the comparator with adjustable trigger point and hysteresis by the two remaining channels of the digital pot.

The OpAmp is a LMV324 from TI, a normal LM324 dit not work very well with a 3.3V supply. With the LMV324 it works just fine with annything from 3 to 5.5V.
The digital pot is a MCP4461 from Microchip, it was the only one available on short notice at the time.

So... how dit i do?
Sadly i do not have screenshots from the scope to show the impulse response and the delay between stages. But they do look pretty and do not introduce a delay that is of concern.

Greerings,
Peter
« Last Edit: April 30, 2016, 02:37:05 am by PeterFW »
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #1 on: April 30, 2016, 09:26:43 pm »
No one?
 

Offline Dan Moos

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #2 on: May 01, 2016, 01:00:44 am »
I'm not good enough to critique the design, but I'm impressed with the idea. Maybe you mentioned this and I just missed it, but how close together can shots be and still be distinguished? I assume multiple shooters is not gonna work, because of inevitable overlapping shots, but say a fast shooter on a quick firing semi-auto? I used to have a Ruger 10-22 that I could squeeze them off pretty quick with. Is it able to distinguish individual shots as fast as a guy can shoot them? It would be neat if you could test it with a fast full auto, although the opportunity to do that is sadly rare and expensive.   
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29214
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #3 on: May 01, 2016, 01:09:02 am »
No one?
Just noticed.  :)
Subscribed.

Keen shooter here too and I'll study up on your baby later today.
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 
The following users thanked this post: sarahMCML

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #4 on: May 01, 2016, 01:32:06 am »
I'm not good enough to critique the design, but I'm impressed with the idea.

Thanks!

Quote
Maybe you mentioned this and I just missed it, but how close together can shots be and still be distinguished? I assume multiple shooters is not gonna work, because of inevitable overlapping shots, but say a fast shooter on a quick firing semi-auto? I used to have a Ruger 10-22 that I could squeeze them off pretty quick with. Is it able to distinguish individual shots as fast as a guy can shoot them?

I had not mentioned it, but that was a big concern.
You only have one guy on the range at a time, so only a single shooter has to be measured.
The rate of fire is dependent on the calibration and caliber, i was not able to outshoot the timer and i have a really fast trigger finger.

I think i got down to about 50ms resolution between shots, that would be 20 shots a second or 1200 rounds per minute.
That is way above what you encounter in the civillian sector.

A controlled pair is way within that margain and even a double tap is registered without a problem.

When you really tweak the parameters even more should be possible but i lack the weaponry to test that.

Quote
It would be neat if you could test it with a fast full auto, although the opportunity to do that is sadly rare and expensive.   

Full auto is quite illegal were i am from :)

Greetings,
Peter
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #5 on: May 01, 2016, 01:35:34 am »
Keen shooter here too and I'll study up on your baby later today.

Thanks, i look forward to the feedback!

Btw...
My initial tests were quite interesting to look at, i needet to simulate a gun shot at home. A hammer and cutting board from the kitchen were the perfect solution.

I sat more then one evening behind the scope, constantly banging a hammer on my table.
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #6 on: May 01, 2016, 01:45:29 am »
1) Your mic amplifier is inverting with a 1k input impedance that loads down and reduces the mic output. It should be non-inverting with an input impedance of at least 20k ohms.
2) The R2 and R4 voltage divider that biases the mic amplifier feeds half of all power supply noise into it so add a filter capacitor to the junction of the two resistors.
3) The C3 capacitor that couples the signal from the mic amp to the rectifier opamp might destroy the input clamp diode or input transistor of the rectifier opamp if there is a loud signal then C3 causes the input of the rectifier opamp to go negative (which is not allowed). Also then the clamp diode will conduct (if it survives) and cause a wrong bias voltage on C3. The circuit will be safer without gain in the rectifier opamp then its output can cancel negative inputs.

 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29214
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #7 on: May 01, 2016, 01:52:05 am »
Keen shooter here too and I'll study up on your baby later today.

Thanks, i look forward to the feedback!

Btw...
My initial tests were quite interesting to look at, i needet to simulate a gun shot at home. A hammer and cutting board from the kitchen were the perfect solution.

I sat more then one evening behind the scope, constantly banging a hammer on my table.
:-DD

You're lucky the police weren't called by a neighbor.
(Shots fired @ PeterFW's address)

The Mic solution you're using is not that dissimilar to the voice activated trap bird release used in clay bird shooting.
Those I've had a peek at are using a micro with set parameters to distinguish between background noise, gun report and the call of "Pull" required when a bird is to be released.
Gain can be a problem with these too as a feeble "Pull" call will not trigger clay bird release.
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29214
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #8 on: May 01, 2016, 09:32:13 am »
Looks very novel Peter, thanks for sharing.
Do try the mods that Audioguru has suggested, you wouldn't want your final draft to have any unforseen problems.



You will tidy this up a bit more I hope ^

The battery looks overkill, what are the actual power requirements?
Is production for resale intended?
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #9 on: May 01, 2016, 01:31:37 pm »
Do try the mods that Audioguru has suggested, you wouldn't want your final draft to have any unforseen problems.

Yes, i will look into that later on today :)

Quote



You will tidy this up a bit more I hope ^

Of course, i should have said that. That was cobbeled together in an evening before i was leaving for a match, were i gave it a few test runs.

This is the enclosure and display i want to use, all on one PCB that fits nicely in it:


Ignore the color, that was initially bought for a geiger counter :)

Quote
The battery looks overkill, what are the actual power requirements?

I have plenty of the 18650 cells at hand, so i use them.
One thing about everything portable that you can buy today is the abismal battery life.
The final unit will run of 2AA NiMh cells, so in case it runs flat they can be easily replaced or you can run the shop and get new ones in a pinch.
Additonally, it makes the power supply easy, one simple MCP1640 boost converter.

It want it to be able to run at least 24h straight, that should be possible in that configuration.

My last prototype got way out of hand, really out of hand, too many feature and gizmos so this one i scaled waaaaay back.

Quote
Is production for resale intended?

For the moment, own personal amusement.
I do not see enough people want such a thing, but i design it with the possibility to make a parts kit out of it.

Greetings,
Peter
« Last Edit: May 01, 2016, 01:58:30 pm by PeterFW »
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #10 on: May 01, 2016, 01:36:05 pm »
You're lucky the police weren't called by a neighbor.
(Shots fired @ PeterFW's address)

My neighbors are nice to me, that may have a reason...
I once ordered ammunition, about 150kg, a maybe 50.000 rounds.

They were delivered by a special courier, that should have told me when the delivery will take place and only i should have been allowed to receive them.

I was not home, the guy dumped all the stuff of at my neighbours.
I do not know what he was thinking, that is a sure way to loose his job or why my neighbours accepted, but... ever since, they are nice.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #11 on: May 01, 2016, 07:03:55 pm »
Edit: Scratch that about the Charge pump, LM2662 is the main contender.

Hello and thank you *very much* for the reply, that was very helpfull!

1) Your mic amplifier is inverting with a 1k input (...) It should be non-inverting with an input impedance of at least 20k ohms.
(...)
2) The R2 and R4 voltage divider that biases the mic amplifier feeds half of all power supply noise into it (...)
3) The C3 capacitor that couples the signal from the mic amp to the rectifier opamp might destroy the input clamp diode(...)

First of all, i upgradet my precision-percussive-maintenance device, this one works on any surface:


Then i took some measurements and of course, you are right:



At this point i thought very hard why i dit it that way and realised why.
I had to bias the first op amp and could not figure out how to bias a non inverting one, so i had to AC couple the seond stage, i think the series 10K resistor limits the current though the clamp diodes. That is why it works and survives now.

Then i took another hard look at the circuit and realised that my "precision rectifier" is wired wrong... And that the negative spike produces a lot of "ripple", for the lack of a better word.
I had not realised that till now.
At that point i got angry at the damn single supply and all the problems it produces and i have decidet to do this:

Add a inverting charge pump, the LM2662 looks good so far, change the LMV324 to a LM324 and run everything of a dual +3.3 and -3.3 supply rail.
Kick out the buffer stage and implement a full wave recitifer.

Starting with a non inverting amp for the microphone, then the full wave rectifier, after that the envelope/peak detector and lastly the comparator.

Does that sound like a good idea?
That way i can finally handle the negative bits as well as the positive ones and should smooth out the whole waveform.

The main reason i dit not start with this is because i dit not know that inverting charge pumps are fairly cheap and that they exist.
I was introduced to them after i started with this circuit.

Greetings,
Peter
« Last Edit: May 01, 2016, 07:16:51 pm by PeterFW »
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29214
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #12 on: May 01, 2016, 07:48:03 pm »
Looking forward to further updates Peter.  :-+
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #13 on: May 02, 2016, 12:03:07 am »
Looking forward to further updates Peter.  :-+

Thank you!
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #14 on: May 02, 2016, 02:16:02 am »
Ok... i spend a bit of time thinking and i drew something up:



I think this might work, i threw a bandpass filter in there with a Q of 8 and a center frequency of 1Khz since i had two unused opamps.
If that is a good idea, i do not know.

What is not shown is the digital pot to tweak the amplification of IC1A wich would replace R3, the discharge rate of C9 through R19 (replaced by digital pot) and the hysteresis and trigger level of IC2D wich would replace R19, R20 and R21 with the digital pot.

Analog stuff is completely out of my comfort zone and way over my head but i think i made the best out of my limited knowledge...
 

Offline Apollyon25_

  • Regular Contributor
  • *
  • Posts: 66
  • Country: nz
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #15 on: May 02, 2016, 02:36:54 am »
As a fellow shooter, have been reading this with interest.

Incidentally, I know a certain military training-equipment design company that used a barrel mounted piezo to sense the firing. However it was quickly transferred into the digital domain and processed there.

 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #16 on: May 02, 2016, 03:09:21 am »
Ok... i spend a bit of time thinking and i drew something up:
Pin 3 input of the mic preamp opamp has no DC bias voltage. Pin 3 should have a resistor to ground, try 47k and replace R2, R5, IC1D, R7, IC1B and R24 with pieces of wire. Change C1 to 220nF (0.22uf).
C2 cuts 800Hz and higher frequencies. A nearby gun shot is a low frequency so get rid of the bandpass filter that cuts all low frequencies. 
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #17 on: May 02, 2016, 02:32:47 pm »
Incidentally, I know a certain military training-equipment design company that used a barrel mounted piezo to sense the firing.

That is how it all started, with a piezo element glued to a steel plate :)
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #18 on: May 02, 2016, 02:37:55 pm »
A nearby gun shot is a low frequency so get rid of the bandpass filter that cuts all low frequencies.

That is something i could not get reliable data on, in theory it is a infinite impuls that should have the whole spektrum with a uniform spread.
The most reliable data i got seems to indicate that peaks around 1Khz for various calibers.

While i do have two measuring microphones, both are not suited for the high SPL so i have not measured it myself.

On the other hand... i spend the better part of the day learning how to use LTSpice and, the circuit does not work, at least not in the simulation:


When i put a diode on the output it looks like it should but that kind of defeats the purpose of the thing a bit:


At the moment i am dooing some more reading on the subject...
« Last Edit: May 02, 2016, 02:43:46 pm by PeterFW »
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #19 on: May 03, 2016, 03:26:42 pm »
Edit: Annyone got a suggestion how to simulate a sine wave pulse? :)

After two days i start to get comfortable with LTSpice and dit some twiddeling around.
At the moment my plans are to go to the range and take some measurements with the microphone of a few calibers and pipe that into LTSpice to simulate with real data.

This is how it looks so far, is the simulation is correct this circuit yields about 100mV more putput that the last one, wich is kinda important when i put a diode on the end and defeat the whole purpose a bit.



This however makes me think something else, i could just amplify the signal to the heavens and ignore the diode drop. Wich would require a different power supply.
The most i have to work with are 3.3V wich the LM324 limits since it can only go up to 1.8V but it gets further down in voltage so i might invert the signal and work from there.

I will have to do some thinking.
« Last Edit: May 03, 2016, 03:28:27 pm by PeterFW »
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #20 on: May 03, 2016, 04:22:25 pm »
Finally found the file again how the things are supposed to go in the enclosure:



I would very much prefer to use a LiIo cell but i can not find an enclosure that has a battery compartment for a single 14500Cell.

The battery has to be replaceable on a whim... on the other hand... if i were to replace the voltage regulator with a different one, i could either use 2AA or a single LiIo with a spacer in the compartment of this enclosure...
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #21 on: May 03, 2016, 04:44:30 pm »
Scratch that... my go to BuckBoost starts at 2.5V Vin and i will not go hunting for a new one. Finding this one was hard enough.

Double AA it is, that gives 10 hours absolutely worst case battery run time without power savings on the µC without backlight.
Is has to be enough.
« Last Edit: May 03, 2016, 04:48:07 pm by PeterFW »
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #22 on: May 03, 2016, 05:25:00 pm »
One last post for today, then i stop thinking out loud :)

My problem so far is, to get the envelope with a adjustable decay from a rectified signal that has a fast response time.
The simulated rectifiers all work and that is a big win for the moment.

And i figured out how to get a sine wave pulse in the meantime, small win, i take it.
« Last Edit: May 03, 2016, 05:36:58 pm by PeterFW »
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29214
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #23 on: May 03, 2016, 08:16:37 pm »
Finally found the file again how the things are supposed to go in the enclosure:


Nice.  :-+  8)
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline PeterFWTopic starter

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Re: Rip me a new one, how bad is my circuit? (Bang-O-Meter)
« Reply #24 on: May 03, 2016, 08:31:33 pm »

Nice.  :-+  8)

Thanks!
This thing is about 5mm too short in every direction so i have to fiddle quite a bit to fit everyting in there. Mostly the display, it barely fits.

The plan is to use two boards, the top one display, buttons, buzzer, regulator, IO expander, and a old school hardware power switch or two.
Maybe a RTC and SD card holder.
The bottom one, logic, analog circuit and so forth.
Everything would fit on one board but...

This way i can use standard through hole switches, they align with the face plate holes and they are easily hand solderable along with the display.
And, this is way better, the top board holds no appilation specific hardware.
That means i can switch out the bottom board with something completely different like the radiation detector, thermocouple logger, signal generator and other things i allways wanted to put in a decent handheld factor.

And for the most part, all the lines from the top to bottom board are I²C and SPI. Neat and tidy.

LTSpice is awesome, i installed it years ago but never used it much, i should have taught myself how to use it waaaaay sooner.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf