Shop OBEX P1 Docs P2 Docs Learn Events
Propeller shooting target (shotgun) — Parallax Forums

Propeller shooting target (shotgun)

Goran (Sweden)Goran (Sweden) Posts: 68
edited 2007-11-24 13:36 in Propeller 1
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 worksrolleyes.gif
Regards, Goran (Sweden)
209 x 193 - 18K
727 x 480 - 50K
«1

Comments

  • AleAle Posts: 2,363
    edited 2007-11-22 21:53
    Trigonometry.... and speed of sound in air is everything you need. Get any gymnasium's math book and float32 object.
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-11-22 22:04
    > Now I need to calculate the angle of the measurements from the 2 microphones, thats where my math knowledge reach it limits.

    Hmm ... 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
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-22 22:17
    Nick,
    The 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
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-11-22 22:59
    The math is getting quite easy, if you arrange the mikes different.
    In 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 GMT
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-22 23:21
    Nick, First, Thanks for your answers.
    The 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
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-23 08:26
    Without a geometric simplication that Nick proposed the math is quite ugly
    Lets 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 smile.gif

    Sailors used to take a compass and a ruler smile.gif

    Post Edited (deSilva) : 11/23/2007 8:32:34 AM GMT
  • CardboardGuruCardboardGuru Posts: 443
    edited 2007-11-23 08:26
    Hi Goran,

    The 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.com
    Prop Room Robotics - my web store for Roomba spare parts in the UK
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-11-23 08:48
    I had a little brain-fart in my math (and corrected it a bit)!

    For 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
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 10:00
    Thanks to all,
    I will dig in to the info you gave me, and try to figure out the best way to proceed.
    Regards, Goran
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-23 11:04
    I think your problem needs restating. Generally, any of the microphones (and sometimes two) can·be the zeroth measure.

    Not 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 GMT
    339 x 499 - 19K
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 11:47
    Fred,
    In 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
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-23 11:59
    Looks like fun! Good luck
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-11-23 12:17
    > I think your problem needs restating. Generally, any of the microphones (and sometimes two) can be the zeroth measure.

    No, 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. smile.gif

    **)
    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. smile.gif


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-23 13:47
    Nick, I don't think we disagree. With two mikes you can only determine an arc, a third is required to find a single intersection. My point was that, as Goran has further clarified, you can't assume a particular microphone will be always hear the strike first.


    "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.)
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-11-23 16:35
    > My point was that, as Goran has further clarified, you can't assume a particular microphone will be always hear the strike first.


    ACK!


    > 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. smile.gif

    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
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 16:56
    Fred,
    The 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. smile.gif.
    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
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-23 17:14
    How fast is your bullet? And how deep is your box? Too thin a box may generate a second noise that interferes with your timing.
  • rjo_rjo_ Posts: 1,825
    edited 2007-11-23 17:26
    Goran,

    Beautiful 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
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-23 18:56
    Goran (Sweden) said...
    And I got some help with the math outside this forum given a formula
    I am eager to see this formula!
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-23 19:49
    Goran may not realize that a subset of his problem is on the news in US cities -- there is a company selling a gunfire sensor that identifies where in the city someone has just shot a gun. It consists of a disc-like object roughly 8 inches in diameter with 4 mikes on the cardinal directions. I suspect that they build up unit value by adding gps details and cell phone networking. Essentially they figure out the distance and angle of the sound of the gunfire from the time differential. The data is then coordinated with the GIS data that the cities already have. Of course, once a city has bought into the concept, they get to buy enough to 'cover' the city. One of the more interesting aspects is filtering gunfire events from other types like fireworks and backfires. I suspect that they have specific waveforms in mind.

    I 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.
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 20:45
    Hi All,

    Attached 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
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-23 20:58
    Goran (Sweden) said...
    Attached is an Excel speadsheet with the formulas.
    Please comment...
    Oh dear, oh dear......
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 21:00
    deSilva
    Whats that mean?
  • Goran (Sweden)Goran (Sweden) Posts: 68
    edited 2007-11-23 21:11
    Fred,
    The 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
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-23 21:16
    (1) You do neither know "a" nor "b" so this formula us of limited use to you; see my posting a day ago or so above..

    (2) How do you plan to analyse the signal produced by the bullet impact? I asume it will be a most complex signal...
  • bte2bte2 Posts: 154
    edited 2007-11-23 22:55
    I am a newbie here, so I'll be brief. I have pondered the idea of a shooting target as you have mentioned for many years. That said (and I am in no way trying to second guess anybody here), my thinking on the subject drew away from using sound (expendable membranes on the targets, other shooters, echoes, reshooting he same hole, and not least the complex math which must be written to make it work acceptably).

    Remembering 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.
  • adriftadrift Posts: 25
    edited 2007-11-24 00:32
    I want to suggest an approach at the other end of the complexity scale, at least to me. If you set aside the issues of no sound or ambiguous sound, then the problem can be done easily I think geometrically and then by table lookup. If you put a mental protractor at each microphone, then from each one you can draw a set of arcs across the target, where each arc is separated in radius from its mike by the sound, time resolution you can measure...or more coarsely, your choice. Pick one mike as the reference and draw its arcs. Then define the boxes formed by intersection with arcs from the other two. So you end up with the target divided into 3 sets of boxes corresponding to the whichever is the first mike with sound. Then it's a lookup. I think.

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


    Regards,
    Jim
  • OzStampOzStamp Posts: 377
    edited 2007-11-24 01:24
    Hi All

    Goran 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 GMT
  • deSilvadeSilva Posts: 2,967
    edited 2007-11-24 09:30
    (1) There is nothing like "complex math" involved.. It's pretty simple, and the Propeller is very good with floating point and trigonometry... I - and many others - can write the 30 line SPIN program in half an hour (I think I should take $50 for it..)

    (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...
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-11-24 10:27
    Goran (Sweden) said...
    Fred,
    The 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
    (an aside: occurrence is proper)
    ·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
Sign In or Register to comment.