speed of sound

Thread Starter

schultz1978

Joined Nov 5, 2011
5
Well yes, the title is not misleading.

Hello everyone, this is my first posting here, andit starts with a question.

I thinking about making an electronic target system, for airguns.

Setup:
4 mics in a square about 20 cm apart. and a pic18 / pic24 those are what i have available.

But for this setup to be usable i need 1/10mm accuracy (preferred)

So i need to be able to tell the difference in time between the sound reaching two mics...

speed of sound approx 340m/s
google says the sound uses 2.94117647 × 10-7 seconds to travel this distance and i need to detect interrupts a lot quicker than this to keep the 1/10mm resolution. at 40Mhz i get the time for one operation to be 2.5 × 10-8 just 10 times quicker.

Can i just give up now, or does anyone have some good ideas to keep me going?

thanks. Tom.
 

Thread Starter

schultz1978

Joined Nov 5, 2011
5
What i was thinking:
I place 4 mics as i said in each corner of a square with sides about 20cm. I'll place a medium like paper that will make noise when hit with a airgun pellet. I need to time from the first mic pics up that noise, and successively time each of the other mics "delay". Since we for this short time can say the the speed of sound was constant. We know where the bullet hit, i hope.

But i need a timer with good resolution, and somewhere to store the results. then the numbers needs to be crunched.
 

Adjuster

Joined Dec 26, 2010
2,148
I would say that it would be extremely difficult to get this sort of accuracy. The point is that a microphone responds only to sounds up to a given frequency, and that therefore it will be very difficult to detect any delay which would not be equivalent to an appreciable phase shift at that frequency.

If the microphone responds up to 20kHz, the period of the highest frequency is 50μs, or 5e-5s. Your desired 2.9e-7s resolution comes to about 2.1° of angle, which seems rather ambitious.

Bear in mind also that this is for the highest possible frequency, the actual sound will be a complex mix of generally lower frequencies. Added to that the microphones are unlikely to be completely identical, so I really doubt that this accuracy can be realised.
 

joeyd999

Joined Jun 6, 2011
5,234
Yes, this will be a challenging project...but not impossible. I can knock 25% of the complexity right off the top: you only need three mics, not 4.

Second...think outside the box a little. The mics you are thinking of use vibration in air, which is relatively slow given what you are trying to measure. On the other hand, if you can change the medium through which the sound is propagated, much higher resolution could be possible.

I suggest you glue three ultrasonic transducer elements to (the back of) an aluminum target.

But now propagation is much faster than through air, and you're not going be able to use your interrupt idea. But, there are lots of analog techniques that can solve this problem with a bit of research. I'd start by thinking in terms of the phase difference between the 3 sensors (i.e. a shot dead center should cause all three sensors to ring in phase). As you move off center, there should be predictable phase changes between the sensors depending on distance and direction (and frequency).

Keep in mind for this to work your target must be perfectly symmetrical along the three axis defined by the three sensing elements (including any mounting hardware), and your elements must each be an exact distance from the center and 120 degrees apart.

BTW, when you complete the project, you can slap yourself on the back for designing your first sonar array!
 

someonesdad

Joined Jul 7, 2009
1,583
Years ago I remember someone somewhere on the web writing up something along these lines (or it was a video) -- and it was for an airgun too. So you might want to do some careful searching. The method used the sonic wave propagation in a solid (as joeyd999 suggested), not the air. I also think joeyd999's suggested approach with 3 sensors is probably the way to go, along with some analog processing to measure positions and phase.

One thing I'd worry about is the gun's pellets messing up the surface of the target if it's aluminum and leading to some scattering (at least increasing the noise level). I'd use steel.
 

John P

Joined Oct 14, 2008
2,025
What strikes me as devilishly difficult about this is what happens if the distances to the four (or maybe three) microphones are very similar, but not exactly equal? So the first microphone responds and triggers an interrupt, and the second microphone responds, but now the processor is already in an interrupt, and an instant after that happens, the third microphone responds--does the processor have enough capture registers to do this without needing an interrupt for each microphone? Because I think that's the only way to do it.
 

joeyd999

Joined Jun 6, 2011
5,234
One thing I'd worry about is the gun's pellets...
Oh my....I think I may have given bad advice! For some reason, when OP said 'air gun', I thought paint ball gun, not pellet or 'BB' gun.

No, please don't shoot pellets or BB's at a hard aluminum or steel target. That's a really good way to lose an eye or hit an unsuspecting bystander.

Whatever your solution is, you will need to absorb the K.E. of the projectile so as to prevent ricochets.
 

BMorse

Joined Sep 26, 2009
2,675
You could probably get better response from a target "plate" using piezo elements, piezo sensors can be made out of some small piezo speakers you get out of musical greeting cards...... couple that with some op-amp circuitry to amplify the signal/limit output signal, etc..... I use the same scheme in my DIY electronic drum set.

