DEVANTECH SRF04 SONAR RANGER Preliminary Report by Daniel Bartolini

Sonar, in general, is a fascinating system that takes place in nature on a regular basis. Shout across a room and listen for the echo. Your voice moves away from you at the speed of sound. It moves back to you then at the speed of sound. It doesn’t come back right away, however because it has to travel its said distance one way and then another. Do a little math (sound travels at 340.29 meters/second at sea level) and you can figure out how far away something is from you based on how quickly the sound returns.

This is where sonar is used- to measure distance and location based on return time of sound from an emitter. My favorite example of this in nature is the way bats operate when navigating and hunting. They use a process called “echolocation” to determine their distance to an object, including tiny little bugs they like to eat. Bats emit their voices, normally, at an ultrasonic range, so most of the time, we never hear them in their process of navigation and hunting. All of this information is highjacked from here.

One of my favorite uses of Sonar technology comes from the marine world, and I don’t really mean the trillion dollar submarine development branch of the Navy and federal government, but something way more mundane: fish finders. Nothing better than sitting in a boat all day, out on a nice calm lake, trolling slowly along with the movement of schools of fish that you can “see” underneath the boat. Okay, there are many things better than that, but I still like the technology of the fishing world. For example, Humminbird makes some wonderful gear for tracking fish and navigating various aquatic terrain.

Devantech SRF-04

The SRF-04 Sonar Ranger is a fairly low cost method of working with Sonar for the purposes of range detection. This particular interface works well for proximity (Z-axis), but it does not provide any feedback in terms of positioning on an X or Y axis.

This particular module is very popular for use in smaller robotics manufacturing and engineering. When you hunt down information about the unit, it is often tied to both home and academic research products that use the sensors as navigation tools for their robots. An example fitting of ITP’s often humorous approach to robotics.

A good question to ask would be: Why use this type of ranger when here are other methods, many of them cheaper? Take, for example, the Sharp range of IR sensors. They are a little less bulky, and, come on, the concept of working with IR just sounds sexier. But there are two main reasons why the sonar sensors are a good solution to navigational needs, over the IR sensors: 1) They can detect further distances 2) IR and light tracking and sensing can be a giant pain. You take an IR sensor outdoors into the natural sunlight which puts off an immense amount of natural IR light, and your robot is, in effect, blind.

Sonar rangers do have their own quirks, which I will get to, but outdoor projects may be easier to negotiate with sonar. Reference the Bugbot link above for examples of multiple arrays of sensors used in conjunction.

Electrical Characteristics

Unfortunately, I was not able to find a specific data sheet for this product. Googling Devantech leads you here. However, on both the Acroname and Parallax sites, you can find very handy data-sheet-esque reports that have code examples (mostly for the Basic Stamp and BX). Download the PDF here. Also, when you purchase a unit from Acroname, they send you a small booklet which is a nicely condensed version of the Parallax data-report. The reports outline the following behaviors for this unit:

  • It operates on +5v and uses between 30 and 50 mA (30 is typical)
  • Emits at a frequency of 40khz (way beyond anything we can hear)
  • The MAX range for detection is 3 meters (roughly 8.5 feet)
  • The MIN range for detection is 3 centimeters (a little more than an inch)
  • According to lab testing, the sonar can detect the top of a broom handle, which is 3cm in diameter, from a distance greater than 2 meters (almost 6 feet). Testing this theory is a bit tricky, and as my tests later showed, that kind of accuracy is irrelevant due to other concerns.

How Does This Thing Work?

I hooked this sensor up to a Microchip Pic 18F252.

HOW IT INTERFACES

  • The INIT and ECHO pins go to any digital I/O pin on the Pic.
  • You pulse the INIT pin for a minimum of 10uS, at 5V (TTL Level). This is the trigger for the sensor to send the 40khz tone.
  • You ask the Pic to listen on the ECHO pin for 10mS for that tone coming back to the sensor. Using PicBasicPro, the PULSIN command allows you read the voltage coming back to the Pic.
  • If we take that time and divide it by the constant of the Speed of Sound, we can determine distance. On the Pic with a 4mhz clock, you use 14. As Tom Igoe notes in his book Physical Computing, due to the differences in timing between the PULSOUT and PULSIN commands, this value differs from one microcontroller to the next. The BX, for example, uses 74 as its constant. That is included in the data report found on the Acroname page.

When I hooked up a multimeter to the ECHO pin, the voltage coming back ranged from .65V to 3.5V consistently, giving some idea as to the range the PULSIN command translates.

This is the code I used to test this with a 4mhz clock. It is taken directly from Physical Computing.

The end result of testing, with the sensor pointed at a roughly 15 foot ceiling, and using my hand as a movable target, was a seemingly maximum distance of 61 inches, and a minimum distance of 3 inches. As we can see, not quite what the guides give us as the parameters for the sensor.

Problems

When I tilted the sensor angle, so the emitters were parallel with the table, and pointed it into space where I knew any items were out of range, I figured I would get roughly the same results as before. This was not the case. I kept getting readings of things being as close as a foot away, even though there were no items in front of the sensor.

When I went back to the Acroname page to see if there are any circuits for calibrating these devices, I came across a link to this page.

The user here describes the problem inherent to the ranger. In the data provided with the sensor, Acroname lab tests show a roughly 45 degree angle of dispersion for the frequency. But that means it goes out in a 360 degree cone, not just on the X-axis. Subsequently, the floor of the work area became a “target.” The user here found that the best height for eliminating this distortion was at 5 feet. He describes this on a SRF10 ranger. The 04 has a shorter range, so the height would be a bit lower, but you still have to consider the floor a factor in measurement. He also discusses a solution for creating a narrower cone, eliminating distortion from object “way off boresight” (the angle where the sonar is aimed...straight ahead).

Additional Report by YiSeul Park

How Ultrasonic Sensor works?

Ultrasonic sensor detects where the user is standing or moving, since it knows the distance between it and the target person. This sensor sends out ultrasonic pulse and measures the time it takes to hear pulse echo. The shorter it takes for the echo to respond, the nearer the target is.

What is Ultrasound?

Ultrasound is sound with a frequency greater than the upper limit of human hearing, approximately 20 kilohertz/20,000 hertz. Some animals, such as dogs, dolphins, bats, and mice have an upper limit that is greater than that of the human ear and thus can hear ultrasound.

How do I connect the sensor to the circuit?

The sensor needs four connections to operate. First are the power and ground lines. The sensor requires a 5V power supply. The other two wires are the signal wires.

How did the operation go?

It went well. I got pretty accurate data from serial output. I built the circuit with the PIC 18F452 microchip to send out distance range from the sensor to the target object by inches continually.