• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Push button relay toggle

    Mervis
    mervis neuron switch
    10
    25
    8243
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      Jan Teunis last edited by

      Hey all!

      I've just recieved my neuron L203 and began playing with the mervis software. In my house are only push button switches, so they don't keep the DI constantly on, instead, they give a short pulse (or long, is you keep pressing them).

      How can I get this behavior to toggle a RO?

      • push > relay goes on
      • release > relay stays on
      • push > relay goes off
      • release > relay stays off

      Even better... is there a way to detect the length of the push, or detect double clicks?

      T 1 Reply Last reply Reply Quote 0
      • T
        tomas_hora administrators @Jan Teunis last edited by

        @Jan-Teunis Neurons have a direct switch function (see documentation) but it detects only rising/falling edges of the signal. Long presses has to be solved in mervis. So I suggest you to create your own function block, which will take care of it...

        1 Reply Last reply Reply Quote 0
        • SorakCz
          SorakCz last edited by tomas_hora

          Hi,

          I am solving same issue. I have ST program. Its reacts only on rising edge. But it is slowly and it not work on every push though I have sleep ratio 5%.

          0_1496930629574_Screenshot_08_06_2017__16_02.png

          0_1496930429488_Screenshot_08_06_2017__15_59.png

          PROGRAM tlacitko
          	VAR_INPUT
          		tlacitko:BOOL;
          	END_VAR
          	VAR_OUTPUT
          		rele:BOOL;
          	END_VAR
          
          if (tlacitko=1 AND rele=1)
          THEN
          	rele:=0;
          ELSIF (tlacitko=1 and rele=0) THEN
          	rele:=1;
          ELSE
          ;
          	
          END_IF;
          
          END_PROGRAM
          
          T 1 Reply Last reply Reply Quote 0
          • T
            tomas_hora administrators @SorakCz last edited by

            @SorakCz If you want just this functionality then use the Direct Switch. You do not have to program in ST anything and it reacts on every rising edge which mervis does not have to catch (you could try to detect the pushes via counters thought)

            1 Reply Last reply Reply Quote 0
            • R
              RainerK last edited by

              Hi @all,

              I tried to solve the problem by using "Event triggered tasks" maybe @tomas_hora could explain how it could be done this way.

              BR Rainer

              1 Reply Last reply Reply Quote 0
              • G
                Giamba last edited by Giamba

                Hi,
                With the following program, If I "short" push the button, the final out value goes 0 or previous analog value. If I "long" push the button the value increase or decrease.
                So I have short and long push detection and a toggled output.
                This is working pretty well with 50% ratio.
                0_1499688602224_Long push dimmer.png

                John-paul 2 Replies Last reply Reply Quote 0
                • G
                  Giamba last edited by

                  Hi again,
                  This is my On/Off switch (allways as a fonction block in fdb mode):
                  0_1499690120888_ON_OFF_SWITCH.png

                  1 Reply Last reply Reply Quote 0
                  • K
                    kolopes last edited by

                    Hi,
                    I have 3 buttons that I want to turn on / off the bulb. (push - lights up, push light off)
                    How best to solve.
                    thank you for the advice

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      tomas_hora administrators @kolopes last edited by

                      @kolopes The asnwer is above. The best is to use the DirectSwitch function (set variables DS_enable and DS_toggle to True). The number of DI(button) must be the same as RO. You can enable this functionality for each pair of DI-Ro/Do. Make sure to set the NV_save variable of the group where this will be configured to True and False afterwards.

                      To be able to set the values, you have to be in debug mode!

                      Alternative approach is to write your own function block that might do much more...

                      1 Reply Last reply Reply Quote 0
                      • S
                        sgtgarcia last edited by

                        Hi
                        Where can i find the "Direct Switch" function?
                        Are there some more library files i can download somewhere?

                        I am new to mervis and I'am no programmer.
                        The programs above seem complicated.

                        In the logo software there is a block especially for this purpose.
                        It als has an global off function.
                        That is the kind of thing I need.

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          tomas_hora administrators @sgtgarcia last edited by

                          @sgtgarcia Direct Switch is a feature of HW of Neuron, it's not a feature of Mervis (but it can be of course programmed for such behaviour). To enable DS, check Mervis variables that start with "DS_" there you will find the DS_enable, DS_toggle and DS_polarity functions.

                          1 Reply Last reply Reply Quote 0
                          • M
                            msoenen last edited by

                            Hello I would like to activate direct switch, but I can not find how. could you explain?

                            T 1 Reply Last reply Reply Quote 0
                            • T
                              tomas_hora administrators @msoenen last edited by

                              @msoenen https://kb.unipi.technology/en:sw:01-mervis:advanced-modes-of-digital-inputs-hidden#direct_switch

                              1 Reply Last reply Reply Quote 0
                              • M
                                msoenen last edited by

                                Hello, thank you a works, but is it possible to use a 'RO' output with a 'DI' direct switch and another DI or function
                                thank you

                                1 Reply Last reply Reply Quote 0
                                • T
                                  tomas_hora administrators last edited by

                                  Right now, you can only link a DiX.Y and DO/ROX.Y - X and Y has to be the same with both DO/RO and DI.

                                  1 Reply Last reply Reply Quote 0
                                  • M
                                    msoenen last edited by

                                    Thank you for the answer, but for my home automation project, I wanted to

                                    activate my lamps with pushbuttons ( this OK) and a button to disable all RO at the same time

                                    how to do?

                                    T 1 Reply Last reply Reply Quote 0
                                    • T
                                      tomas_hora administrators @msoenen last edited by

                                      @msoenen Then check the "DirectSwitch_force" and its documentation which is part of Lib.UniPi

                                      M 1 Reply Last reply Reply Quote 0
                                      • M
                                        msoenen @tomas_hora last edited by

                                        @tomas_hora Hello, this is the function I'm looking for, but I do not really understand how to do the program in input. would you have an example of a program with this function?
                                        thank you in advance

                                        T 1 Reply Last reply Reply Quote 0
                                        • T
                                          tomas_hora administrators @msoenen last edited by

                                          @msoenen Just the picture in the help of Mervis.. There is actually not much to show.

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            msoenen last edited by

                                            0_1542708886962_51727d06-1f8e-42fc-a722-bdae974095ca-image.png

                                            Hello sorry, I am beginner on unipi.
                                            when I do exactly like help, it does not work, it must miss a configuration
                                            Thank you for your help

                                            T 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post