Special Light control

  • Hello,
    i want control my light with switch on wall and with lux sensor, but i want in every time turn light off with switch, so if LightSW_1 is ON -> Light ist ON and/or Light_sensor go ON -> light ist stil ON. After i want switch OFF, LightSW_1 -> Light go OFF, OR switch OFF Light_sensor -> Light also go OFF,
    Have Mervis some special fbd for this, or how can i create it ?

    alt text

  • administrators

    Hello @tin-androić,

    there is no special FB for this, but you can construct them from the existing ones. First, you need to decompose the problem to several layers.

    1. Detecting changes
      To detect the change, you need to look for "edges" of the square signal. The Mervis has triggers for rising edge (changing from 0 to 1) and falling edge (changing from 1 to 0) producing a rising edge on the output on given occassions on the input.

    2. Combine the changes
      From your example you need to react to rising and falling edge of either on of the inputs. So if rising edge occurs on LightSW_1 OR Light_sensor. You can use logical block "OR".

    3. Setting and resetting the light
      You want to set the Light to ON when the combined rising edge occurs and reset the Light to OFF when the combined falling edge occurs. This is job for flip-flop FB called Flip Flop (BD52). You would use inputs IN and IND

    Best regards,

  • Thanks Martin, for fast answer. Now i heave problem, for exemple: Switch ist True then Light_sensor i put True and again False, and now when i want turn on Lamp with switch, i need push switch button two times, (first time go to false then second time to true and Lamp go ON ). Thats ok for sensor but not for switch button.

    alt text

  • Hello Tin,
    You want to control the lights from two places, but you use the switch instead of the button.
    Light sensor is unable to change the switch position to off.


  • If you use push button via the digital input, then use own control mechanism (pulse counter) with reset from ligth sensor falling edge.

Log in to reply