Shop OBEX P1 Docs P2 Docs Learn Events
question on ping sensor — Parallax Forums

question on ping sensor

stefstef Posts: 173
edited 2010-05-04 13:32 in Propeller 1
Hi everyone.

I have a little question. Is it possible to see the differance with a ping sensor (item code 28015) for human aprocing the sensor or going away from te sensor.
I need a way to detekt with a propeller that is fix located (aganst the wall abouve a door) that someone is aproching or leaving. I was thingking about the ping sensor. Normaly it is mounted on a robot to detekt obsticals but now it is in revers. Mounted on the opstical (wall) and telling that the object (human/child) is comming toward the sensor or going away. It is perhaps importand to say that is is intended to install it higher than the persons on an angle looking downwards. This is only done because of practical reason.

Is it fast enough in detektion if someone is normal walking?

Has someone any experiance on this or comment. I'm not sure if it is possible and are intending to set up a test but before doing that i'm interested in any comment.

Stefan Vanhoof

Comments

  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2010-05-03 23:11
    You need to use the PING object that should be in the default Propeller liberary. If it is not, then get it out of the OBEX. Once you have that, hook your PING up to pin 0, and a pushbutton to pin 1. You will use the following code as an obje.
    CON
    
      _clkmode = xtal1+pll16x
      _xinfreq = 5_000_000
    
    VAR
    
      word set_dist
      word start_scan
      word end_scan
    
    OBJ
    
      ping  :  "PING"
    
    PUB Moving
      ''This PUB will return TRUE if the object is towards the sensor, and will return false if the
      ''object is moving away from the sensor
      ping.start(0)
      repeat until ina == 1
      set_dist := ping.Inches
      repeat
        ifnot ping.Inches == set_dist
          start_scan := ping.Inches
          waitcnt(clkfreq + cnt)
          end_scan := ping.Inches
          if start_scan > end_scan
            return true
          if start_scan < end_scan
            return false  
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out my new website!!

    Use the Propeller icon!! Propeller.gif

    Follow me on Twitter! Search "Microcontrolled"
  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-04 00:43
    Theoretically you could use a fixed mounted PING to detect an object moving at different distances from the PING. In practice, it depends on the object. Some shapes and materials reflect the sound better than others. People tend to wear soft, sound absorbent materials and their surfaces are rounded so they will disperse the sound energy. You'll have to experiment to see what sort of range you might get.
  • stefstef Posts: 173
    edited 2010-05-04 13:32
    HI all

    Thanks for the comment. I'm going to set up a test case and look if it is possible. If I stumbel on open questions I 'll come back to this forum. You are all a gread help



    Stefan
Sign In or Register to comment.