Posts | Comments

Planet Arduino

Archive for the ‘echolocation’ Category

Ultrasonic sensors are great tools for measuring linear distance or object presence. As shown in this experiment by “lingib,” two sensors can also be combined to determine not just linear distance to a sensor, but its position in an X/Y plane.

For his experiment, he hooked two of these units up to an Arduino Uno at a known distance from each other, with one emitter blanked out with masking tape. The non-blanked emitter pulses an ultrasonic signal, which is bounced back to it as well as the second sensor by the measured object. From the time it takes to receive the return signal, distance to each sensor can be inferred, giving a triangle with each side known. Trigonometry is then used to pinpoint the item’s position, and a Processing sketch displays coordinates on lingib’s computer.

This Instructable explains how to pinpoint the location of an object using an Arduino, two ultrasonic sensors, and Heron’s formula for triangles. There are no moving parts.

Heron’s formula allows you to calculate the area of any triangle for which all sides are known. Once you know the area of a triangle, you are then able to calculate the position of a single object (relative to a known baseline) using trigonometry and Pythagoras.

The accuracy is excellent. Large detection areas are possible using commonly available HC-SR04, or HY-SRF05, ultrasonic sensors.

Construction is simple … all you require is a sharp knife, two drills, a soldering iron, and a wood saw.

Infrared certainly has its uses, but if you’re trying to locate objects, ultrasonic detection is far superior. It’s contact-less, undetectable to the human ear, and it isn’t affected by smoke, dust, ambient light, or Silly String.

If you have one ultrasonic sensor and a microcontroller, you can detect plenty of useful things, like the water level in a rain barrel or the distance traveled by a tablet along a rail. If you have two sensors and a microcontroller, you can pinpoint any object within a defined range using trigonometry.

[lingib]’s dual sensor echo locator uses two HY-SRF05s, but the cheap and plentiful HC-SR04s will work, too. Both sensors are arranged for maximum beam overlap and wired up to an Arduino Uno. One sensor’s emitter is blocked with masking tape, so all it does is listen.

When the system registers the object, it shows up as a red dot on a grid inside a Processing sketch along with a bunch of details like the object’s coordinates, its distance from each sensor, and the area of the triangle formed by the two sensors and the object. [lingib] reports that the system is quite accurate and will work for much larger playgrounds than the 1 meter square in the demo after the break.

Don’t want to detect objects? Ultrasonic sensors are cheap enough to hack into other things, like this one-way data communications module.

Thanks for the tip, [Setvir].

echolocating-gunshots

[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.


Filed under: Arduino Hacks, digital audio hacks


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook