Welcome to the Parallax Discussion Forums, sign-up to participate.

Goran (Sweden)
Posts: **68**

Hi all

Need some help with math.

I am working on a project, an electronic shooting target which should present·where·a bullet hits the target, on a VGA screen.

My idea is as follows:

A rectangular target, at the bottom I have 3 microphones.

I have the prop measure when the bullet passes the target.

I am using 3 different cogs which simulataneous measures the time for the bullets "sound" when passing the target.

and got it to measure the distance from 2 of the microphones, the third microphone starts the measuremt (like a reference)

Now I need to calculate the angle of the measurements from the 2 microphones, thats where my math knowledge reach it limits.

I have included a figure of the mechanical setup and the Spin

I hope the attachment works

Regards, Goran (Sweden)

Need some help with math.

I am working on a project, an electronic shooting target which should present·where·a bullet hits the target, on a VGA screen.

My idea is as follows:

A rectangular target, at the bottom I have 3 microphones.

I have the prop measure when the bullet passes the target.

I am using 3 different cogs which simulataneous measures the time for the bullets "sound" when passing the target.

and got it to measure the distance from 2 of the microphones, the third microphone starts the measuremt (like a reference)

Now I need to calculate the angle of the measurements from the 2 microphones, thats where my math knowledge reach it limits.

I have included a figure of the mechanical setup and the Spin

I hope the attachment works

Regards, Goran (Sweden)

## Comments

2,355815Hmm ... speed of sound is about 300m/s. To get a resolution of 1mm, you need to be able to have a time-resolution of 1/300000 s. Can you do 3µs?

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:

YADRO

68The problem I face is not the resolution, but the math, to figure out the angle based on the measurments from the 2 (3 microphones)

Then I will refine the code to get the neccesary resolution.

Regrads Goran

815In 3 of the four corners (assuming the target is on a square with the center in the ... center) a mike.

Now how to get the coordinates?

say mike #1 is upper left, mike#2 is upper right and mike #3 is lower left.

Make the difference (of ticks) between m#1 and m#2. If the tick of m#1 was lower than m#2 the x-coordinate is:

x = delta t * V_sound.

The x is pointing horizontaly rightwards to m#2.

EDIT:

The x is relativ to the *middle* between m#1 and m#2

Think you can solve that for the y-coordinate.

If you use 4 mikes (in each corner), you can even make some error-correction and see how reliable your results are.

You could do that with three mikes in a circular arrangement spaced 120° apart. But then math is getting a bit more complicated (I always was bad in vector math).

Your arrangement isn't very good, you want the mikes to be as much as possible appart.

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:

YADRO

Post Edited (Nick Mueller) : 11/23/2007 8:36:48 AM GMT68The main reason of the placement of he mikes:

They all have to be on the base, as in the picture, the reason is I do not want any of the mikes to be in the face of being hit by the bullet.

All mikes have to be hidden (below the target) from the bullet, if the shooter miss a lot.

I realise the math is not that easy, thats why I am asking for help.

Hopefully someone out there has the knowledge and can figure this out easy.

For me, I have my head full of ideas but not the right knowledge of the math.

The propcode to do the nessesary mesaurements I think I can manage.

Anyway, I tried to get some help

I hope I have present the problem correct, my native language is not english, but tried to do my best

Regards, Goran

2,967Lets invent a catesian co-ordinate system, zero being the point of the first microphone (a at (0,0)), the secons situated at (b,0), the third at (c,0).

An impact in (x,y) will be noticed (BTW: Are you sure how you can do that? Analysing the signal pattern, I mean...)) after

Ta = SQRT (x**2 + y**2)

Tb = SRQT ((x-b)**2 + y**2)

Tc = SQRT ((x-c)**2 + y**2)

But you will just notice the time differences, as you plan ti do ert mic b

(Ta-Tb) = SQRT (x**2 + y**2) - SQRTT ((x-b)**2 + y**2)

(Tc-Tb) = SQRT ((x-c)**2 + y**2) - SQRT ((x-b)**2 + y**2)

You best solve it wrt x and y numerically with a Newton algorithm.. Or try what Mathematica tells you

Sailors used to take a compass and a ruler

Post Edited (deSilva) : 11/23/2007 8:32:34 AM GMT443The maths you want are called trilateration. (Position finding by distance) As opposed to triangulation (Position finding by direction).

There are some formulas here:

