How to Use Ultrasonic Distance Sensor Module

Photo of Ultrasonic Distance Sensor Module

This sensor uses ultrasonic waves to measure distance. It can also be used to create distance-dependent switches.

About the Component

This sensor measures distance using ultrasonic waves. It emits ultrasonic waves from the sensor and receives the waves reflected from the object. The ultrasonic sensor measures the distance to the object by measuring the 'time' from emission to reception. The measured distance is output in millimeters (mm). If the distance cannot be measured (out of range), '-1' is output.
Illustration of the sensor position on the Ultrasonic Distance Sensor Module

Specifications

Voltage5V
Measurement Range4~300cm
Temperature Range-10~60℃
Measurement AngleLess than 15°
Trigger Signal10μS (TTL level pulse wave)
Echo Output SignalReflection (round trip) time
Size 34 x 20 (mm)

Connection

Connect the Ultrasonic Distance Sensor Module to the SPACEBLOCK microcontroller board using jumper wires (male-female) as follows:

  • Connect the TRIG pin of the ultrasonic distance sensor to the digital-compatible pin of SPACEBLOCK
  • Connect the Echo pin of the ultrasonic distance sensor to the digital-compatible pin of SPACEBLOCK
  • Connect the GND pin of the ultrasonic distance sensor to the GND pin of SPACEBLOCK
Connection method between SPACEBLOCK microcontroller board and Ultrasonic Distance Sensor Module

※The image shows the signal line connected to pins A0 and A1. Digital-compatible pins are A0 to A10, A13, A15, B0 to B15, C14 to C1.

※5V and GND can also be inserted into the pins with the same notation on the SPACEBLOCK microcontroller board.

Usage

The sensor detects the distance between the sensor and the object and returns a value. The larger the distance, the larger the value.
You can retrieve values from the Ultrasonic Distance Sensor Module using blocks in the 'Input' category of the project.


For detailed usage of the blocks, click here

Retrieve Distance from Ultrasonic Distance Sensor