Shop OBEX P1 Docs P2 Docs Learn Events
PING))) likes to return 15cm [still unresolved] — Parallax Forums

PING))) likes to return 15cm [still unresolved]

bulkheadbulkhead Posts: 405
edited 2007-11-06 02:19 in General Discussion
I have a PING))) hooked up to a propeller through a 2 k ohm resistor and +5V and am using the Ping object. When I print the output, I seem to get '15' when I use centimeters() about 80% of the time, with the correct distance for the other 20%. The same is true for inches(), it returns '5' most of the time (5 inch ~= 15cm with truncation). What could be wrong?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm new to the propeller!

Post Edited (bulkhead) : 11/5/2007 9:47:58 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-02 04:39
    What's your setup? What's in front of the PING? What are the distances? Maybe the PING is getting reflections from a tabletop or something like that. If you're using the PING object and hooked it all up as you described, it ought to work. The series resistor is only 2K compared to the suggested 10K, but that shouldn't cause this sort of thing.
  • bulkheadbulkhead Posts: 405
    edited 2007-11-02 22:03
    I tested it again without the mounting bracket I had made and it still does the same thing, returning either 15cm or 5 inches most of the time and occasionally returning the correct distance, no matter what I aim it at. The only time when it consistently returns the correct distance is for distances lower than 15cm/5 inches.

    On another note, I hear this clicking noise each time it takes a measurement, is this normal?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm new to the propeller!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-11-02 22:10
    bulkhead said...
    On another note, I hear this clicking noise each time it takes a measurement, is this normal?
    It is if you're under 30. smile.gif

    Don't forget that the Ping)) has a rather wide acceptance angle. This means it will return an echo from the first object it sees, whether it's directly in the "line of fire" or off center. If the unit isn't mounted high enough, or if the floor surface is rough, you many be getting an echo from that.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-02 22:12
    1) The clicking noise is the sound pulse produced. You're probably hearing the edges of the pulse.

    2) How about posting your program? There's more to it than just the PING object ... lots of code to find an error in.
  • bulkheadbulkhead Posts: 405
    edited 2007-11-02 22:39
    I have tried completely removing the ping))) from my mounting bracket and robot altogether but it still wants to return 5cm/15in no matter where I point it. The only time it works (consistently) is when something is closer than that.

    This is the gist of my code, since my actual program is quite large:

    OBJ
        term:   "PC_Interface"  'PC-Interface Driver v0.3.0
        ultrasonic: "Ping"         'Ping))) Object V1.1 
    
    PUB main
       term.str(string("ultrasonic: "))
       term.dec(ultrasonic.Inches(_ultrasonicPin))
    



    I am using the "Ping" object without any modifications.

    On another note, I have also been having trouble getting the H48C tri axis accelerometer to work properly (it works partially, see this thread http://forums.parallax.com/showthread.php?p=684827). My setup is essentially the PEK breadboard with the accelerometer, ultrasonic, 1 servo, 2 h-bridges, a playstation controller and a serial port connection. I get these problems even with the h-bridges and servo disconnected (rules out electrical noise from motors). Perhaps the accelerometer and ping))) problems are somehow related. They both work partially but not completely..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm new to the propeller!
  • bulkheadbulkhead Posts: 405
    edited 2007-11-05 09:45
    Bump...is there anything I can try doing?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm new to the propeller!
  • Harrison.Harrison. Posts: 484
    edited 2007-11-05 10:29
    What happens if you completely block out the sensors to force the maximum response time? Do you still get 15cm then? If so then its likely to be a coding issue more than a hardware one.

    Harrison
  • bulkheadbulkhead Posts: 405
    edited 2007-11-06 02:19
    I just tested it and I get 344 cm when I cover either of the transmit/receive end. I am not sure exactly what the timeout is, but that seems about right.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I'm new to the propeller!
Sign In or Register to comment.