Start timer and kill timer with one button

FrankBerends

Member
Join Date
Jan 2021
Location
Holland
Posts
9
Hi folks,

As an enthusiast beginner in PLC programming (Click PLC), I'm already for days struggling to find a solution for this:

I want a momentary PB (X1) to start a timer that starts a pump (coil Y1). The timer is set to 5 min. and then the pump stops. But when the tank is empty before the 5 min. have ended, I want to kill the process by the same PB (x1).

Thanks to this forum I managed to program one button start/stop actions (with set/reset) and I learned to program the timer thing (reversed TON). Now I want to combine these two. But so far I only managed to do the thing with a PB2 (X2) as a kill switch. I won't bother you with the numerous setups I tried (and failed), but I will share the best I made till now. The next step is to change PB2 to PB1 as well.

Appreciate your help!
(btw, Y2 is LED ring of PB1)

Make X002 kill switch.png
 
put x001 where x002 is and then a t1 normally closed that way t1 can fire the reset coil or x001 and not T1, if that does not work try and add to that with and not c1, neither may work based on how it scans or one or the other may work and probably one shot on the second x001 on that or branch. other thing would be to create an alternator that would for sure work press once does set press again does reset and again set again. if you don't know alternator circuit google examples are out there. When new to this stuff experimenting is the best teacher but in a safe environment
 
Last edited:
Look for JKFF (J-K Flip-Flop)

Have the PB set a bit. If the bit is on run the timer, if the PB OneShot comes on when the timer is timing then Reset it.

If you need to clear the JKFF bit when the timer gets done then XIO Timer on the JKFF rung,
 
Good stuff so far. I know what I would do, but it would be in an A-B ControlLogix. I don't know the power-down/up functionality of Click hardware.

My thoughts would be what it would need to do if the power went off the system half-way through a timing cycle, or if the motor tripped during a cycle. How do you want the logic to recover, continue timing, or reset? Again, unfamiliarity with Click.

I notice also that you want to stop the pump when the tank goes empty using the push-button ? Surely if you have a level probe to tell you the tank has emptied, you don't want to be waiting for a push-button press ? Unless it has been designed for it, pumps generally don't like being run "dry", and if you are not pumping anything, you are wasting energy, achieving no "work".
 
I also notice that your programming software allows you to use address and rung comments.

Please get used to using them, it saves people looking at your code from going cross-eyed trying to see where bits are getting turned on and off.

You partially documented the code in your post telling us which bits were what, but if they had been visible on the ladder diagram it would have been much easier....
 
Thanks so far! Still studying on this...
To answer a few questions:

- This is a real-life question. The pump is from the sump tank on my boat
- The pump is capable of running dry. Later on, I will get a tank sensor and connect that to PLC too.
- I used comments now in the Ladder
-T1 is set to 5 sec for testing purposes. Later will set it to 5 min (average time to empty full tank)

@AKAHammer: tried your suggestions, but no luck so far.
@I_Automation: will look into that, but your suggestions are a bit on the short side for a newbie like me :)

Make X001 kill switch.png
 
flipflop.


Update: generic flip-flop below



Code:
         1shotTrigger     Out         Out
----+-----] [-------------]/[----+----( )---
    |                            |
    |    1shotTrigger     Out    |
    +-----]/[-------------] [----+


Take your time, study it, figure it out, understand it; it's that moment of dawning comprehension we live for. N.B. 1shotTrigger is 1 for only one scan at a time.



Caveats

  • Most important: [1shotTrigger] is a one-shot!!!
    • I.e. typically 1 for exactly one scan,
    • in this case driven by your PB input
  • That is the simplest version; your exact setup may be slightly different because of the timer.
  • Operationally, the PB input may need a debounce, to make it work, because one finger-press of the physical button may yield several rising edges across several.
 
Last edited:
Thanks so far! Still studying on this...
To answer a few questions:

- This is a real-life question. The pump is from the sump tank on my boat
- The pump is capable of running dry. Later on, I will get a tank sensor and connect that to PLC too.
- I used comments now in the Ladder
-T1 is set to 5 sec for testing purposes. Later will set it to 5 min (average time to empty full tank)

@AKAHammer: tried your suggestions, but no luck so far.
@I_Automation: will look into that, but your suggestions are a bit on the short side for a newbie like me :)

Forget the low-level tank sensor, if that fails you have nowhere to travel. You need a simple flow-switch in your pump outlet. If the pump can't produce flow, you are either empty or have other problems. A high-level probe is much more use, telling you when to start a pump-out. Wire it "fail-safe".

Put a watchdog timer on that high-level probe staying covered, and another on the expected time for the sump to be emptied. Either watchdog timing out indicates a problem with the expected pump-out rate. Your system may "work", but if the pump is struggling to pump out in a reasonable time, it indicates a problem like too much intake, or not enough out-take.

Think about "physical" things to enumerate, sense, and deal with, rather than what "should" happen, on a good day, with the wind in the right direction....
 
OkiePC gave me the working solution. I must be honest, just copied it and it worked. Now studying why it works and learn from it.
Thank you all for your help!
 
Sorry, could not help myself.


Code:
         PB
         X001         1shotTrig
----+----]^[----+------( )---
    |           |
    |  [B][COLOR=Blue]T1.Done[/COLOR][/B]  |
    +----]^[----+


         1shotTrig    C10         C10
----+-----] [---------]/[----+----( )---
    |                        |
    |    1shotTrig    C10    |
    +-----]/[---------] [----+


   C10
---] [---+---[Timer(On delay)  [COLOR=blue][B]T1[/B][/COLOR]]--+----
         |   [...                ]  |
         |                          |
         |      Y001/Y002           |
         +---------( )--------------+
Caveats

  • ---]^[--- detects rising edge (0-to-1 transition)
  • Assumes C10 becoming 0 will stop and reset timer i.e. do not use retentive timer.
  • Does not include (possibly necessary) debounce on X001 input.
  • T1.Done may be just T1 - i.e. whatever is 1 when timer completes.




Can eliminate one instruction (output branch on last rung) by replacing C10 and with Y001/Y002.
 
OkiePC gave me the working solution. I must be honest, just copied it and it worked. Now studying why it works and learn from it.
Thank you all for your help!

I personally don't think a Flip-Flop is the best solution, unless it has the interlocks needed, but if the solution has the interlocks, do you need to remember ?
 

Similar Topics

Hello I have two 480v motors that has remote start capability. When the remote start button is pressed the 1st motor starts in 15 seconds. When...
Replies
16
Views
5,318
Hello Everybody! I would have a question regarding restart timer topics. I use codesys 2.3 with Wago 750-880 PLC. Based on the attachment program...
Replies
0
Views
1,207
Hi everyone, My name is Chris and I'm currently in the midst of teaching myself how to program PLCs for my job. I'm currently experimenting with...
Replies
7
Views
12,460
Hi. I am working with ControlLogix 5000. I have a numerical value in a DINT tag. Is it possible to code it so that if that value is changed, it...
Replies
8
Views
1,666
I have attached image of my ladder. I am using siemens plc s7 cpu 226 dc/dc/dc. I want to start timer as soon as input is given to it. I want to...
Replies
1
Views
2,083
Back
Top Bottom