Shop OBEX P1 Docs P2 Docs Learn Events
Need help with Ping sensor/ microcontroller — Parallax Forums

Need help with Ping sensor/ microcontroller

Andy7811Andy7811 Posts: 6
edited 2009-06-13 23:52 in Accessories
Hi im doing a research project that has to do with ultrasound sensor. the sensor that im·using is Ping sensor. The·problem is to find the·distance between·1st·paper and 2nd paper.

Process :·The sensor·(attached·to microcontroller) is straightly placed in front of the·1st paper (stand)·at some distance, then a 2nd paper is placed behind the 1st paper at some distances.

The question is How·do we write a program·so that the sensor detect the distance between·1st and 2nd papers?

Please help me out. Im·new·to sensor and beginner to·microcontroller.

thank you ···

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-13 19:02
    You can't do it. The PING can measure only the distance to the closest surface causing a reflection.

    The PING sends out a pulse of ultrasound. It starts a logic pulse when the sound is transmitted and stops the logic pulse when the first echo is received. The width of the pulse is proportional to twice the distance to the surface reflecting the sound pulse back to the PING. If there is another surface beyond the first surface, the PING will not detect it.

    What you can do is to place the more distant paper first, measure the distance to it, then place the closer paper second and measure that distance, then subtract the two numbers to give you the distance between the two papers.
  • Andy7811Andy7811 Posts: 6
    edited 2009-06-13 20:01
    thanks alot·for helping out.

    The distance of the 1st paper is not far, very close to the sensor, and the 2nd paper that is behind the 1st paper is not far, close to the 1st paper, let's say about 2 or 3 cm from the 1st paper.·Everything is in the range of sensor.

    The measurements·can be·measured but·we·want to write the program so the sensor can measure for us.·Example,·how do·we use (mainly program) sensor to measure the thickness (distance) of thin paper box? That is mainly about my research, is measurement of thickness of object by using sensor.·But i don't·know·whether·it's work or not·b/c·of difficult w/ programs. Please·help me.

    thank·you
    ·
  • Andy7811Andy7811 Posts: 6
    edited 2009-06-13 21:21
    These are the codes i have so far from Parallax. it works for the 1st paper (first surface) But it doesn't work for the 2nd paper or second surface of the object.


    ' Smart Sensors and Applications - PingMeasureCmAndIn.bs2
    ' Measure distance with Ping))) sensor and display in both in & cm
    ' {$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
  • TubularTubular Posts: 4,705
    edited 2009-06-13 21:41
    Hi Andy,

    Erwin Sick (German sensor company) have an ultrasonic sensor specifically designed to detect "multi feeds" (2 or more sheets of paper together, for really high end copiers etc). I've used it and works very well.

    As I understand it, it resonates the space between the two sheets of paper, but they are typically closer than you describe (a few mm). No matter how close they are it still seems to detect the 2nd sheet. I was very impressed with its effectiveness. I remember it did actually work with quite large gaps too.

    Obviously your goal isn't just to buy one of these and be done, but I'm just posting to reassure you it is possible and there are commercial products to prove it.

    Whether you can adapt the Ping module is another matter. You may need to dig deeper and extract an intermediate analog signal to process.

    If you want the Sick part number I can find that for you on Monday

    good luck

    tubular
  • Andy7811Andy7811 Posts: 6
    edited 2009-06-13 22:49
    Hi Tubular,

    Sure. is there any specific link to look at it? how much did you buy it? It is true, it's not done quickly b/c the object that i will measure is ice thickness for my undergrad research. if it's not possible, i'm going to change my object.

    thanks
  • TubularTubular Posts: 4,705
    edited 2009-06-13 23:52
    Andy,

    This is the one...
    http://forums.parallaxinc.com/mysick.com/saqqara/pdf.aspx?id=im0006627

    I had forgotten it had a separate TX. This may affect you as I think you are probably trying to do it single sided. If doing it single sided, you could try attacking the problem at 45 degrees (getting a spatially different reflection from the paper behind due to its increased distance (and use more than one receiver), otherwise yes you'll probably need ultrasound techniques.

    Its an interesting project because it could be very simple or very complicated, hard to know in advance. I suggest you discuss possible approaches with the supervisor, because they probably already know whats is required to solve the problem. Do this before committing to it in its entirety. IMO it could rapidly evolve into something beyond undergrad level!

    There are ultrasound chipsets from Analog Devices, but I'm guessing the transducer required might be quite complicated.

    tubular
Sign In or Register to comment.