Actually the same principal idea can be applied to your target as my drum heads, the closer the pellet hits to center, the more response you get from the sensor..... so you can approximately determine where on the target the pellet hit, if used with atleast 3 piezo sensors, you should be able to triangulate the point of impact to a real close approximation....




and you could also dampen the target plate with the same material some mouse pads are made of, this will prevent the pellets from ricocheting too much...
 

Thread Starter

schultz1978

Joined Nov 5, 2011
5
As a target material i would use paper as stated earlier, a roll of paper for the black center that will be fitted to a motor of some sort to keep the paper free from holes so it can make a nice sound when penetrated...(no phun intended)

Is is possible to make an external circuit that is able to work at a greater freq, than the pic and store those values in some kind of shift register?
 

BillO

Joined Nov 24, 2008
999
For this I would use a free running clock driving a single counter (perhaps 24 bit) and an equal sized latch associated with each sensor. After a shot is detected, the contents of the latches are interrogated and stored, then the latches are reset for the next event. I'd be tempted to use a small 8-bit CPU like a 6502 or z80 for the grunt work. They just handle parallel data and addressable devices a bit better than PICs and AVRs. A design like this would not require lightning fast processing speed.
 

John P

Joined Oct 14, 2008
2,025
I did a quick check on the PIC18F processors, and in fact they can have as many as 5 capture registers. So if the sound could be turned into digital levels (i.e. 1 if sound is present, 0 if not) at an accurate timing rate, then I think it's workable. But getting the digital signal from a microphone output would be a serious design job.
 

GetDeviceInfo

Joined Jun 7, 2009
2,192
possibly, you could mount your target on a gimbal, then measure angular velocity following a strike. This would assume the BB/pellet would have consistant energy on impact. You'd have to pull it back to a reference alignment, possibly with a magnetic drive.
 

Thread Starter

schultz1978

Joined Nov 5, 2011
5
For this I would use a free running clock driving a single counter (perhaps 24 bit) and an equal sized latch associated with each sensor. After a shot is detected, the contents of the latches are interrogated and stored, then the latches are reset for the next event. I'd be tempted to use a small 8-bit CPU like a 6502 or z80 for the grunt work. They just handle parallel data and addressable devices a bit better than PICs and AVRs. A design like this would not require lightning fast processing speed.
how would you go about doing something like this? the higher freq/resolution i can get the better. I only need to have registers enough to store the difference between the first and the subsequent mics.
 

BillO

Joined Nov 24, 2008
999
The counter would be independently clocked and at a frequency such that the counter would not loop over, or complete a full cycle, in the time it takes for the mechanical wave to propagate the longest possible distance on the target.

16 bit might be actually enough for your purposes. The latches would all be attached to the output of the counter and their enables would be driven form the sound detectors. Basically as each detector triggers, it's associated latch will take a snapshot of the counter. Once all 3 have fired, the CPU can query the latches, store the data and reset them.

You start the counter once the first trigger fires, so it's latch reads 0.

The counter would need to be a synchronous type, not a ripple counter. You could use 4 74LS163 4 bit binary counters to make up the 16 bit counter. The latches could each consist of 2 74LS373 8 bit latches. These have tri-state outputs so they can all be tied to the same data bus and addressed with a 74LS138 and thereby easily read by the CPU.
 

John P

Joined Oct 14, 2008
2,025
Choose the right processor, and these count-capture units will be built in. They'd be doing snapshots of a free-running 16 bit counter, and none of them would start it from zero. But it would be trivial to turn the 3 or 4 captured quantities into differences from whichever one triggered first. Having a processor and then building external hardware is like "buying a dog and then barking yourself".
 

atferrari

Joined Jan 6, 2004
4,764
People experimenting with sound learn quite quickly to struggle with echo.

Four corners and four micros, I fear a huge nightmare...!

Google Laurent Kneip Lego spatial sound (words I recall vaguely related to an article in Elektor Spanish language some 3 years (?) ago).
 

thatoneguy

Joined Feb 19, 2009
6,359
I've seen 1/8" accuracy achieved using piezo sensors and a PIC, unsure how it was done beyond asking what the system was since I was shooting.

Private range, long distances, 100-1000 yards, only the 500+ had the notebook system on it, there was one bench that showed the target, and when you fired, the bullet strike would show up as a blinking red dot for 10 seconds, then fade to yellow with a number inside. So for a 5 shot group, you could glance and see where your most recent hit was, and the order of the group to tell if it was stringing upward or just unsteady rest.

There is quite a bit more external interference with .50BMG as it is still supersonic at those ranges, making a loud firecracker type sound when it passes you.

The other 1k ranges use people behind the berm to pull the target down, put a white "pasty" over the hole so point of impact could be seen, then roll the target back up for the next round. I've spent a bit of time in the pit, and it's amazing how long the bullet takes to arrive, as well as how you can hear it "snap-zing" above you (8 feet, safe distance).

In short, piezo sensors should work for airgun perfectly, just a matter of timing. I believe the counters stopping on input would be a good solution.
 
Top