Shop OBEX P1 Docs P2 Docs Learn Events
Ping info — Parallax Forums

Ping info

grigiogrigio Posts: 13
edited 2006-09-21 21:51 in Learn with BlocklyProp
Hi I'm a new Parallax user and I'm working with Ping sensor. I've some question for you:
because I need high precision in measuring distance of few tenths of centimeters, I wish to know if the distance measured with Ping starts from the front of the two "eyes" or not.
thanks
Paolo

Comments

  • dandreaedandreae Posts: 1,375
    edited 2006-09-13 16:59
    The Ping sensor does measure from the two ultrasonic components on the board, however the distance starts at 2cm and goes up to 3m.

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • grigiogrigio Posts: 13
    edited 2006-09-13 20:43
    Thanks Dave, for the info about the range (2 cm - 3 m) but probably I was not so·plain in my question. I need to know exactly which is the measured path because from some measure I get it seems to me starting not at the front of·the "eye", neither obviously at the rear (near the ping board). could you or some other help me?

    thank
  • PARPAR Posts: 285
    edited 2006-09-14 00:10
    grigio said...
    ...I'm working with Ping sensor. ...
    because I need high precision in measuring distance of few tenths of centimeters, I wish to know if the distance measured with Ping starts from the front of the two "eyes" or not.
    thanks
    Paolo
    It would be helpful to know the range of distance over which you need to determine distance. Also, how are you specifying precision/repeatability, accuracy, error and other aspects of your measurements (and measuring instrumentation)? (I.e., what are your needs related to these various aspects of distance measurement?)

    A "distance of a few tenths of centimeter" is a distance of a few millimeters. Is that what you are dealing with --measuring targets at (only) a few millimeters distant from the Ping?

    PAR

    Oh, and also the dynamics of the system you are measuring --e.g, how fast, what direction(s)·is the object of interest changing its distance from your Ping?

    Post Edited (PAR) : 9/14/2006 5:43:36 AM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-14 13:51
    Paulo, it's not entirely clear what your question is.

    "Distance Measuring" systems have three metrics. The first is the 'range' of the measurement -- in the Ping's case it measures from 2 cm to 3 meters. The second is the 'resolution' of the measurement -- how many digits you can get.· The third is the 'accuracy' of the measurement -- how many of those digits actually represent reality.

    For an example, a laser-ranging system could have a range of 2 cm to 3 meters, with a resolution of 0.1 cm, with an accuracy of 0.01 cm. This means when the unit tells you the distance is 201 centimeters, you know the 'real' distance is between 200.9 to 201.1 centimeters, +/- 0.01 cm.· Usually 'resolution' and 'accuracy' are pretty close together.· If your 'resolution' is 0.1 cm, but your 'accuracy' is 1 cm, then that extra digit does you not much good.·

    From the earlier example, if your 'resolution' was 0.1·cm, but your 'accuracy' was +/- 1 cm, then a measurement of 201.2 centimeters means the 'real' distance is 200.2 cm to 202.2 cm.

    Now, from your question, it's not clear what 'range' you are measuring. Is the 'range' a few tenths of a centimeter? Or is the 'resolution' you need a few tenths of a centimeter?

    It also sounds like you're asking -- "okay, so the unit says 201 centimeters distance. Since the unit itself is a centimeter and a half thick or so, where is the 'start' of the measurement?"

    That last question you could answer just by trying it, I would think.

    Edited:· ****
    A perusal of the PDF document for the 'ping' sensor indicates the distance is measured "from the front of the sensor" -- thus, from a plane laid across the front of the emitter-reciever 'eyes'.· Also, the BS2 gets its results back from the 'ping' sensor as a pulse (measured with PULSIN) with a 'resolution' of 2 uSec (representing 0.0689 cm).· It's not clear from the Parallax documentation what the 'accuracy' of the 'ping' sensor is, maybe somebody from Parallax can do an experiment, to find out what·this might be.

    Post Edited (allanlane5) : 9/14/2006 2:30:27 PM GMT
  • grigiogrigio Posts: 13
    edited 2006-09-15 05:51
    Sorry all, I've written something wrong in my last post. I mean a few tens of cm (not tenths!).

    and thanks to allanlane5 for the specification about resolution and accuracy. measures I made is a path between 10 and 20 cm and I would get also mm from the ping. From·resolution (2 us => 0.0689 cm) it seems to me possible.

    thanks to all

    Paolo
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-15 18:41
    Well, be careful. Sure you can get NUMBERS down to 0.068 cm. But that's plus or minus some number (due to the accuracy of the 'ping' hardware) . You should check carefully how accurate that value is, if you're going to depend on it.
  • edited 2006-09-15 21:24
    The speed of sound in air at 0 °C·is 331.5 m/s, and for every·°C above·zero,·it increases by 0.6 m/s.· ·

    Cair = 331.5 + (0.6 x Tc) m/s

    The speed of sound in air also changes with pollution and humidity, but only very slightly.

    If the temperature in your target environment is not strictly controlled, the application will probably need to measure the temperature and use to correctly scale the time to distance calculations.· The DS1620 <http://www.parallax.com/detail.asp?product_id=604-00002> takes measurements in 1/2 °C increments.· You'll want to try a few sample calculations to find out if measurements within 0.5 °C will be precise enough to keep your measurements in check.

    The size, shape, and angle of the target surface may cause some measurement inconsistencies.· This is something you'll probably have to test.· If there are inconsistencies and they are repeatable, it·may still be possible to write code to correct the measurements.·
  • grigiogrigio Posts: 13
    edited 2006-09-21 09:04
    Ok here are some test result.
    I'm using ping and ds620·thermometer together in my room; data are sent every second via serial port to a pc; the board is on top of a pile of CD's (8 cm in height) to avoid reflection of ultrasonic from top of the table. Ping is at 10 cm from the wall.
    Actually temperature is 24 °C so I'm expecting Cair· to be 345.7 m/s.

    variable rawDist (measured echo pulse) from ping is 318. This should be multiplied by the scale factor for BS2 (that is 2) and then divided by 2 to cancel the return trip, so it·should be the travel time in usec.

    with this data I find that the distance that ping measures is 0.1099 m or 10.99 cm.

    If I change distance from ping to the wall to 8 cm I get a travel time of 270 usec at 24.5 °C·(therefore Cair·will be·346.2 m/s)
    again => distance measured from ping ·is 9.35 cm.

    Why this?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-21 14:40
    Why do you measure the distances at two different temperatures?

    Scientific method is to hold most parameters fixed, and change one parameter at a time, and see what difference it makes. In this case, you're varying both air temperature and distance. Thus it becomes difficult to explain which change is causeing the effect you see.

    So, it could be your "temperature adjustement" code which is causing an error.

    It could also be the humidity of the air. If you take the 10 cm -> 318 count -> 636 uSec, then the speed of sound in air is 314.5 m/Sec. If you use 314.5 m/Sec, then the 8 cm count (270) gives you 8.5 cm.

    So, perhaps the Ping sensor doesn't measure as accurately as you need at close ranges. Try 10 cm to 20 cm. Check how 'repeatable' the measurement is -- does it 'bounce' much for different readings?
  • Mike GreenMike Green Posts: 23,101
    edited 2006-09-21 14:47
    Some thoughts:

    1) If you're measuring from the front surface of the transducers, the actual transducers are a short distance behind the front surface, perhaps a few mm. That could account for around 0.5cm longer path.

    2) We don't know how long it takes from the point where the PING electrically generates the 40KHz pulse train until the transducer generates an adequate sound amplitude to be detected. It may take a pulse or two and that delay could contribute to the apparent distance error.

    3) It would be interesting to graph the PING measured distances compared to the physical distances over the range of the PING, certainly from the minimum distance (2cm) to at least one meter. It may be that you need to make a calibration /compensation table and apply corrections to the raw data in addition to the temperature.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-21 15:15
    Agreed. I'd love to see a graph of "Actual Measured Distance" versus "Ping Reported Distance". And take like 5 measurements at each position, and possibly include 'error bars' that indicate the range of readings at each distance.
  • edited 2006-09-21 17:52
    At constant temperature, humidity, and·air quality, a Ping))) rangefinder distance measurement should fit into:·
    s = Cairt + sO

    You have two unknowns here, the actual speed of sound in air (cair) for your·temperature,·humidity and air quality, and the actual zero distance (sO) for the Ping))) rangefinder.
    ·
    Try taking two different distance measurements.· You will then have two distance measurements (s) and two time measurements (t).··You can use these to solve for cair and sO with algebra (two equations·with two unknowns).· It would be a good idea to verify your results by repeating at several different pairs of distances.
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-09-21 18:29
    Yes, that assumes that the 'distance error curve' for the Ping sensor is in fact linear (that "should fit into" up there) -- you only need two points to establish a linear relationship. What if it isn't exactly linear?

    But you're right -- 5 to 10 measurements at various distances 'should' be able to determine if the response IS linear (which I agree it 'should' be, there's no reason why not).

    Oh, and having determined the relationship equation, hopefully a quick 'calibrate' check at the start of a day of operations will validate any air temperature drift.
  • edited 2006-09-21 19:21
    allanlane5...
    Yes, that assumes that the 'distance error curve' for the Ping sensor is in fact linear (that "should fit into" up there) -- you only need two points to establish a linear relationship. What if it isn't exactly linear?
    Yes, the reason I suggested checking at more than one pair of distances is to find out whether or not the measurements are behaving linearly at this level of precision.· True, I probably should have suggested that grigio test across the entire measurement range and graph it.· I·imagine that physics·could introduce a number of interesting patterns.· For example, one might be related to the·wavelength, introducing steps, and another related to the spread of the pulse's energy over a larger area with distance.· What kind of pattern will we really see?· Hopefully grigio will show us...
    ·
    If it turns out to be linear, it will take less work to finish the project.· If it turns out to be nonlinear, well,·earlier in this thread, I said, "If there are inconsistencies and they are repeatable, it·may still be possible to write code to correct the measurements."· Also Mike Green said, "It may be that you need to make a calibration /compensation table and apply corrections to the raw data in addition to the temperature."
    ·
    There are all kinds of PBASIC tricks for calibration as well as for making systems self calibrating.··You·mentioned averaging earlier, and I think that will·definitely help.· In addition, we've got a number of different types·of scaling at our disposal along with lookup tables for patterns that tend to defy equations, and EEPROM for storing a series of measurements that can be loaded for linear approximation over smaller intervals.
  • grigiogrigio Posts: 13
    edited 2006-09-21 21:51
    thanks to all!

    Specially to Mike and Andy because they finally gave me the answer to my first post: from where ping star to measure?

    I'll try next week with some experiment to find if there·linear relation or not between "Actual Measured Distance"·and "Ping Reported Distance" as allanlane5 said.

    FOr allanlane5: there is no reason why I measured two distance at two temperature, I made them this morning continuosly while posting message with the window open so as the time goes to midday temperature of my office room raised. furthermore I made some test at four dstance so I can try to find some relation to show you all.

    Increasing Humidity increase sound speed as temperature does. Instead from my data I get C values less than C at T=0°C and RH=0%. there is something strange!

    bye
Sign In or Register to comment.