OK - I've been working on this Gunshot Locator project for a couple of weeks - I'm a newbie at a lot of this stuff so be kind please
I started with Sparkfun Electret microphone BOBs :
https://www.sparkfun.com/products/9964
I built my own peak detectors, opamps, duplicated the BOB with a different opamp, used a picaxe, used a coridium mcu (which is pretty cool BTW - $10 for a 50 mhz ARM chip) :
https://www.coridiumcorp.com/prod-specs1.html
Even tested a bunch of designs with wav files of various gunshots. Also did a bunch of testing with a frequency generator & learned how to better use my scope. I have the math worked out so that if I could get a consistent readings I can do the location part - time delay of arrival (TDOA) is all worked out.
My main problem after all of this is that I cannot get two different electret mic designs + to give off signals CONSISTENTLY read the gunshot sound and also get consistently read by the microcontroller. Each electret + opamp gives off slightly different signals and when those signals are fed into a peak detector (diode + R + cap) the variance in those components mean that introduces more variance in the readings - and then the microcontrollers adc pins also dont always give totally consistent readings as well, altho this seems something that I could work with if I could get the rest of the circuitry sorted. There is a peak detector IC out there, a PKD01EP but it's not cheap and I'm not sure if it work for this app.
**broken link removed**
Some basic info - gunshots have basically two components, one a muzzle blast somewhere in the 75hz to 750hz range - this is what I want to get the peak for and there is also a shockwave at roughly 3 to 4 khz which I need to filter out.
The electret puts out a small waveform of about 20 to 200+ mvolts depending on the sound pressure level - the opamp seems to bias this to Vcc/2 which in my case is 3.3v / 2 - which when fed directly into an adc pin gives me readings which oscillate around 255 / 2 = 127 points. If I feed the signal into a hand built peak detector, I get rid of all the AC stuff and get a nice easily read DC signal to work with, it just isnt consistent, this may have to do with the logarithmic nature of sound, or just the variance in the R & cap values, or some other screwup on my part.
When the peak detector didnt work, I moved to the coridium chip with the idea that I could read the waveform directly. This actually works fairly well with a freq generator signal of about 1 khz. It take about 6 to 10 usecs for the coridium chip's adc to read a value and the wavelength at 1 khz is about 1 msec - so when I rectified the 1khz signal and tried to read the 1/4 part of the signal as it goes up to the peak, I actually got the correct readings almost all of the time - so this part works. At 10 usec per read, I would get 1000 / 4 / 10 = 25 reads on the 1/4 wave up of the rectified signal - going from 0 to 255 this can give some gaps, but the peak seems to always get within 1 or 2 points at the top - maybe because a nice neat sine wave is rounded/flattened at the top whereas the actual gunshot waveform would be much more jagged.
But when I run an actual gunshot waveform thru two different electret + opamp circuits into adc pins, and the variance is back.
So I am open to any ideas, suggestions, about what I should try next.
I know that if I can get consistent readings this will work, just how do I accomplish that.