DYP-ME007Y - Ultrasonic distance sensor - How to disable automatic trigger

Hy guys,

I am using the DYP-ME007Y waterproof ultrasonic distance sensor (this version) . It is working fine, but I have a problem. I need to use two sensors close to each other. In order to avoid they are going to interfere with each other, I need to assure that each of them is going to send the ultrasonic pulse (trigger) at distinct times.

However, this sensor model send several pulses per second automatically. In addition, if I do not wire the trigger pin, the sensor keeps working (I do not know why it has a trigger pin).

Below follows the code I use to read the distance from sensor:

#include <SoftwareSerial.h>

SoftwareSerial distance_sensor1(5,6); //(echo, trigger)

void setup() {
  distance_sensor1.begin (9600);
  Serial.begin (9600);   

void loop(){

int ping_sensor1() {
  byte read_buffer[4] = {0,0,0,0};

  byte readByte;
  byte checksum;
  int distance;
  bool ischecksumok = false;

  do {
    if (distance_sensor1.available() >= 1) {
        readByte = distance_sensor1.read();
        for (byte i = 0; i <= 2; i++) {
          read_buffer[i] = read_buffer[i + 1];

        read_buffer[3] = readByte;


    if (read_buffer[0] == 0xff) {
      checksum = read_buffer[0] + read_buffer[1] + read_buffer[2];

      if(checksum == read_buffer[3])
        ischecksumok = true;
  } while(!ischecksumok);
  distance = (read_buffer[1] * 256) + read_buffer[2];
  distance = distance /10; //converting to cm
  if(distance < 0 || distance > 250)
    distance = 0;

  return distance;  

Do you guys have an idea about how to control when the pulse is sent? (disable automatic trigger)


(sorry for resurrecting an old post, but there still seems to be much confusion over the versions of the DYP-ME007Y)


The version you have is the serial one, not the PWM one. With the serial version, as long as it is powered up it will continue to take measurements.

You could control the power to turn it off, but I suspect that the PWM version where you control the triggering would be your best solution. Incidentally, your pins are GND, TX, RX, 5V even though it likely also says 'trig' and 'echo'.

I made a post here about identifying which DYP-ME007Y is which since they seem to have the same part number.