Seeedstudio Ultra Sonic range measurement module is a non-contact sonar type distance sensor.


  • sensing range: 3 cm to 4 m (1 cm resolution)
  • sensing angle: 30 degree
  • input voltage: 5 VDC
  • input current: 15 mA
  • ultrasonic frequency: 40 kHz
  • trigger pulse width: 10 μs
  • breadboard friendly
  • Arduino compatible
  • dual transducer

Code sample

#include "Arduino.h"
class Ultrasonic
      Ultrasonic(int pin);
      void DistanceMeasure(void);
      long microsecondsToCentimeters(void);
      long microsecondsToInches(void);
      int _pin;//pin number of Arduino that is connected with SIG pin of Ultrasonic Ranger.
      long duration;// the Pulse time received;
Ultrasonic::Ultrasonic(int pin)
{ _pin = pin; } /*Begin the detection and get the pulse back signal*/ void
   pinMode(_pin, OUTPUT);
   digitalWrite(_pin, LOW);
   digitalWrite(_pin, HIGH);
   duration = pulseIn(_pin,HIGH);
/*The measured distance from the range 0 to 400 Centimeters*/
long Ultrasonic::microsecondsToCentimeters(void)
   return duration/29/2;
/*The measured distance from the range 0 to 157 Inches*/
long Ultrasonic::microsecondsToInches(void)
   return duration/74/2;
Ultrasonic ultrasonic(7);
void setup()
void loop()
{Pololu 38kHz capteur de proximité IR, gain fixé, haute luminosité
   long RangeInInches;
   long RangeInCentimeters;
   ultrasonic.DistanceMeasure();// get the current signal time;
   RangeInInches = ultrasonic.microsecondsToInches();//convert the time to inches;
   RangeInCentimeters = ultrasonic.microsecondsToCentimeters();//convert the time to centimeters
   Serial.println("The distance to obstacles in front is: ");
   Serial.print(RangeInInches);//0~157 inches Serial.println(" inch");
   Serial.print(RangeInCentimeters); //0~400cm
   Serial.println(" cm");

Part List

  • 1x sensor
Dimensions L x W x H 43 mm x 20 mm x 15 mm
Weight 10 g

Write a question

Please login or register to review

Write a review

Please login or register to review

Seeed Ultrasonic Sensor

  • 13.73€ Euro 10.30€ Euro
  • EUR 188.85 Left For Free Shipping

Tags: ultrasonic sensor