Echolocation Pinpoints Where A Gunshot Came From


[Kripthor] suspected that hunters were getting too near his house. When thinking of a way to quantify this belief he set out to build a triangulation system based on the sound of gunshots. The theory behind it is acoustic location, which is a specialized type echolocation.

The most common example of echolocation is in Bats, who emit ultrasonic noise and listen for its return (echo) to judge the location of objects. [Kripthor] doesn’t need to generate the sound himself, he just needs to pick it up at different points. The time difference from the three samples can be used to triangulate coordinates as seen in the image above.

He first tried using a PC sound card to collect the samples. The stereo input only provides two channels so he tinkered around with a 555-based multiplexing circuit to sample from three. The circuit noise created was just too great so he transitioned to using an Arduino. The ADC samples from each microphone via an NPN transistor which is used as a simple amplifier.

This brings to mind a homebrew sonar hack from way back.

50 thoughts on “Echolocation Pinpoints Where A Gunshot Came From

      1. Chicago has the toughest anti-gun laws and you can almost hear non stop gunfire. They were not false positives, they were all real gunshots… the Cops did not want to realize that they actually have a warzone on their hands.

          1. Yeah, because Chicago is an isolated island with border guards inspecting just about every vehicle and pedestrian coming onto “Chicago Island”… The Chicago argument is the most ridiculous argument anyone has ever made about gun control. From a responsable gun owner, you idiots with your failures of any logic what-so-ever are ruining it for the rest of us. Chicago’s gun laws don’t work because you can simply drive over to say, Indiana, which has very lax gun laws (I know I live there), load up and drive right back in, no check points, no border patrol, no bodies of water to cross without getting searched by the coast guard, nothing… And sure hundreds of thousands of tons of drugs are smuggled into the US every year, but drugs are a whole heck of a lot easier to hide than guns. But if you want to keister an AR, be my guest… buh buh but the bad guys will be the only ones with guns… You mean the guns they legally purchase or steal from legal gun owners?

        1. Imagine that! The states that allow their residents to own guns have lower gun related crime than the states WITH gun control. Put yourself in the bad guy’s shoes. Would you be willing to take the risk of trying to mug/rape a woman who may have a gun on her? There are many Sheriffs who have come out against the latest gun control, the rest are not willing to admit to the public that they have the problem.

          We aren’t stupid, we can see what’s happening.

  1. This isn’t echolocation, there is no echo involved. It is simple triangulation of the sound. This kind of error seems common on hackaday these days, why has basic terminology gone downhill?

      1. But you can be familiar enough with English to read at least part of an article before you post it.

        The first freaking line is “I always liked the general concept of signal triangulation” and the word “echo” is nowhere in the article.

        Mike has a bad habit of trying to “spice up” posts by adding things that are unrelated, and this is yet another example.

        Lastly, I would expect someone who tinkers in robotics/science/technology in general to at lease loosely understand what sonar or echolocation is. It’s not exactly a difficult concept.

    1. It’s not even triangulation, it’s multilateration. Triangulation requires knowing the direction of the sound in relation to each microphone. This system is based on time difference of arrival.

    2. Its actually Trilateration rather than triangulation. As inferred triangulation uses directional data (angles) to find a point in space, whereas trilateration uses temporal data to generate three (minimum for positional, more allows greater accuracy) overlapping circles.

  2. The US army have been experimenting with this. Small device which looks somewhat like a tank trap mounted near the back of a humvee, microphone on each tip, used to locate the direction of a snipers gunshot, rather effective.

    1. Yeah, I bet that’s a hell of a thing to have handy in urban combat. I can’t imagine taking fire, and being unable to tell which side of the nearest building I need to take cover behind due to echo.

      1. It’s good stuff. I know the various military forces that have it are quite enamoured with it. I’d love to see something similar open sourced and set up for whatever noise you wish to plugin.

        1. I’ve actually started on a board design for a project with related goals, but could easily be used for this kind of application. It’s designed to work with a PC for processing at this point, but honestly that could be handled by a Pi for something like this.

          1. Now that is very interesting, I was looking around on google just yesterday to see if there is anything similar to it. If it was made in such a way that the sound it is looking for is user selectable then you’d be on to a real winner there. Good stuff.

      2. The 7 microphones look to be positioned within a sphere, 4 in the top hemisphere and 3 in the bottom. Looking down on it you would see a hexagonal pattern with the 7th microphone at the center.

        So i would guess that they would carry out a FFT on the 7 data streams and look for straight line spikes/impules (all frequencies at once – that is the way I would think of the bang from a bullet). But I’m sure that some kind of bullet fingerprinting could be done as well (sub-sonic or supersonic at a minimum). The time of the 7 spikes would be know and the dimensions and the spacing of 7 microphones would also be known. The sound wave of the impulse/bang from an ideal gun in 3D space (ignore all reflections/refractions of buildings and ground) would propagate as a sphere. The first spike to arrive from a microphone in the FFT data would have the bullet direction narrowed down to 120 degrees ((360/6)x2 – it could arrive at 2 mics at once). After a bit of math the end result would be an vector as to where the gun was shot, and a not so accurate (depending on the processing power and the dimensions of the microphone array, larger being better) The only problem with this setup as I would see it, is that you could tell the origin of the sphere, where the shooter took their shot, but you would be unable to tell where the shot was aimed, they could be shooting towards or away from you.

        1. That is pretty much how it works, it hears the shot, you got an alert and then it spits out as close to accurate guess of distance and bearing as possible. Most soldiers use magnified optics on their rifles these days, so they use those to look. It’s a hell of a lot better than having no clue where the shots came from at all!

        2. Sorry just was reading this back and i realised that i left out one very important word “After a bit of math the end result would be an vector as to where the gun was shot, and a not so accurate ‘distance'” The sentence makes no sense, without it, but I’m sure the people reading it were able to work out the missing word.

    1. I think his house is in the upper left cluster of points, but that could just be a barn. Either way they shouldn’t be hunting on his property without his written permission, so it stands to reason he knows the hunters and could just ask them, or revoke permission if he thought they were lying.

      1. Yes, my house is in the upper left corner. The test points marked on the map are on my property but the hunters are obviously not…
        Indeed they were too close, ~20m from the fence. Legally they have to be at least 250m.
        I politely asked them to move a bit further with my megaphone. It all worked out fine. :)

          1. That could also be a fantastic way to cut down on poaching on endangered species, especially in Africa. I believe there’s already a project in existence to do automated drone patrolling, but if the drones were combined with an acoustic locator network, they could just “park” at several base stations and fly out to the location of the reported gunfire when detected.

  3. Alot of different cities and government agencies already do this. It doesnt actually rely on echoes, but on the delay in the receiving the sound. If you live in a semiurban area with crime issues, you could look on some telephone or light polls and you will see some boxes that are used for this exact purpose.

  4. I would like to see the guy make the sonar “nodes” for lack of a better phrase equipt with gps, and an SD card, so that they can simply log any loud noises along side the gps co-ordinate and time from the gps satelite, write a program to interpret this data and all you’ll need do is take the gps co-ordinate, time and sound level and it won’t matter where you put them and when it’ll still get an accurate lock.

  5. Although probably not from a BB gun most gunshots generate two noises. One is the sound from the gun itself when the bullet leaves the barrel. The other is the supersonic crack of bullet as the cone of the shock wave passes by. How does one distinguish the two sounds? Is only the former of use in locating the gun or can the latter be used also?

    1. That is true for supersonic bullets, but people still do use subsonic bullets (silencers do not work with supersonic bullets). and some hunters do use silencers.

      Timmy the bunny turns around to see his buddy Fluffy going to sleep in the middle of the day, and quickly goes to sleep himself.

      1. If you are hunting bunnies with a rifle that needs a silencer, then you are not eating them but actually blowing them up. 22LR in a “sniper load” or about 1/2 the powder is near silent (as silent as an air rifle) and is typically used for hunting rabbits. If I hit mister bunny with my 7.62 AR-10 with a 125gr load, mister bunny will be a puff of fur and pink mist against the tree while buddy bunny will die of a heart attack and also be red colored. Even a 9mm pistol will blow up a bunny so bad you will not have much to eat.

        Also a “silencer” is not what you see in movies. they do not “silence” the shot but reduce the sound pressure. Go to a shooting range and ask if you can hear what a shot sounds like with a silencer, you still need hearing protection as silencers only reduce a max of 43db of sound from a 110db-180db gunshot crack.

        1. Almost every rabbit in the country where I live have Myxomatosis, so no I would not personally be eating them. Clean shot though the head with a 0.22, skinned and gutted for cheap cat food and to help keep the overpopulation down. Still healthier for an animal to eat then tinned food. I’ve never seen their heads explode so far.

          1. @Eirinn I don’t have the option to reply to you so I@ll say it in a reply to me!
            That may very well be the case, just like some people have an issue eating insects, or eating periods of chickens or even drinking milk of cows. Even though scientifically I may be safe as houses eating a bunny with Myxomatosis,
            I just can not look at some of the images and then decide if you could eat them yourself –

            It has to be a primal response of the brain to stop us from being sick and sometimes it errs on the side of caution, i can not change evolution.

        2. Interesting tidbit: While “silencers” or sound suppressors are have a bit of a bad rep thanks to Hollywood and the restrictions associated with the Class 3 Tax Stamp, it is very different in Europe. Most indoor shooting ranges I have visited in Europe actually required a sound suppressor while shooting indoors. It was a very different mindset indeed.

  6. Instead of fighting with the limited arduino ADC, he could have used the $11 stm32f3discovery board with 4x 5Msps 12bit ADCs. In theory, power could be reduced by using DMA to collect samples while the processor is sleeping, then wake up periodically to see if analysis is needed. The ARM might have enough processing power to do the audio processing as well. This chip also has 4 programmable gain (up to 16x) op-amps, perhaps useful to amplify the audio input. Seems like it’s better to spread out the microphones further to get better resolution– either lots of wire or maybe solar powered micros with some sort of RF link activated when an event occurs.

    1. Problem with that is that with supersonic rounds by the time you hear the bang it’s too late. I know there are artillery (including missile artillery) systems that can identify incoming fire with radar and have return fire in the air before the first shots hit.

      1. Those radars have their limits, nothing I’m willing to discuss with strangers but they’re there. Boomerang and things like it are absolutely fine for their intended purpose and like all things they’re not perfect but it’s better than having nothing.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.