http://en.wikipedia.org/wiki/Trilateration

A search of Google for trilateration should throw up some other sites if that isn't clear.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Help to build the Propeller wiki - propeller.wikispaces.comProp Room Robotics- my web store for Roomba spare parts in the UK815For clarification:

Say if the difference between m#1 and m#2 is 0, the x-coordinate is exactly in the *middle* between m#1 and m#2. So if m#1's tick is smaller then m#2's, x is left from the middle.

Anyhow, you don't like the arrangement.

You could put two mikes on the baseline and the third on one corner and protect it.

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:

YADRO

68I will dig in to the info you gave me, and try to figure out the best way to proceed.

Regards, Goran

997Not on this chart -- didn't think of it in time -- the·case where the outside microphones hear the strike at the same time. Or in other words, the bullet cuts the center line.

Real world distinctions that may have to be made: disregarding the sound of the report (gunpowder explosion) and the sound of the bullet hitting the backstop. And in a firing line, disregarding other shooters.

Post Edited (Fred Hawkins) : 11/23/2007 11:23:29 AM GMT68In the propcode I have taken into count which mike will take the reference (first hear the strike) and act accordingly.

And I got some help with the math outside this forum given a formula which hopefully take into count the case where 2 mikes being hit at he same time.

Now I will make some real testing, and when/if succesful, I will come back here with the result.

Again, thanks all for your inputs.

Now I have to make this happen.

Regards, Goran

997815No, the setup works*)

One minor problem, it can't determine wether the target hit above or below the baseline. But we can assume that the shooter at least hits the target. **)

With two mikes, you only get a line where the bullet hit the target. The third mike makes the difference.

Take your drawing and select a randomn point. Draw a line from that point to every mike. Draw a circle proportional to the delta-t arond the mikes (one mike has a circle with radius 0). Now you see that there is only one solution (disregarding the mirroring) where the distance from the point to the 3 circles is the same. You can draw a circle around the point that touches the 3 circles to clarify that.

*)

My "simplification" was a complete brain farth. Please ignore it. I'll keep my postings to show my stupidity.

**)

That reminds me at my army time when I was called for a reserve-training and they gave me a completely mis-aligned gun. Despite pointing 10m *above* the target, I still hit the *ground*. I simply couldn't hit the target and the supervisor began making jokes. I insisted that it was the gun and that I want another one (it wasn't my gun). He didn't believe me and after I insisted 3 more times, he gave me his. Then he was convinced.

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:

YADRO

997"Now you see that there is only one solution (disregarding the mirroring) where the distance from the point to the 3 circles is the same. You can draw a circle around the point that touches the 3 circles to clarify that."

You'll have to show me a picture of a strike point that is equidistant to all three microphones. That's a null set to me, ie it can't happen. You can approach it at the top of the target, but hopefully your sampling resolution can find a time difference.

More interesting questions: are we measuring the sound through air of the bullet's strike? Or are we listening to the paper as the conducting medium? What's the speed of sound in paper? If we are listening to the sound through air, how close do the mikes need to be? Can they be on the floor or ceiling? Has the rifle's report finished before the bullet hits? (At target ranges it might not.)

815ACK!

> You'll have to show me a picture of a strike point that is equidistant to all three microphones.

No, that doesn't happen. And I didn't intend to describe that situation.

The delta-t can be represented with *different* arcs around the mikes. Then you have to find a circle that tangents all the mike-circles (one of them has radius = 0) and the center is where the bullet hit.

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:

YADRO

68The target consists of a frame which will becovered by a rubberfilm on both sides (and the front side will have a paper with the visual target). This will form a box and when the bullet hits the rubber it will compress the air inside and this pressurewave will hit the microphones. Hopefully the rubber film will sustain many hundreds shot. .

I now have an Excelsheet with all formulas and it seems to work when simulating the different scenarious.

Now I have to complete the hardware (frame and so on). Then start testing with real shooting.

Thanks again, it turned out to be an intresting discussion Goran

9971,825Beautiful problem. Nice thread.

This is a holiday weekend in the U.S.

Fred is actually correct. The differential resolution will be proportional to the spacing between the sensors within the target area.

AND what happens if a bullet passes through a bullet hole?

I try to look at posts such as yours as a "virtual" problems... many times, the posters can't state the actual problem but they try to post the equivalent of that problem. There is always a differences of course[noparse]:)[/noparse]

