Rip me a new one, how bad is my circuit? (Bang-O-Meter) - Page 1
Forum section: electronics / projects

author: PeterFW
author_rank: Frequent Contributor
timestamp: April 30, 2016, 02:26:00 am
content: 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.htmSwitches, 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

author: PeterFW
author_rank: Frequent Contributor
timestamp: April 30, 2016, 09:26:43 pm
content: No one?

author: Dan Moos
author_rank: Frequent Contributor
timestamp: May 01, 2016, 01:00:44 am
content: 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.

author: tautech
author_rank: Super Contributor
timestamp: May 01, 2016, 01:09:02 am
content: Quote from: PeterFW on April 30, 2016, 09:26:43 pmJust noticed.Subscribed.Keen shooter here too and I'll study up on yourbabylater today.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2016, 01:32:06 am
content: Quote from: Dan Moos on May 01, 2016, 01:00:44 amThanks!QuoteI 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.QuoteFull auto is quite illegal were i am fromGreetings,Peter

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2016, 01:35:34 am
content: Quote from: tautech on May 01, 2016, 01:09:02 amThanks, 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.

author: Audioguru
author_rank: Super Contributor
timestamp: May 01, 2016, 01:45:29 am
content: 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.

author: tautech
author_rank: Super Contributor
timestamp: May 01, 2016, 01:52:05 am
content: Quote from: PeterFW on May 01, 2016, 01:35:34 amYou'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 thevoiceactivated 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.

author: tautech
author_rank: Super Contributor
timestamp: May 01, 2016, 09:32:13 am
content: 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?

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2016, 01:31:37 pm
content: Quote from: tautech on May 01, 2016, 09:32:13 amYes, i will look into that later on todayQuoteOf 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 counterQuoteI 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.QuoteFor 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

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2016, 01:36:05 pm
content: Quote from: tautech on May 01, 2016, 01:52:05 amMy 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 01, 2016, 07:03:55 pm
content: 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!Quote from: Audioguru on May 01, 2016, 01:45:29 amFirst 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

author: tautech
author_rank: Super Contributor
timestamp: May 01, 2016, 07:48:03 pm
content: Looking forward to further updates Peter.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 02, 2016, 12:03:07 am
content: Quote from: tautech on May 01, 2016, 07:48:03 pmThank you!

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 02, 2016, 02:16:02 am
content: 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...

author: Apollyon25_
author_rank: Regular Contributor
timestamp: May 02, 2016, 02:36:54 am
content: 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.

author: Audioguru
author_rank: Super Contributor
timestamp: May 02, 2016, 03:09:21 am
content: Quote from: PeterFW on May 02, 2016, 02:16:02 amPin 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 02, 2016, 02:32:47 pm
content: Quote from: Apollyon25_ on May 02, 2016, 02:36:54 amThat is how it all started, with a piezo element glued to a steel plate

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 02, 2016, 02:37:55 pm
content: Quote from: Audioguru on May 02, 2016, 03:09:21 amThat 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...

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 03:26:42 pm
content: 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 04:22:25 pm
content: 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...

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 04:44:30 pm
content: 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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 05:25:00 pm
content: One last post for today, then i stop thinking out loudMy 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.

