0

Button (or PIR motion sensor) logic help

I found an old thread that only had the answer as an attached example file.  But the file is no longer there, so I'm asking for help here.

Have x5 PIR Motion Sensors, each patched to their out BS Player.  I need logic for two scenes.

1) Less than x3 PIR Motion Sensors are triggered: each corresponding BS player plays show A.

2) Equal to or great than x3 PIR Motion Sensors are triggered: all x5 BS players play show B

Thank you ahead of time for the advice!

1 comment

  • 0
    Avatar
    Mark Richards


    This is a way to implement this, but its something that would be easier to explain with an example.

    https://www.dropbox.com/s/ika17zjfngwk43v/INPUT_COUNT%20MASTER.bpf?dl=0 

    https://www.dropbox.com/s/zmdu0f5drqxztet/INPUT_COUNT%20SLAVE.bpf?dl=0 

    Assuming there is a PIR attached to GPIO_0 of each player and a GPIO down event corresponds to a triggered PIR.

    I would setup one master player and 4 slaves.

    You can't have a GPIO up and down event on the same state, so each project will need have 2 zones so we can monitor the GPIO transitions without changing the playback media.

    Slave project
    Zone1
    Zone1 will contain the playback of ShowA and ShowB.
    for state ShowA add a synchronize event to play ShowB when it receives "SHOWB".
    for state ShowB add a synchronize event to play ShowA when it receives "SHOWA".

    Zone2
    Zone2 will have two event handler widgets to track the GPIO up/down events and will transition between them when the PIR transition occurs. When a GPIO_0 down event occurs send a UDP message "DOWN" and for a GPIO_0 up event send a UDP message of "UP". This is for the master to keep track of the PIR state of each slave player.

    Master project

    Start by adding a variable called PIR_COUNT and set its default to 0. Also check the box to reset the variables to default values on presentation start.

    Zone1
    Zone1 will contain the playback of ShowA and ShowB.
    for state ShowA add a zone message event to play ShowB when it receives "SHOWB".
    for state ShowB add a zone message event to play ShowA when it receives "SHOWA".

    Zone2
    Again Zone2 will have two event handler widgets that we will transition between every time the GPIO_0 event occurs.
    to each event handler state, add three events:
    - GPIO_0 up/down which transitions to the other event handler for the other up/down state
    - UDP "UP" message which stays on the current state
    - UDP "DOWN" message which stays on the current state


    For each of the 3 down events, under advanced:
    - Add a new command of type "Other > increment variable > PIR_COUNT"
    Under set conditional targets, add the following conditional targets:
    - "if PIR_COUNT is less than 3" under advanced add a zone message and a link synchronize command to send "SHOWA"
    - "if PIR_COUNT is greater than or equal to 3" under advanced add a zone message and a link synchronize command to send "SHOWB"

    For each of the 3 up events under advanced:
    - Add a new command of type "Other > decrement variable > PIR_COUNT"
    Under set conditional targets, add the following conditional targets:
    - "if PIR_COUNT is less than 3" under advanced add a zone message and a link synchronize command to send "SHOWA"

    The master player should now keep track of the PIR state of all players and trigger playback of the correct show.
    Something to consider here is the states of the event handlers vs the PIRs. In this example we are assuming no PIR is triggered when the master presentation starts. If the master is rebooted during operation while a slave PIR is triggered, the count will be one lower than expected when this PIR is cleared. So its possible to end up triggering ShowB on the wrong number of PIRs. A simple solution to this issue is to restart all players at the same time. A less brutal approach would be to navigate to the master units variable page and correct the count manually:
    http://<MASTER IP ADDRESS>:8008
    A more complicated way would be to track individual PIR UP/DOWN events and compare each individual PIR state to determine the correct count. A bright script would be the way to go.

     

     

     

Please sign in to leave a comment.