Byte Me
Posts: 4
Joined: Thu Apr 28, 2016 6:01 am

Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 6:37 am

Hi, I am looking at building an electronic target that uses the impact sound from the pellet hitting the paper. It will have multiple sensors (microphones) around the target (4 or more). The mic that hears the impact first needs to reset all timers, and/or start the sampling routine. As each mic hears the impact, it will need to time stamp each one, save to a variable, and then do a bunch of calculations to determine where the pellet hit the paper. I am quite well versed in PIC microcontrollers, but it appears that the RPi can do this much faster than a micro. With sound travelling at 1126 ft/sec, and an on-board processor speed of 1.2 GHz, what resolution could I expect in fractions of a millimeter? Ideally I would like sub 0.1 mm accuracy. What would be the best way to achieve this with the RPi, or is it possible? Thanks. Kevin


1126 ft/sec x 12" in/ft x 25.4 mm/in = 343204.8 mm/sec

343204.8 mm/sec / 1000000 = 0.343mm/uS

Pithagoros
Posts: 578
Joined: Wed Nov 12, 2014 8:16 pm

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 7:20 am

Your choice of OS for the Raspberry Pi may be an important consideration here, as standard Linux might not suitable.

ghans
Posts: 7893
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 7:41 am

Are you trained in DSP algorithms ?
Which programming languages do you know ?
How big are the pellets ?

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
karrika
Posts: 1352
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 7:41 am

You are mainly interested in time differences between microphones at the us level. There is no time to start recording at the first impact. You may get something done by continuous 4 channel recording. Usually the audio interfaces can sample at 44.1 kHz - not 3 MHz. So you may need to create your own digitizers and your own high speed microphones.

Byte Me
Posts: 4
Joined: Thu Apr 28, 2016 6:01 am

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 3:00 pm

Thanks for the responses.

I am not trained in DSP, but I have already been experimenting with hardware to process the impact, and am quite confident that I am most of the way there on that. Moving forward, assume there is a clean pulse coming from each microphone. If I can accomplish this in the RPi without it slowing things down too much, then I would incorporate that, but that would be later.

I am new to Python, but my son is a whiz, and he will be helping with that. The target is actually for him, as he is a competitive shooter. I have also done some work in C, but limited. If there is a language that would be ideal for this, I am open to learning a new one.

The pellets range from 4.48 - 4.51mm in diameter. The target is 17cm square. I don't know if I can post links here so google "issf pistol target".

Yes I am primarily needing to measure time difference, but in the nanosecond range. 1us gives a resolution of 0.343mm so 100 ns would be 0.034mm which is enough. I was also thinking of using interrupts for each microphone, so on port change, a timestamp would be saved for each one in its own variable. The first impact would be saved as "time 0" and used as a reference, and each successive one would be a greater value. After that, it's just math to calculate the impact position.

I know how to do this in PIC microcontrollers, but the ones I am familiar with aren't fast enough to get the resolution that is needed.

Thanks in advance.

Kevin

User avatar
joan
Posts: 16214
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 3:10 pm

Using GPIO interrupts under Linux would probably be a non-starter. They are not time-stamped at source and there is a 50+ µs latency before the userland process could get the interrupt to store the time-stamp.

I'd be looking at busy-spinning reading the GPIO and logging the changes. It would need to be C. Python is a non-starter (in my opinion) at the sort of timings you are talking about.

There is an easily accessible microsecond clock. I'm not sure how easy it would be to get better resolution.

Dutch_Master
Posts: 362
Joined: Sat Jul 27, 2013 11:36 am

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 3:17 pm

As you're well versed in micro-controllers, have a look at the Arduino Due. IMO this might just be what you need, as it's the fastest proc in the Arduino family (84MHz clock) and with 12 analogue inputs an increased accuracy by having more microphones is possible. Hook up a large TFT screen and you should be able to show the exact location of the impact in a ring-grid. Using one USB port as host, and a cheap USB hub, you can also hook up a keyboard and mouse to keep scores in competitions ;)

User avatar
jbeale
Posts: 4003
Joined: Tue Nov 22, 2011 11:51 pm

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 3:28 pm

In a similar vein, the Teensy 3.2 from pjrc.com could also work (it is not an Arduino but mostly compatible, and arguably better in some ways). It has clock speeds to 96 MHz, and not too expensive. http://pjrc.com/teensy/teensy31.html

Sampling an analog signal to 100 nsec resolution implies your microphone has some measurable response at MHz frequencies, which isn't a common audio microphone spec. I guess medical ultrasonic transducers may achieve that? Otherwise I suspect you'd just be measuring RF electronic noise in that frequency range, unrelated to real acoustic signals.

henryhanselscott
Posts: 107
Joined: Sun Jan 18, 2015 1:31 pm

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 3:50 pm

