Shop OBEX P1 Docs P2 Docs Learn Events
Assistance for Ping Sensor — Parallax Forums

Assistance for Ping Sensor

Keep walkingKeep walking Posts: 7
edited 2009-09-12 15:59 in General Discussion
Hello:

I am a beginner in this world of robotics and sensors, and I have the following problem, for wich I would appreciate your opinion and solution:

I've been experimenting with the Ping Sensor connected to the Homework Board, as indicated in the brief instructions of the sensor.
For some reason that I cannot understand, the sensor functions correctly until is 14 cms appart from the wall. For greater distances the sensor shows always 14 cms, wit no variation.

Any suggestions???

Thanks in advance.

Keep walking.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-20 02:44
    Can't tell anything from just your description except that this might happen if you declare one of the variables involved as a byte instead of a word. Could you post a copy of your program and the actual values seen. Also either post a diagram of your connections or a good description of it.
  • Keep walkingKeep walking Posts: 7
    edited 2008-02-20 03:07
    Mike:

    The code for the PING operation that I am using is (same as the instructions):

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    time VAR Word

    DO

    PULSOUT 15, 5
    PULSIN 15, 1, time
    DEBUG HOME, "time = ", DEC5 time
    time = time ** 2251
    DEBUG CR, "Distancia =", DEC4 time, " cm"
    PAUSE 100

    LOOP

    The wiring is also as the instructions.

    Regards
    Keep walking
  • dprbrts42dprbrts42 Posts: 2
    edited 2008-02-20 03:56
    I am experiencing the same/similar troubles with my Ping. I have duplicated the code above, as well as other examples, and the maximum measurement that I will get is 180us or 2 inches. I can get readings for anything closer than 2 inches.

    Thank you in advance for any assistance.

    dprbrts42
  • dprbrts42dprbrts42 Posts: 2
    edited 2008-02-20 04:07
    Interesting Note.... If I insert some sort of blocking device between the two "eyes", i.e. folded up piece of paper, I will get accurate readings up to several feet away.

    Did I miss something in the instructions?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-02-20 04:16
    I would call Parallax technical support tomorrow. There was someone else recently who had a similar experience (maximum reading too close).
  • quickster47quickster47 Posts: 35
    edited 2008-02-21 23:29
    You might also consider how you have it mounted. I have found that incorrect mounting of the PING))) can give the exact results you are describing.

    Carl
  • FranklinFranklin Posts: 4,747
    edited 2009-09-12 15:59
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    ' Conversion constants for room temperature measurements.
    CmConstant CON 2260
    InConstant CON 890 
    cmDistance VAR Word 
    inDistance VAR Word 
    time VAR Word 
    DO 
    PULSOUT 15, 5 
    PULSIN 15, 1, time 
    cmDistance = cmConstant ** time 
    inDistance = inConstant ** time 
    DEBUG HOME, DEC3 cmDistance, " cm" 
    DEBUG CR, DEC3 inDistance, " in" 
    PAUSE 100 
    LOOP
    

    Looks like you have your math functions reversed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.