Are you absolutely committed to just 3 sensors... do you absolutely have to use sound? or would you be interested in any solution?

If you are looking for any solution, this is a no brainer if you use imaging... you just subtract two images (image 1 is the image before the bullet strike... image 2 is the image after the bullet strike). The area with the greatest absolute difference between images is the location of your bullet strike.

This still doesn't work if a bullet goes through a hole. Requires 1 cog. Images can be stored to SD card for later analysis. Your sensor could trigger the image acquisition... 1 cog.

I am intrigued by how far you have actually taken this and would be interested in full technical details. How are you using the cogs... are you using counters?

Rich

2,967997I suspect a propeller could do the same, cheaper. Or for an expensive solution, use a gps module with four electrec mikes on a plate with a oLED-Prop (we could really use those missing i/o pins Oz) in the middle. Put one in every police car.

68Attached is·an Excel speadsheet with the formulas.

And regarding how I use the cogs, have a look at spincode I attached when started the tread.

Anyway, I use·3 cogs, one for each mikrophone and the microphone which sense the sound first is identified so I know which mike to use as the reference, if its not the middle one the calcualation has to be sligtly different, but seems to work.

Attached is also a drawing with som different testresult using the formula.

Please comment, It can be the case I am blind or missed something.

more eyes than to are alwass better.

Bare in mind it is the starting point of my projekt, not finished yet.

Any suggestions are welcome

Goran

2,96768Whats that mean?

68The bullet normally travels around 800m/s.

The thickness of the box approx 4cm

The 3 cogs starts measuring on the first accurense of noise and then stops measuring, so I assume a second trig will do nothing.

Am I right?

Goran

2,967(2) How do you plan to analyse the signal produced by the bullet impact? I asume it will be a most complex signal...

150Remembering that I am trying to not offend anyone here, I am of the humblest of beliefs that microphones are not the answer.

IF IT WERE ME (and it is not), I would use both a camera and a phototransistor array with some custom optics perhaps, so that the thing 'sees' the bullet pass and depending on which phototransistors went dark, would plot an x,y coordinate (actually quite easily) on the screen. A row of detectors across the top, and a row of detectors on one side, could be (relatively) easier to scan and decode than trying to figure out that the thing heard the guy shooting 2 lanes over.

The camera would allow you to use different targets without recoding the thing to display them.

Finally, it could be built slim and light enough to maybe ride out with the target, for use at different distances.

YMMV.

25▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Regards,

Jim

377Goran in Sweden is on to something that has been around for 25-30years.

http://www.sius.com/·· click on the English text r/H top corner ...

The above company makes an acoustic system with the use of 4 microphones and some

pretty special hardware.

Many moons ago when I worked at a shooting practice ground this sort of stuff was not

around .. intercom comms between a shooter and target reader was how it was done.

And I am sure most clubs (small) still do it that way .. shooters these day's

also high powered Zeiss scopes to see the target close up ( from 100M ++)

Sius is a Swiss company· I have seen there stuff and it really works very well.

Their website shows some details but of course no indepth· as to how to do it...

I have seen over the years also studies on how to use a Video (machine Vision system) system

for the the use of automatic "Target reading "

To me the Propeller looks an ideal candidate (simultasking )...

Cheers

Ron· Melbourne OZ

Post Edited (OzStamp) : 11/24/2007 8:16:22 AM GMT2,967(2) Main issues will be the analysis of the signal, due to dispersion and resonance effects. It will be helpful to record some waveforms so we could talk about it seriously.. Note that signals will most likely differ wether the impact is near to a microphone or farer away... It will also most likely differ wrt the way the target is fastened...

997·It might be helpful to express the distances in BulletLengths. And times in opcode speeds. Then you can easily see what the propeller has to be doing.

I am wondering now whether you could do this with three rare earth magnets and your own coils. Attach one or the other to the target and sense the current produced. Like a roll-your-own actuator in reverse. http://forums.parallax.com/showthread.php?p=670206

Maybe you can make·each actuator's arm into a simple hook that holds the the paper.

Then problem of noise may be easier to sort out.

I see a two prop solution: a target prop w/ 3 actuators and an infrared transmitter. A second that receives the data and displays the answer. If you use a oLED-Prop, the shooter could easily bring the system back and forth...

Post Edited (Fred Hawkins) : 11/24/2007 10:41:10 AM GMT