Shop OBEX P1 Docs P2 Docs Learn Events
Ping range sensor — Parallax Forums

Ping range sensor

LuciferiusLuciferius Posts: 2
edited 2008-01-18 17:59 in Robotics
Today I got a new Ping Ultrasonic Sensor. The problem is that if I want to measure the range it will measure the range up to 14 cm. Normaly it detects objects up to 3 m.
My code:
' {$STAMP BS2}
' {$PBASIC 2.5}
' Conversion constants for room temperature measurements.

CmConstant CON 2260
cmDistance VAR Word
time VAR Word

DO
PULSOUT 15, 5
PULSIN 15, 1, time
cmDistance = CmConstant ** time
DEBUG HOME, DEC3 cmDistance, " cm"
PAUSE 100
LOOP

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-01-17 02:21
    Code looks OK to me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DgswanerDgswaner Posts: 795
    edited 2008-01-17 05:32
    I had the same problem with my stamp, it wouldn't give a reading past 30" works just fine on my Propeller tho. I think it has to do with the wait time in the code, you need to allow more time for the echo. IKD which I could help more

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "A complex design is the sign of an inferior designer." - Jamie Hyneman, Myth Buster

    DGSwaner
  • ZootZoot Posts: 2,227
    edited 2008-01-18 10:54
    Try setting pin 15 low before the pulsout. Also simple things like noise on the line to the Ping.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • LuciferiusLuciferius Posts: 2
    edited 2008-01-18 15:44
    I tested your ideas, but it didn't work. I set the PAUSE-order to 200 and set PIN 15 low. There is another interesting fact: If I cover up the detector it will measure 327 cm.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-01-18 17:59
    Hello,

    Please contact Tech Support directly to arrange to have the PING))) sent in for testing. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.