author: tautech
author_rank: Super Contributor
timestamp: May 03, 2016, 08:16:37 pm
content: Quote from: PeterFW on May 03, 2016, 04:22:25 pmNice.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 08:31:33 pm
content: Quote from: tautech on May 03, 2016, 08:16:37 pmThanks!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.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 03, 2016, 11:49:51 pm
content: Well... for those who are still interested in my ramblings i present the addet band pass filter:And this is the frequency response:That is ugly, not yet what i want but at least i got it gooing in the direction i want.The filter adds considerable gain and i can not get the right shape i would like.On the other side, the gain is just addet in the pass band, so this might actually be helpfull...I have no idea if this is realy something that needs to be in there but... for some reason my head thinks that it is.For now the filter stays in there but with the option to disable/change it during the first field test and compare it.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 12:19:08 am
content: One last for today, i ripped the next best "authentic" sounding 9mm gunshot of youtube, wich will be highly compressed, so not at all useable but this is the result:That are two shots, i count it as a win, ignoring the compression it nearly looks like what i get out of the scope when i get my percussive maintenance tool and run a test with that on a real circuit.One thing i was concerned about is, how fast the circuit responds but i realised, it does not matter if it takes 100mS to respond.But it has to take consistend 100mS to respond, the rest can do the software.Since the used electret capsule more then saturates at the involved SLP with gunshots, i do not need a real recording.But i need one that is not as badly compressed.Looks like i have to haul my scrope, laptop and microphones to the range at some point and hope i get a bit of piece and quiet to my self on the lane (no pun intendet).

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 02:22:56 am
content: This must be geting quite booring, in case someone still reads along...Now that it works, the questin becomes, is it actually worth it?This is the half wave vs the full wave peak detector.There are some spots were the ratio between the peaks and lows does make quite a difference. Over all... it almost seems not worth the hussle.Wich would eleminate the quite a few components along the need for a dual supply i think.What i dit learn however is that the filter seems to make quite a difference.Or something elese causes that that i do not know of yet, so... i might be wrong on it:

author: tautech
author_rank: Super Contributor
timestamp: May 04, 2016, 07:51:41 am
content: Quote from: PeterFW on May 04, 2016, 02:22:56 amIntentlyplease keep posting.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 11:17:10 am
content: Quote from: tautech on May 04, 2016, 07:51:41 amWell then...This is what i should have done in the first place, i took a look at the recording of a 9mm handgun i found on youtube.So, this is not realy reliable data but i will take that as a first starting point:That is a spektrogram of one shot, more white blotches meanslouder, the higher up the blotches are the higher the frequency.There is a decaying amount of high frequency content and, for this recording, it seems that a focus on the 1.5Khz region seems to work well.On the other hand, we start of with a decent amount of high frequency content, that could indicate that if i were to focus on the higher up ones, i would get a better dynamic range.But... the frequency response of a typical electret capsule is far from linear, they all start to increase sensitivity around 10Khz.That on the other hand could be the reason the spektrogram of the above shot looks like it does.I tried ploting the frequency response of my measuring microphone, but i can not get this to work, this is what a typical electret capsule looks like:https://www.gearslutz.com/board/attachments/remote-possibilities-acoustic-music-location-recording/185100d1280435602-omni-capsule-question-dpagrid.jpgThe compensation file for my measuring microphone shows a peak of 10dB at 10Khz.If this is good or bad... that could maybe used to my advantage.Echo is a problem and the high frequency decays *MUCH* faster, wich is good.The best course of action for now would be to select a random capsule, build a preamp for it, take it to the range with the notebook and take a few measurements.Along with my calibrated measuring microphone and the other uncalibrated ones i have to get a comparison.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 04:17:09 pm
content: Ok... Friday is range day, then i will pack up a few different guns, mics, electronics and take some actual measurements.For now i have twiddeled with the LM324 as a comparator, got frustrated and switched it out for a real comparator.Works way, way better.Not much else has happens so far.Edit: Oh... yea, full wave rectification seems to be a waste of components and board space.But i will reserve final judgement after practical tests.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 08:26:39 pm
content: I will close this damn program now, take a step back and have a drink before i take a bite out of the keyboard.Why? Why you ask?You see... i cobbeled together a simulation of my initial circuit... see for yourself:Take a guess wich one of the waveform looks better and wich is from my initial circuit.I still hold hopes for some filtering though, to improve things.While there is some negative voltage at some points, it is nowere near important bits and the current that flows is under a -100µA.Btw... that is exactly what i saw on my scope when i tested the original circuit first.What i learned however is, that i really do want a dedicated comparator.So, i will take that as a small win.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 04, 2016, 11:23:43 pm
content: Look at that... yep, that looks pretty.Only question remaining, will it behave like this in the real world and how will it respond to different SPL / Microphone positions / enviromental conditions and calibers.I am happy for now.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 05, 2016, 12:55:07 am
content: Not in the mood to talk... here is a video to proof it works

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 05, 2016, 02:57:04 am
content: I give up, can someone give me a "for stupid people" guide on how i can get a LM393 dual comparator into LTSpice?

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 06, 2016, 12:40:37 am
content: My brain is stuck in a loop, it had an idea, but is has no clue what this idea could be good for.But i have this feeling this could be a good idea but can not think of a reason why it is a good idea.Stick two comparators on the output, feed each other with a different trigger voltage and put both of them into a logic gate.For some odd reason i want to do that but can not think of a good reason what that could be good for besides that i have one left over comparator and one left over output of the pot left over...

