Shop OBEX P1 Docs P2 Docs Learn Events
ping, bs2 OEM timer question — Parallax Forums

ping, bs2 OEM timer question

jrubjrub Posts: 3
edited 2010-02-13 13:22 in Accessories
hi, i've been observing the maximum value of the timer of the bs2 OEM when used with the ping. i positioned the sensor in such a way that there are no obstructions within 5m. I expected that I would get a constant value for the time (maximum value) however, what i got was values ranging from around 9990-1010. I also noticed that this has a linear relationship with temperature. can someone please shed some light on this? i know that transit time is dependent on the temperature. but in this case, it seems to show that the timer also is.

code:

PULSOUT 15, 5
PULSIN 15, 1, time
DEBUG HOME, DEC5 time

sample result:

temperature time
28 09991
28 09991
29 09994
...
34 10005

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-11 16:01
    The transit time for sound pulses is very sensitive to ambient temperature. The Wikipedia has an article on the speed of sound that gives the speed at different temperatures (en.wikipedia.org/wiki/Speed_of_sound).

    The resonator that the BS2 uses for its timing is also temperature dependent, but not much. I couldn't give you numbers without doing some research that you could do yourself. The effect of temperature on sound velocity would completely overwhelm any effect on the BS2's resonator.
  • jrubjrub Posts: 3
    edited 2010-02-12 11:08
    Yes but in my experiment, the transit time shouldn't matter because i'm not getting any echoes (there are no obstructions within 5m of the signal path). Thus, I'm wondering why the reported time is varying. If an object is placed 5m from the ping, the module will not receive an echo but it should still report around 3m, and the timer should (automatically?) stop at a specific value right? How is this value predetermined? my first haunch is a counter is preprogrammed to stop at a specific value. this is wrong obviously because the maximum time varies as temperature changes.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-12 15:36
    The maximum value for the PULSIN is the maximum value for a 16 bit unsigned number (65535 or $FFFF) which corresponds to about 130ms. What you're seeing is strictly produced in the PING. I assume there's a timer in there that times out at approximately 18.5ms as specified in the documentation if there's no echo received. This should give you a PULSIN value of around 9500 if you figure in holdoff time and other delays in the PING. What you're seeing is on that order.

    The PING uses an SX28AC for control. I don't see a resonator or crystal on the PING, so this SX would be using its internal RC clock for timing and the RC clock is indeed sensitive to ambient temperature. This doesn't affect the PING distance readings because that timing is done in the Stamp which does have a stable clock.
  • jrubjrub Posts: 3
    edited 2010-02-13 13:22
    oh i see. so it's in the PING. i'll try to verify this. thank you very much, mike!
Sign In or Register to comment.