0
\$\begingroup\$

This is my second day of learning PLC online. I am doing a simple ladder diagram, and I came up with the following diagram:

enter image description here

The process I have in mind is as follows:

As the switch is closed, the belt is activated. Afterwards, the IR Sensor is activated, turning off the belt, and initiating the timer. For the duration of 5s, "ValveD" and "ValveU" are both turned on. During the first second, "Press" is also turned on. After the 5s and the reset of the timer, I wish to have the belt start moving again (Note that at this stage the IR Sensor is still off), and the cycle is repeated. I am not sure of the correctness of the diagram, however. Moreover, I am not sure how can I add a memory to indicate that the timer has already ended, and the belt should start moving again (OR DONE with the IR Sensor?) Also, when I simulate, the timer keeps resetting and restarting itself, although video tutorials online showed that all timers stopped after they reached their preset time.

So is there a reason why the timer is always working, or does it depend on the used software? Moreover, is there a need for the Switch and IR Sensor inputs to be in the 2nd ladder, since the belt is enough to control the timer. Thank you.

EDIT: This is my final circuit. The first time I tried simulation, I remember it working exactly as desired. However, minor issues happened and Rung 0 was deleted, so I had to add it again, exactly as before. However, now the timer keeps repeating itself. Also, this is the timing diagram of the PLC.

                ________________________________
Switch      ___|         
                       ____________
IR sensor   __________|            |______
                ______           _________
Belt        ___|      |_________|
                       _________
Valve D     __________| . . . . |______
                       _________
Valve U     __________| . . . . |______
                       _
Press       __________| |______________

enter image description here

\$\endgroup\$
1
\$\begingroup\$

First draw a timing diagram. It's better than a wall of text. This is what I think you are trying to do.

                _________
A           ___|         |_______________
                       ______
IR sensor   __________|      |___________
                ______
Belt        ___|      |_________________
                       _________
Valve D     __________| . . . . |______
                       _________
Valve U     __________| . . . . |______
                       _
Press       __________| |______________

Figure 1. The timing diagram.

enter image description here

Figure 2. Original code.

Fixes:

  1. Remove the short-circuit. Instead create a latch for the belt that is unlatched by the sensor.

Rung 0 fix.

----| |---+----|/|--------( )----
  Switch  |   Sensor     Belt
          |
----| |---+
  Belt

Figure 3.

  1. Put a similar rung in here using a bit, say B:3/0, to latch when the sensor turns on and unlatch when the timer times out.
  2. Remove all those contacts and just use B:3/0.
  3. Looks OK.
  4. The PRESS output will be on all the time except between 1 and 4 s after the timer starts running. Add a contact of B:3/0 in here too.

Let us know how you get on. (Also, note how shrinking the Windows window before taking the screengrab will give the readers a much more readable image in StackExchange's 640 pixel wide column format.)


After corrected timing diagram has been provided:

                ________________________________
Switch      ___|         
                       ____________
IR sensor   __________|            |______
                ______           _________
Belt        ___|      |_________|
                       _________
Valve D     __________| . . . . |______
                       _________
Valve U     __________| . . . . |______
                       _
Press       __________| |______________

Pause timer __________: . . . . |______

Figure 4. Revised timing diagram provided by OP.

The problem you're having is that the sensor is staying on after the end of the timing cycle. You need to use a one-shot to detect the rising edge of the IR sensor to latch B:3/0 and have it unlatch with the timer.DN.

   I:1/1      B:3/1      B:3/0
----| |---+---[OSR]---+---( )----
  Sensor      Sensor  |  Pause
   B:3/0     T:4.0/DN |                   |
----| |---+----|/|----+
   Pause      Delay

Figure 5.

You should be able to work it from here. See page 41 of SLC 500 Instruction Set for details on the OSR and note the different implementation on some of the PLCs.

Note that your current code still has the original problem 5.

\$\endgroup\$
7
  • \$\begingroup\$ Thank you for your help. I did implement your suggestions, but the belt failed to operate after the timer was off, since at this stage, the Sensor is ON, preventing it from operating as in Rung 0. I tweaked it a bit and changed it so that T4:0/DN is OR with the Sensor, such that it would operate again after the timer is off, despite the Sensor being ON. I added my final diagram to the post. The simulation worked perfectly as desired the first time I tried. However, some issue happened and I had to redo it again, and now the timer keeps repeating itself (Exactly same diagram). \$\endgroup\$
    – Zelreedy
    Jun 7 '20 at 13:09
  • \$\begingroup\$ Moreover, I changed the B:3/0 to inverted, since it previously worked with the belt (it was supposed to work opposite to the belt to initiate the timer). \$\endgroup\$
    – Zelreedy
    Jun 7 '20 at 13:14
  • \$\begingroup\$ OK, so copy my timing diagram into your question, format it as code using the {} button and edit it to show what you want. With the timing diagrams we usually try to show all the cases so yours should show what happens if the sensor stays on or if it just switches off and on again. If the sensor is normally on then your timing diagram should reflect that. (Mine assumes that it is normally off.) It may seem unnecessary but it's really worth the time to do this as it clarifies your thinking and serves as an excellent guide when writing the PLC code. \$\endgroup\$
    – Transistor
    Jun 7 '20 at 13:51
  • \$\begingroup\$ Done as suggested. From the timing diagram, the cycle restarts when the sensor is turned ON. \$\endgroup\$
    – Zelreedy
    Jun 7 '20 at 14:01
  • \$\begingroup\$ See the update. \$\endgroup\$
    – Transistor
    Jun 7 '20 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.