author: StillTrying
author_rank: Super Contributor
timestamp: May 06, 2016, 02:43:13 pm
content: Still reading....Quote from: PeterFW on May 05, 2016, 02:57:04 amJust use LM339.sub & LM339.asy.I don't think you need to go over the top with your filters and peek detectors for this application, you can eliminate low frequency and wind noise simply by usingmuch too smallcoupling caps.I've built a few sound operated thingybobs. Have a play with this. This was a sound operated flash, I've added multiple inputs and reduced the 555 on-time so it looks more like your application.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 07, 2016, 07:31:14 pm
content: Quote from: StillTrying on May 06, 2016, 02:43:13 pmThank you!Gunrange trip got cancelled due to work, been tinkering with passives.Trying to keep it as simple as possible but unsure of how to approach it due to lack of measuring data.Once i have seen how a gunshot looks on the spektrum viewer i will know wich route to take i think.Had not thought of wind noise till now, the Mic will be recessed in the enclosure with a bit of foam in front, that might keep out some.Usually i just stick furr on the mic with an agressive high pass, that gets all the wind out when recording sound ;^^Got the case and component layout mostly figured out by now and the board mounting/interconnect.Got a problem were to put the RTC clock backup battery though... i will either have to switch to SMD switches (what i really do not want to do) or... find some other way.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 07, 2016, 07:36:04 pm
content: Oh... yea... with the static sound file i am using you can made the wave form look real pretty.But in the real world it would take a cough in the general direction to make it completely not workI will not show the circuit for this one :-P

author: StillTrying
author_rank: Super Contributor
timestamp: May 07, 2016, 10:16:55 pm
content: Going by the waveforms in this pdf, I'd think you have no choice but to detect the initial +ve going muzzle blast or shock wave and then don't listen for 35ms. The mic and electronics would take a short while to recover after such a pressure wave before they could detect any of the much lower level sounds.If you do manage to produce a real life .wav recording you can use it as the actual input source on your LT simulation!http://www.montana.edu/rmaher/publications/maher_ieeesafe_0407_109-113.pdf

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 07, 2016, 10:36:44 pm
content: Quote from: StillTrying on May 07, 2016, 10:16:55 pmHa, i know that PDF!Gave that a good read before i seriously started with this whole thing35ms is plenty, that would give me 20 shots per minute.What i aim for is about 50ms to 100ms between shots.My finger manages about 10 per second with the rifle, that is the highest i can test.What id like to do is, manage that with analog circuitry so i can just use a edge triggered interrupt on the µC.I could use a on board comparator on the µC or use a ADC match interrupt but i would prefer to get a clean signal into the µC.I thought as well about just switching to something beefy and do everything in software but i have not come across a single Smartphone app that works reliably and i am a lazy programmer who barely scrapes by with his code. ;^^My proof of concept thingy works on the range, so i have that gooing for me.My main goal right now is to make is as reliable as it can be with as much SNR as possible.QuoteYep, that is the next step!I will try to get a recording wich my calibrated microphone of a few different shots/weapons/calibers (well, the mic is not calibrated but i have a compensation file for it) to get the spectrum as best as i can.And a recording out of the actual circuit at different nodes to feed into the simulation.My audio interface claims to handle +40dB inputs, so that should be no problem. Although i doubt that figure a bit

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2016, 08:45:30 pm
content: Went to the Range today, i will just post the pictures for now.I will have to think about a few things.The micro is intentionally mounted in the worst possible position, i thought about takeing some proper readings but for one i do not have access to an outdoor range and for the other, i actually want real world examples and not ideal data pointsSetup:From the circuit:Microphone:

