Ultrasonic Range Sensor SKU 2760342

Find Your Way with the Ultrasonic Range Sensor

This is post 3 of 3 in the Neat Stuff series

This RadioShack Ultrasonic Range Sensor (SKU 2760342) seemed like a pretty simple device. I mean, it measures distance, but what can you really do with that?

As it turns out, you can do a lot with this sensor.

Ultrasonic Range Sensor SKU 2760342

RadioShack Ultrasonic Range Sensor

When connected to your Arduino board or other microprocessor board, the Ultrasonic Range Sensor sends and receives 40 kHz pulses to determine the distance between the sensor and objects in its path. So, for example, you could simply watch the distance readouts on the Serial Monitor in the Arduino environment. Or you could incorporate the Ultrasonic Range Sensor into a larger, more complex security or robotics project that includes triggered lights or movement. You could also add some other RadioShack DIY products, such as the Camera Board or 16×2 LCD Shield, and submit your project to The RadioShack DIY Project Center.

The sample program (.ino file) in these support files will help you get started with the Ultrasonic Range Sensor.

RadioShack Ultrasonic Range Sensor Support Files

What kind of projects would YOU create with the Ultrasonic Range Sensor?

This is post 3 of 3 in the Neat Stuff series


Your email address will not be published. Required fields are marked.


  • James

    Just purchased on not that long ago from a local radio shack and after hooking all 3 pins up in the breadboard and Arduino then uploading the sketch I get 0 inches and 0 cm only, it show no other distances regardless of where I position the sensor in my workshop. Any advice???

    • Dan

      Hi, James. I just hooked up the ultrasonic sensor to an Arduino Uno board, downloaded the program, and ran it. The output was as described in the documentation. I started to play around to see if I could get the behavior you mentioned was to either disconnect the signal wire, or put it into a different digital slot (versus 7).
      I posted a short post with photos showing how I set up the sensor. I hope it helps.

    • Larry

      James, I condensed the program to a single loop with about 10 statements and got the outputs
      that you described. Then I realized that I had only set the pinMode to OUTPUT in the “Setup”
      section. So, I actually did get ONE correct reading before it gave me all ZERO’S. After copying
      the pinMode to OUTPUT statement into the main loop, it worked GREAT! Good luck.


  • Hollywood

    I have tried several options with floating integers and such but can’t get it to read anything but whole inches. Im looking for .001 if possible

    • Bogwombler

      I just got the sensor and saw your comment after I downloaded the sample sketch so I don’t know if you have solved your problem yet. However, I have been doing frequency and time event measurements with the Uno and here’s how I dealt with the accuracy problem. All the int and long declarations have to be changed to float. Btw, you can’t mix float (double) with int or long since the compiler will default to int and long when assigning memory space to variables. Also the line that contains
      Serial.print(RangeInInches);//0~157 inches
      needs to be changed to
      Serial.print(RangeInInches,2);//0.00~157.00 inches
      The number after the comma specifies the number of decimal places, two in this example. Be advised that the sensor gets inaccurate at close proximities. You might need to change the timing of the sonar ping to accommodate increased accuracy. I have tested these changes and they work up to about an inch in front of the sensor. One caveat – going to floating point calculations eats up an extra 1.5 to 2 kBytes of memory so I would recommend doing away with the metric portion of the sketch if all you care about is inches.