Before integrating the pi into my project arsenal, micros were my go to weapons. It seems to me that a micro would be much more accurate at this because they are generally deterministic. The pi is fantastic will all the peripherals that it brings to the table, but time critical functions may not be its strongest point. With a good high speed GPIO library you may be able to pull it off. I would re-investigate using a micro.

Byte Me
Posts: 4
Joined: Thu Apr 28, 2016 6:01 am

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 9:05 pm

Thanks for the feedback, I have some reading to do now.

GerryG
Posts: 52
Joined: Fri Jan 22, 2016 5:06 am

Re: Need High Accuracy Electronic Target using triangulation

Thu Apr 28, 2016 11:12 pm

How about pointing a camera at the target and using image change detection to determine the position of the most recent pellet strike? That might be easier that working out the triangulations from sound. The sound of the pellet strike could trigger the change detection.

Byte Me
Posts: 4
Joined: Thu Apr 28, 2016 6:01 am

Re: Need High Accuracy Electronic Target using triangulation

Sun May 01, 2016 4:09 pm

I actually setup something similar to that already. The problem with that is it isn't accurate enough, the second is that the camera has to be mounted to the side by about 4", so it doesn't get shot. I have a camera setup near the target, and a monitor back where he stands, so he can see where he shot without having to real his target back to see. Works real good for practise, but an electronic target would be ideal. Thanks.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Need High Accuracy Electronic Target using triangulation

Sun May 01, 2016 4:45 pm

Byte Me wrote:I actually setup something similar to that already. The problem with that is it isn't accurate enough, the second is that the camera has to be mounted to the side by about 4", so it doesn't get shot. I have a camera setup near the target, and a monitor back where he stands, so he can see where he shot without having to real his target back to see. Works real good for practise, but an electronic target would be ideal. Thanks.
I think the idea wasn't to have him look at the video stream and find where he hit but to have the camera taking a series of high resolution pictures and your software would then compare the before and after and find where the hit was automatically.

Given that you've already got the hardware in place for this, a test in software wouldn't seem to require more than just figuring that out, a step ahead of having to build some complicated system involving gathering the sound and extreme timing requirements.

ghans
Posts: 7893
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Need High Accuracy Electronic Target using triangulation

Sun May 01, 2016 4:51 pm

I don't see how this computer vision approach is more feasible
than the audio DSP thingy ...


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

jim_hahn
Posts: 3
Joined: Mon May 02, 2016 5:02 pm

Re: Need High Accuracy Electronic Target using triangulation

Mon May 02, 2016 5:22 pm

I and several other retired SW and EE types have been working on this problem for 5 years. Our intent is purely to have fun, no desire to commercialize. Our system can deliver 0.01 inch accuracy on a good day and an inch on bad hair days. We use a Photon to capture the TDOA (Time Delay Of Arrival) microphone times, and transmit to a laptop for triangulation and display. We are thinking of using the Raspberry as a laptop replacement.

You really don't want DSP or continuous channel recording. Just put some mikes out there and run them in to FF latches. Then as the FF's come true, snapshot the time. One microsecond accuracy is just fine.

We recently shifted from the PIC to the Photon. Although some flavors of PIC have a sufficient number of "input capture registers" (which provide time resolution of 25ns!) the PIC is not really a hobby computer compared to Photon or Arduino. Plus the PIC software is not ready for prime time. Hardware is great though!

The software may not be quite as trivial as you would expect. Finding the hyperbola crossing point is a fun problem. Another issue is that the time between the bullet creating a hole and the mike recognizing that event is NOT the distance divided by speed of sound. Read up on "shock cones". What I just said is not true if you are capturing the times based on sound traveling through the target material itself rather than the air. But I am betting you are going through the air.

Maybe I can help you or we can help each other? We are at rev 2 of a PC board and about 50,000 lines of code.
--jim

ghans
Posts: 7893
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Need High Accuracy Electronic Target using triangulation

Mon May 02, 2016 6:32 pm

jim_hahn wrote:We are at rev 2 of a PC board and about 50,000 lines of code.
:shock: Amazing ... you find the most unexpected help in those forums. :ugeek:

Which language , by the way ?


ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

GerryG
Posts: 52
Joined: Fri Jan 22, 2016 5:06 am

Re: Need High Accuracy Electronic Target using triangulation

Mon May 02, 2016 6:35 pm

ghans wrote:I don't see how this computer vision approach is more feasible
than the audio DSP thingy ...


ghans
I guess it depends on your skill levels but this is strait-forward raster (matrix) math. I thinks all the functions are available in Python via Numpy. Take a picture of the target, shoot, take a picture of the target, convert the pictures to Numpy arrays, subtract the first picture from the second picture, search the array for values not equal to zero and get those positions.