author: StillTrying
author_rank: Super Contributor
timestamp: May 09, 2016, 10:33:42 pm
content: I think you've just found out why they usually end up just gluing a piezo to the barrel.I didn't know you were inside, a messy noise for 160ms is a long time.F7FnFE8.jpg looks to me to be terribly AGC'd.7bI0Nqp.jpg looks like you'd be able to detect the peaks even if they were only 50ms apart.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 09, 2016, 10:48:32 pm
content: Quote from: StillTrying on May 09, 2016, 10:33:42 pmAll this mess started a few years ago, with piezos glued to steel plates, how to detect impacts with them i have down quite wellQuoteMost ranges are sadly indoors, outdoor ranges are quite rare in germany, it adds a extra challenge.QuoteIt should not be, i used a external usb mic amp that should do nothing with the signal except digitise is, if i remember correctly the signal just goes through a few opamp for amplification/atenuation and they feed directly into the ADC. But it has been a few months sinde i had the thing apart:http://miditech.de/en-218-produkte-audiolink-IIITo my calibrated ear it sounds authentic ;^^The mic used whas a phantom powered omnidirectional condenser from a DBX RTA.QuoteYea, once i saw that trace i was quite happy and had a few ideas how to change my aproach. I will try cobble together something that might work better then what i am using now.The signal out of the first op amp is horribly compressed, it sounds quite bad to the ear but for once, that works to my advantage i think.

author: StillTrying
author_rank: Super Contributor
timestamp: May 09, 2016, 11:48:57 pm
content: Quote from: PeterFW on May 09, 2016, 10:48:32 pmI need to know how long a piezo takes to detect impact from a steel ball for my gravity measuring machine,I'm thinking it's about 2uS.QuoteWe're not even allowed to look at your photos.QuoteI somehow think that even with reflections 0.4sec should be plenty long enough to see exponential amplitude decay. Perhaps it's limiting rather than AGC.If you look at the dips which occur right after the 4 peeks onF7FnFE8.jpg the dips are mirrored exactly on the bottom negative side. It looks like a cycle or 2 of high amplitude ~6Hz, but it might be just the electronics recovering from the limited peak, it takes until 2:31.90 until the waveform looks normal again - which is longer than the shot to shot time.

author: dannyf
author_rank: Super Contributor
timestamp: May 10, 2016, 12:20:51 am
content: QuoteI think you may have over-done it, as an AFE to a digital instrument. Assuming that the sound output (ac) has sufficient swing, I would feed it to a mcu's digital input, as a trigger for two clocks / counters. The first one to measure time elapsed between shots and the 2nd one to suppress echos and subsequent output from the mic/mic amp. Once the 2nd clock overflows, the mcu would listen for the 2nd shot, which will terminate the first clock, and trigger a display.This can be done by a dual opamp, to implement adjustable gain / sensitivity for the afe. If you hang an rc filter on its output, you can get away with using only one clock / counter in the mcu.

author: dannyf
author_rank: Super Contributor
timestamp: May 10, 2016, 12:37:33 am
content: This is what I was thinking about.U1's the mic's pre-amp. R2/R3 controls the gain.U2 is the threshold control - by setting V3. R5/C1 controls how fast the rising edge is, and R7/C1 controls how slow the falling edge it.triggering a timer by a ST input pin on C1 and you are ready to go.

author: PeterFW
author_rank: Frequent Contributor
timestamp: May 13, 2016, 07:54:39 pm
content: Hello and thank you everybody for the replys,greatly appreciated!For now i will just leave a few more pictures here, later on i will be back with a proper reply for your postshttp://imgur.com/a/Dxohv