Shop OBEX P1 Docs P2 Docs Learn Events
Parallax ping sensor — Parallax Forums

Parallax ping sensor

SMA_XSMA_X Posts: 2
edited 2013-09-03 11:03 in Accessories
Hi all...
I am very much new to the field and I have a question on parallax ping ultrasonic sensor.
Hope you guyz can help me out...!

So my question is can I use the receiver and transmitter of the sensor separately?
I mean in our scenario we will be using multiple ping sensors and can I uniquely identify the signal transmitted from one ping sensor by a receiver of another ping sensor?
So what i want is using the transmitter and receiver of one ping sensor independent of each other?

pls be kind enough to leave an answer...

thanks in advance...!

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-02 15:40
    1) No - You cannot use the receiver and transmitter separately. The PING does one thing ... transmits a short burst of ultrasound when triggered ... indicates (with the trailing edge of a pulse) when an echo is received.

    2) No - There's nothing unique about each PING's ultrasound burst

    3) If you want multiple PINGs, you need to separate them in time. The maximum echo time is about 18.5ms and you really need to allow for more than that. Specifically, you need to allow time for room echos to die off before you create another pulse. How long you wait depends on the size of the space involved. I'd allow at least 2 to 3 times the time for sound to traverse the space.
  • SMA_XSMA_X Posts: 2
    edited 2010-03-02 17:07
    Thanks Sir.. your answer solved lot of doubts.. thank u very much smile.gif
  • @JeffBetts@JeffBetts Posts: 1
    edited 2010-03-10 04:13
    I've connected my PING sensor as instructed, and when I run PingMeasureCmAndIn.bs2 or any other first level bs2 PING script, all I get is "339 cm" and "133 in" in Debug Terminal. It's consistent with various scripts. I've double checked the wiring. I've got a BS2 revJ chip in a BOEbot. I don't have PING bracket and servo, so it's just wired into project board as shown in pdf instructions. Any ideas what could be wrong or how to troubleshoot to determine?
  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-10 04:38
    Double check your wiring again and the program you're using. If you still can't get it to work, put a call in to Parallax Tech Support tomorrow. This may well be something that can't be debugged via a forum.
  • raizo88raizo88 Posts: 2
    edited 2010-03-22 14:58
    DO
    PULSOUT 0, 5
    PULSIN 0, 1, time
    cmDistance = cmConstant ** time 'right
    PAUSE 100

    PULSOUT 1, 5
    PULSIN 1, 1, time
    cmDistance1 = cmConstant ** time 'left
    PAUSE 100

    IF (cmDistance1 <= 20) THEN TurnRight
    IF(cmDistance <= 20) THEN TurnLeft


    DEBUG HOME, DEC3 cmDistance1, " cm"
    DEBUG CR, DEC3 cmDistance, " cm"

    GOSUB walkfwd 'go to walkfwd subroutine

    LOOP

    this is a program using ping))) ultrasonic sensor to measure diatance using 2 sensor.
    from my program here only port 0 will gave reading?
    port 1 dont have output.what is my problem?
  • kf4ixmkf4ixm Posts: 529
    edited 2010-03-22 15:07
    DO
    PULSOUT 0, 5
    PULSIN 0, 1, time
    cmDistance = cmConstant ** time 'right
    PAUSE 100

    PULSOUT 1, 5
    PULSIN 1, 1, time 'change to pulsin 1, 1, time1
    cmDistance1 = cmConstant ** time 'left change to cmDistance1 = cmConstant ** time1
    PAUSE 100

    IF (cmDistance1 <= 20) THEN TurnRight
    IF(cmDistance <= 20) THEN TurnLeft


    DEBUG HOME, DEC3 cmDistance1, " cm"
    DEBUG CR, DEC3 cmDistance, " cm"

    GOSUB walkfwd 'go to walkfwd subroutine

    LOOP

    be sure to declare time1 in your var's.
  • raizo88raizo88 Posts: 2
    edited 2010-03-22 15:19
    tq very2 much..it solve everything..
  • rohitbr1rohitbr1 Posts: 3
    edited 2010-03-27 17:39
    I am new to these things. I & my friends want to prepare a robot for some competition for which we want to use sonar sensors that can measure the distance and the width of the object.

    So please guide me in this.

    Got little idea for finding distance but i have NO idea for finding the width of the object using SONAR!!!!
  • ZZZAAACCCZZZAAACCC Posts: 1
    edited 2012-02-26 19:33
    Hi all,

    I'm using ArduinoMega and I'm having some problems with multiples ultrasonic ping sensors. When I connect only 1 Ultrasonic sensor, it works perfectly, but when I connect more than 2 , I got 0 values for the second sensors and so on. Can anybody help me? Here is my code for Arduino.





    const int pingPin[2] = {8,10};


    void setup() {
    Serial.begin(9600);
    }
    void loop() {


    for(int i =0; i<sizeof(pingPin)/sizeof(pingPin[0]); i++) {
    int cm = ping(pingPin) ;
    Serial.print(i); Serial.print(":"); Serial.print(cm); Serial.print(" ");
    }


    Serial.println();
    delay(100 ); // each centimeter adds 10 milliseconds delay digitalWrite(ledPin, LOW);

    }


    int ping(int pingPin) {
    long duration, cm;


    pinMode(pingPin, OUTPUT);
    digitalWrite(pingPin, LOW);
    delayMicroseconds(2);
    digitalWrite(pingPin, HIGH);
    delayMicroseconds(5);
    digitalWrite(pingPin, LOW);


    pinMode(pingPin, INPUT);
    duration = pulseIn(pingPin, HIGH);
    cm = microsecondsToCentimeters(duration);
    return cm ;
    }


    long microsecondsToCentimeters(long microseconds) {
    return microseconds / 29 / 2;
    }
  • SRLMSRLM Posts: 5,045
    edited 2012-02-26 19:50
    Hi ZZZ*,

    I'd try renaming the pingPin variable in your ping function. Even though scoping says that it shouldn't use the global variable of the same name it's much less confusing just to give it a unique name. Note also that you are converting a long from the ping function call in your loop to an int.

    Your issue is probably due to the second Ping hearing the echo from the first ping, and returning immediately. Try adding a 100ms delay to your loop. If it fixes the problem you can decrease the value until you find a minimum.
  • UrsaUrsa Posts: 1
    edited 2012-03-10 12:56
    Hi I have a question regarding the Ultra sonic distance sensor. At first I thought this project would be pretty easy but it is proving to be much more involved than I anticipated. I am new to sensors and micro controllers. So what I want to do for my project is use a sensor to activate some (3) 3v vibrator motors. The objects (with motors inside them) will sit on a pedestal, when people approach the objects I want the motors to be activated. I hope this makes sense. If anyone has suggestions on how to make that happen I would greatly appreciate your feedback. thanks
  • stuartXstuartX Posts: 88
    edited 2012-03-13 08:53
    Ursa,
    I'm not a genius at this, but I have done something similar to this. I used my Ping sensors to trigger a larger load like a 12v fan and lighter load like LEDs.
    With the larger load I used a mosfet (Parallax's mosfet works great triggered from the logic of a Stamp with a resistor); the LED I used a resistor to the pin of the Stamp.
    With the sensor I targeted a range/distance that I wanted it to activate or turn a high to turn on the device.
  • xanaduxanadu Posts: 3,347
    edited 2012-03-13 16:50
    Ursa wrote: »
    Hi I have a question regarding the Ultra sonic distance sensor. At first I thought this project would be pretty easy but it is proving to be much more involved than I anticipated. I am new to sensors and micro controllers. So what I want to do for my project is use a sensor to activate some (3) 3v vibrator motors. The objects (with motors inside them) will sit on a pedestal, when people approach the objects I want the motors to be activated. I hope this makes sense. If anyone has suggestions on how to make that happen I would greatly appreciate your feedback. thanks

    There are many ways to do that, you should start a new thread about it.
  • jtbrownleejtbrownlee Posts: 9
    edited 2013-09-03 11:03
    If you used multiple pings(all aimed in different directions) a the same time wouldn't one always give you the closest reading and the rest would have the possibility of interference? If so you could trust that sensor for detecting an object and watch it move from one sensor to another as the robot rotated.
Sign In or Register to comment.