Go Down

Topic: [Resolved] DYP-ME007Y and NewPing v1.5 library (Read 2672 times) previous topic - next topic

berr08

May 21, 2014, 10:11 pm Last Edit: May 22, 2014, 06:51 pm by berr08 Reason: 1
Hello all,

I'm trying to work with an ultra sonic sensor #DYP-ME007Y (http://www.amazon.com/Generic-DYP-ME007Y-Ultrasonic-Sensor-Module/dp/B00CXKKO6U).  I have tried to use the NewPing Library (https://code.google.com/p/arduino-new-ping/) but the results are plain wrong and very sporadic.  Any help would be great, not sure what the issue could be.

Board: Arduino Ethernet Rev 3 - http://arduino.cc/en/Main/ArduinoBoardEthernet





BoardSensor
GroundGround
5V5V
Pin ~6Trigger
Pin ~5Echo


My Code is below based on the example the library provides:
Code: [Select]
#include <NewPing.h>

#define TRIGGER_PIN  6  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     5  // 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.

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

void loop() {
 delay(1000);                    
 Serial.print("Ping: ");
 Serial.print(sonar.ping_cm());
 Serial.println("cm");
}



The Output is below, the 0 is when I put something about 1 foot from the sensor, the code is very straight forward, not sure what the issue could be:
Code: [Select]

Ping: 264cm
Ping: 0cm
Ping: 0cm
Ping: 0cm
Ping: 263cm


Thank You!

berr08

To update this, I switched the ports around in hopes that that would help as I noticed with the newPing library it used 1 PWN pin and one regular digital pin.  But to no avail, readings still make no sense and jump around a lot.

Here is the picture I am referring to from the NewPing Library google page:

berr08

Finally got this working with the original code.   Ends up the external sensor plug on my sensor wasn't the 'straightest' so it wasn't making good contact, i had to play with that connection a bit.

eforman

were you using the waterproof version? e..g http://amzn.com/B00CXKKO6U with extension cable or http://amzn.com/B00BJTRGQW without.

if so, what is its effective FOV?

berr08


were you using the waterproof version? e..g http://amzn.com/B00CXKKO6U with extension cable or http://amzn.com/B00BJTRGQW without.

if so, what is its effective FOV?


With Extension, that is what was fouling me up, the sensor plug though plugged in wasn't making good contact.  It was 'effective' from my short testing period in the 30 - 120 cm range.  It did seem to be a little sporadic as far as having a few reading jumps, that I didn't get with the ping))) sensor, but that might have been the connector as well.  I ended up scrapping as the lower threshold didn't meet our needs.  I'm currently trying to swap the sensors to waterproof versions on the ping sensor with no luck yet but my fingers are crossed.

Robert.

Robert.

Go Up