Help interfacing with this ultrasonic sensor - DYP-ME007Y

I’m having issues interfacing with this ultrasonic sensor I picked up. It’s a DYP-ME007Y-PWM and I’ve attached the manual that was sent to me.

I searched and tried every ultrasonic sensor approach that came up, but I haven’t found anything that gives a result - always 0cm or out of range. It’s connected to an Uno and powered with 5v.

Notably, I’ve tried NewPing with the example code. It says it works with DYP-ME007, but there’s no mention of the Y version (one transducer).

If anyone could take a look at the manual and give me some ideas on how to approach this I would really appreciate it.

Thanks!

14002214Manual.doc (400 KB)

It will help us if you have a schematics of how you hooked it up to your arduino, and maybe post the code you use here in code /code brackets. Do you have access to an oscilloscope ?

No oscilloscope unfortunately.

Sensor 5v ------- 5v Arduino
Trig ------- Pin 12
Echo ------ Ping 11
GND ------- GND

I’ve tried switching the code and connection to other pairs of pins as well.

// ---------------------------------------------------------------------------
// Example NewPing library sketch that does a ping about 20 times per second.
// ---------------------------------------------------------------------------

#include <NewPing.h>

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
}

void loop() {
  delay(50);                      // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");
}

I’ve also tried this code (LCD code replaced with serial):

/* This Arduino script uses the DYP-ME007 Ultrasound Range finder to
 * measure distance in cm and displays the distance on a DFRobot
 * I2C LCD Module 508040.
 * Hardware: Connect the DYP-ME007 to +5V and Ground, and
 * the dypOutputPin to the DYP_ME007 "Trig" pin and the 
 * the dypInputPin to the DYP-ME007 "Echo" pin. 
 * By default I2C chips use analog pin A4 for data SDA and A5 
 * for the clock SCL. Of course 5V and GND need to be connected too.
 * Credits to DFRobot and Bexilino on http://arduino.cc/forum/index.php?topic=60973.0
 * from which I have copied parts.
 */
 
#include <Wire.h> 

int dypOutputPin = 12; // TRIG 
int dypInputPin = 11;  // ECHO 
long distance;
long cm;

void setup(){
  pinMode(dypOutputPin, OUTPUT);
  pinMode(dypInputPin,INPUT);
  Serial.begin(9600);

}

