Shop OBEX P1 Docs P2 Docs Learn Events
Ping False triggers on noise — Parallax Forums

Ping False triggers on noise

T ChapT Chap Posts: 4,217
edited 2011-08-04 08:39 in Accessories
I have two pings in a noisey envronment ( restaurant ) as an alternative to a passive IR motions sensor. The area of detection needs to be controller better than the PIR style sensor. In this case, there is a loop that cycles constantly, firing ping 1 then 2. The distance can be preset per sensor in the gadget software setup menu. This morning there was some nailgun activity ( air ) and each time the gun went off, the Ping triggered for a detection below the preset threshold set in the Propeller. I assume that since the cycles are so close together, that any other noise that shows up is false triggering the device. I wanted to see if this effect made sense to anyone else, the first test is to slow down the cycle and see if that helps. Any other advice appreciated.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-08-03 11:27
    It makes perfect sense that a nailgun would be detected as an echo, since a loud impulse like that contains many frequencies. A reasonable solution would be to take several readings in succession and use the median value (not the average, or "mean") to filter out the errant data.

    -Phil
  • T ChapT Chap Posts: 4,217
    edited 2011-08-03 13:13
    AHA! Good one.
  • T ChapT Chap Posts: 4,217
    edited 2011-08-03 13:31
    The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and picking the middle one

    I don't know how median applies when the results will only be 1 or 0?

    Say there are 5 samples from the Ping, whereas a 1 represents a positive detection of an object below a preset distance:
    Ex. with noise interference:
    1 = 0
    2 = 1
    3 = 0
    4 = 0
    5 = 1

    The median would then be to arrange the numbers from lowest to highest: 00011, then pick the middle number which is 0?

    Or:
    Ex. with noise interference:
    1 = 1
    2 = 1
    3 = 0
    4 = 0
    5 = 1

    00111, in which case the median is a 1, even though false triggers. So why not just test a number of Pings, and make a rule that the must ALL be true?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-08-03 14:01
    Apply the median calculation to the distance readings first, then make your 1/0 decision from the result.

    Checking for coincident readings from multiple sensors is also valid.

    -Phil
  • T ChapT Chap Posts: 4,217
    edited 2011-08-04 08:32
    Phil, for SPIN is this all hard code or is there some simple trick or operation for median? Kind of tricky to get a concept sorted out to load in 5 samples, compare all, the select the lowest to highest values.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-08-04 08:39
    Here's some PBASIC code for computing a running median:

    It shouldn't be too hard to convert to Spin.

    -Phil
Sign In or Register to comment.