Heater
Posts: 19429
Joined: Tue Jul 17, 2012 3:02 pm

Re: Need High Accuracy Electronic Target using triangulation

Mon May 02, 2016 7:38 pm

Certainly pointing a camera at a target and getting it to detect holes is a lot simpler hardware wise than fixing up microphones and amplifiers and whatever that requires.
Slava Ukrayini.

jim_hahn
Posts: 3
Joined: Mon May 02, 2016 5:02 pm

Re: Need High Accuracy Electronic Target using triangulation

Mon May 02, 2016 8:49 pm

Let me answer a couple posts at once.

The 50K lines of code are mostly Java, which amounts to C, developed inside Eclipse. The Photon is pure C. We do use matrix math when calibrating.

There is an optical based product on the market which detects holes based on the previous image frame compared to this frame. I talked to them a couple years ago and they did not seem to see its use in high power rifle. I believe it does use DSP processing.

A rifle match typically has 3 shooters per target and you fire maybe 70 shots each. So at the end of the match, you have 200 shots on target. The center several inches diameter will have the bulk of those shots and it is not possible to tell where a new shot went because it's likely to have gone through a previous hole or, worse, through a ragged one inch square that's been totally blown away by so many holes.

This does not happen in a match today, without electronic targets, because there is a guy down range who puts a tiny patch over the previous bullet hole before he "marks" the current shot. Each incoming bullet hits a "clean" target with no holes. If the guy sees things are getting ragged, he pastes an entire new target face on or can even change out the entire target.

There are several eTarget systems for sale today. Silver Mountain's system is really taking off. In Phoenix, where I am right now, a half dozen people have purchased them. There are also systems from Australia and Europe which are excellent.

User avatar
Burngate
Posts: 6553
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore

Re: Need High Accuracy Electronic Target using triangulation

Tue May 03, 2016 9:28 am

I knew nothing about shooting before this thread started, but now know almost nothing.
Do I gather that the original query was to do with air-pistols? If so, how fast are the pellets moving when they hit the target?
And am I right in thinking that rifle bullets move rather faster, and if so, how fast?

jim_hahn
Posts: 3
Joined: Mon May 02, 2016 5:02 pm

Re: Need High Accuracy Electronic Target using triangulation

Tue May 03, 2016 1:46 pm

I may have misread the original post too. If it's airgun pellets slower that the speed of sound (c), my solution won't work. The acoustic "through air sensors" I use and the commercial systems use require supersonic bullets which produce a cone shaped shock wave. sine(theta) = c/v.

Airguns run at about 900 fps (feet per second). Speed sound in air is about 1100 fps.

My 155 grain Palma bullet has a muzzle velocity about 3000 fps. When it gets to target at 1000 yards, v = about 1300 fps.

If it is airgun pellets, then the basic math of looking at two crossing arms of a hyperbola (the Time Delay of Arrival method) still applies. I think here you are shooting at, say, a cardboard target and you'd use the speed of sound THROUGH that cardboard. (What's the speed of sound through cardboard?) I would be interested what kind of sensors you'd use at the edges of the cardboard. Of course, this is getting pretty far afield from a valid Raspberry Pi forum question!
--jim

KiwiPie
Posts: 1
Joined: Wed Aug 10, 2016 12:39 am

Re: Need High Accuracy Electronic Target using triangulation

Wed Aug 10, 2016 12:55 am

Hi Byte Me.

Have you made any progress with your project? My son and I are looking to build the exact same system to use for home training using either a RPi or Arduino Duo, Mega etc.

The camera idea with a picture suggested by another poster was a good idea and we look at that as well.

Regards
Mike

abhinav89
Posts: 1
Joined: Thu Nov 16, 2017 6:54 am

Re: Need High Accuracy Electronic Target using triangulation

Thu Nov 16, 2017 6:56 am

@Byte Me. Can you give me an update on the project? Have you completed? Have you encountered any roadblocks. Thank you.

User avatar
DougieLawson
Posts: 42480
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Need High Accuracy Electronic Target using triangulation

Thu Nov 16, 2017 12:24 pm

Don't hold your breath waiting for a response. Byte Me hasn't visited the forum since Sun 01 May 2016 @ 17:09.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

hippy
Posts: 13816
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Need High Accuracy Electronic Target using triangulation

Thu Nov 16, 2017 12:51 pm

abhinav89 wrote:
Thu Nov 16, 2017 6:56 am
@Byte Me. Can you give me an update on the project? Have you completed? Have you encountered any roadblocks. Thank you.
Like many others who have sought sound triangulation solutions for shooting targets I would imagine this project has stalled and gone nowhere due to it being a lot more complicated than it might at first seem.

I don't think there's been a single thread I have read anywhere which has progressed further than discussing whether or how it could be done.

Return to “General discussion”