void loop()
{
  // The DYP-ME007 pings on the low-high flank...
  digitalWrite(dypOutputPin, LOW);
  delayMicroseconds(2);
  digitalWrite(dypOutputPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(dypOutputPin, LOW);   
  // the distance is proportional to the time interval
  // between HIGH and LOW
  distance = pulseIn(dypInputPin, HIGH); 
  cm= distance/58;                        
  Serial.println("cm");
  delay(100);

}

I think your looking for this topic, http://arduino.cc/forum/index.php/topic,106043.msg795608.html

Try to change from this delayMicroseconds(2); to this delayMicroseconds(10);

in the second sketch.

As there's not much information on this sensor, you'll probably need a scope or a lot of trial and error to figure it out. As this is not a supported module, you can't use the NewPing library as it's not designed for this unique sensor with unknown characteristics.

Tim

Thank you astrofrostbyte, zoomx, teckel. I tried the delay mentioned without any luck. I believe the sensor may be faulty because it has an SMD LED on board that never lights. I ended up discussing it with the eBay seller I bought it from and got a refund.

I to have tried to get the DYP-ME007Y to work, the best I could get was 32cm. I plug in a HC-sr04 ultrasonic sensor into the same program (first code listed) and I was able to get as far as 200cm. My DYP-ME007Y is going in the junk box for parts only

RonH1212: I to have tried to get the DYP-ME007Y to work, the best I could get was 32cm. I plug in a HC-sr04 ultrasonic sensor into the same program (first code listed) and I was able to get as far as 200cm. My DYP-ME007Y is going in the junk box for parts only

Maybe send it to me? I can send it back too if you like. I actually like getting sensors that don't work well for others. It allows me to test to see if I can do something in the library to work around some differences between sensors.

Tim

Tim

What is you address and I will sent you the DYP-ME007Y, You can keep it. The only think, when you get the library working please let me know as I need a working waterproof ultrasonic sensor

Ron

RonH1212: Tim

What is you address and I will sent you the DYP-ME007Y, You can keep it. The only think, when you get the library working please let me know as I need a working waterproof ultrasonic sensor

Ron

Private message sent. If I can tweak things to get the sensor working I'll send it back.

Tim

Any update on this? I've got the exact same sensor, and can't get it to work properly

I used the DC 5V DYP-ME007Y Ultrasonic Sensor Module Measuring Range 30cm-3.5m, with the cable and remote head. From Ebay seller bosity.

I used the first code: Example NewPing library sketch that does a ping about 20 times per second.

Sensor 5v ------- 5v Arduino
Trig ------- Pin 12
Echo ------- Ping 11
GND ------- GND

I used a Rigol DS2202 Digital Oscilloscope

Channel 1 monitoring the Trigger, NEG. going pulse 5.o6us

Channel 2 monitoring the Echo, 210us after the trigger, POS. going pulse, variable in length. Based on the target.
see attachment

DYP-ME007Y Ultrasonic Sensor Module.txt (2.92 KB)

Hi,

I've the same sensor and the same problem. Did anyone book any progress with this sensor? Are there other libraries that could work?

tnx, M

The plan is to test this sensor in the near future. I've been really busy the last few weeks and haven't had a chance.

Tim

I have tested DYP-ME008 Ultrasonic display module 5 pin model with the ME007Y with the remote head.

With the DC 5V DYP-ME007Y - PWM Ultrasonic Sensor Module Measuring Range 30cm-3.5m with remote head and the ME008 display
1 GND
2 Blank <---------- Note:
3 Echo
4 Trig
5 VCC 5V DC from DYP-ME008 Ultrasonic display module

In following the posting I did on, Reply #12 on: September 18, 2013, 11:52:58 am »
See the Attachment for timing, the only thing that is different is the trigger.
The trigger is a positive going pulse, with only one pulse per reading, like in the web site

Google [DOC] Shen Zhen DianYing Pu Sensor CO.,LTD

See more attachments
Both units work good
I hope this helps someone

ME007Y.jpg

Hi,

I managed to get some life out of this sensor this morning (chuffed, because I’m just starting with this stuff!).
I receveid a document from the manufacturer (in attachment). Despite that I didn’t get it to work, until this morning. What did I change? Well I thought maybe I’ve destroyed the pins I was using with all my hapless trial and error, so I thought I would change the pins being used. Also, I found it to be confusing to have the trigger on a higher pin than the echo.
So when I looked at the Arduino to change the pins, I saw that some pins are marked ~ and on the corner of the arduino the following is “(PWM ~)” is etched. So I connected it to two ~ pins: 10 for Trigger & 11 for Echo. And suddenly it came alive!. This is my sketch

#include <SoftwareSerial.h>                                                                                                         

#include <NewPing.h>                                                                                                                            
#define TRIGGER_PIN  10  // Arduino pin tied to trigger pin on the ultrasonic sensor.                                                                   
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.                                                                           
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.                                    

//NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.                                                                           



SoftwareSerial mySerial =  SoftwareSerial(2,3);                                                                                                                                          


void setup() {                                                                                                                                                                              
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.                                                                                                               
  Serial.println("Hello, world?");                                                                                                                                                                   

  mySerial.begin(115200);
  mySerial.println("Hello, world?");
  
  pinMode(TRIGGER_PIN,OUTPUT);
  pinMode(ECHO_PIN,INPUT); 
}



void loop() {
  
  delay(1000);
  unsigned int uS = 0;

  digitalWrite(TRIGGER_PIN,LOW);
  delayMicroseconds(10);
  digitalWrite(TRIGGER_PIN,HIGH);
  delayMicroseconds(15);
  digitalWrite(TRIGGER_PIN,LOW);
  delayMicroseconds(200);
  //unsigned long started = millis();
  //delay(10);

  unsigned long i = 0;

  unsigned long countTriggerHigh = 0;
  unsigned long  countTriggerLow = 0;
  unsigned long  countEchoHigh = 0;
  unsigned long  countEchoLow = 0;
  
  int echoHigh = 0;
  int newEchoHigh = 0;
  
  unsigned long startMs = 0, stopMs = 0, deltaMs = 0, startUs = 0, stopUs = 0, deltaUs = 0;
  float mm = 0.0;
  
  
  while (i < 200000)
  {
    digitalRead(ECHO_PIN) == HIGH? newEchoHigh = 1 : newEchoHigh = 0;
    

    if (echoHigh != newEchoHigh){
      if (newEchoHigh == 1 ){
        Serial.println("Start");
        startMs = millis();
        startUs = micros();
      }
      
      if (newEchoHigh == 0 ){
        stopMs = millis();
        stopUs = micros();
        deltaMs = stopMs - startMs;
        deltaUs = stopUs - startUs;
        Serial.println("Stop");
        
        Serial.print("Milliseconds: ");
        Serial.println(deltaMs);
        Serial.print("Microseconds: ");
        Serial.println(deltaUs);
        mm = (float) deltaUs / 5.8;
        Serial.print("mm: ");
        Serial.println(mm);
      }

    }
    echoHigh = newEchoHigh;

    i++;
  } 

        Serial.println("Stopped"); 
}

And its output seems to be as described in the document. 35ms if there is nothing detected, and a distance which seems to be correct when something is held at a distance of the sensor.

If you manage to integrate this sensor into the NewPing library please update this thread.

siva2402: Hi,

I managed to get some life out of this sensor this morning (chuffed, because I'm just starting with this stuff!). I receveid a document from the manufacturer (in attachment). Despite that I didn't get it to work, until this morning. What did I change? Well I thought maybe I've destroyed the pins I was using with all my hapless trial and error, so I thought I would change the pins being used. Also, I found it to be confusing to have the trigger on a higher pin than the echo. So when I looked at the Arduino to change the pins, I saw that some pins are marked ~ and on the corner of the arduino the following is "(PWM ~)" is etched. So I connected it to two ~ pins: 10 for Trigger & 11 for Echo. And suddenly it came alive!. This is my sketch

And its output seems to be as described in the document. 35ms if there is nothing detected, and a distance which seems to be correct when something is held at a distance of the sensor.

If you manage to integrate this sensor into the NewPing library please update this thread.

As you're not doing anything with PWM, it seems the "fix" was not that you're using PWM pins, but the pins you were using before don't work or you had them connected wrong. What pins were you using before?

Tim

What does the PWM stand for, and what is it used for? Sorry for my ignorance, just interested to learn what's going on.

I used 12 and 11, as per one of the examples I found regarding your NewPing library. So since I'm using 10,11 now, I suppose this means 12 may be broken.

Marc

siva2402: What does the PWM stand for, and what is it used for? Sorry for my ignorance, just interested to learn what's going on.

I used 12 and 11, as per one of the examples I found regarding your NewPing library. So since I'm using 10,11 now, I suppose this means 12 may be broken.

Marc

PWM is pulse width modulation. These pins can be used to create a pulsed output at specific timing.

It's possible there's a problem with pin 12, or it could be that you had 11 and 12 switched, or a host of other possibilities. Best way to know is to switch just one of the pins that currently works with pin 12, then trying the other. It's possible it only works for output and not input for example.

Tim