Ultrasonic Distance - Ultrasonic Collision Detection

How To Add This Control To Your Project

Step #1) Load the most recent release of EZ-Builder
Step #2) Press the Project tab from the top menu bar of EZ-Builder
Step #3) Press Add Control from the button ribbon bar of EZ-Builder
Step #4) Choose the Ultrasonic Distance category tab
Step #5) Press the Ultrasonic Collision Detection icon to add the control to your project


If an HC-SR04 or Ultrasonic Distance Sensor is connected to the EZ-B, this control will Stop a Movement Panel if an object is detected within the specified range. This does not steer or avoid obstacles; it merely stops when detected. For object avoidance and steering use the Radar control.

It's worth noting that the distance displayed is not a unit of CM or Inches. The distance value is an arbitrary number that is related to the type of sensor, voltage, detected material, and temperature. If a specific distance is required, use a tape measure to identify the distance value.

The EZ-Robot Ultrasonic Distance Sensor comes in 2 versions. The first version, sold until February 10, 2017 uses 4 wires and an inline voltage regulator. The second version, available after February 10, 2017 uses 3 wires with a built-in voltage regulator in the plastic shell. The second version is updated and requires only a single plug to the EZ-B v4. We cover the installation of both sensor versions below...

Version 2

This is the 3 wire version #2 (most recent) of the EZ-Robot Ultrasonic Distance Sensor. This version uses only 3 wires contained within a single connector. You may connect this version to any of the EZ-B v4 digital ports (D0-D23). In EZ-Builder, the values for both Ping and Echo can be selected for the same port.


Version 1

This is the 4 wire version (older) of the EZ-Robot Ultrasonic Distance Sensor. This version has an inline voltage regulator and 4 separate wires. This version is a little more complex than the recent Version 2, due to separate wires and the inline voltage regulator.

ultrasonic distance sensor pin out

  • Ground = Black wire from regulator PCB to D21 black pin
  • Power = Red wire from regulator PCB to D21 red pin
  • Trigger = white wire to D21 White pin
  • Echo = green wire to D22 White pin

Ultrasonic sensor connected to ez-b

Related Products

Ultrasonic Distance Sensor

Ultrasonic Distance Sensors use high frequency sound to determine the distance of an object directly in front. These are used to help your robot avoid...

Ultrasonic Distance Sensor

This distance/range sensor connects to the ez-bv4 with a single wire and includes a built-in power supply. The sensor uses ultrasonic sound to determine...

EZ-B v4/2 Developer Kit

Build your robot or IoT project from scratch. This kit includes the powerful ez-bv4/2 WiFi robot controller, vision camera, servos, battery holder,...

Related Articles: N/A