QRD1114 IR Sensor''' Report by Guy Lee

Attach:QRD1114-IR.jpg Δ

I bought this infrared sensor from HVM Technologies Inc., $1.50 each. To view the datasheet 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.


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


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