Faulty Component Sensor

andyskin01

Member
Join Date
Jan 2024
Location
Newark
Posts
2
Hi,

Need help with coding for a faulty component sensor which we are using a push button as we are using a test rig. the plc is a allen bradley micrologic 1200

Faulty Component

if this sensor detects a faulty product (denoted by press a push button 4 times with 2 seconds). the reject cylinder comes out and the conveyor stops while this happens. if the sensor detects 2 blips within 2 seconds it is assumed the component is good and the conveyor starts back up.

the way i have done it so far is

when the push button is press once a counter counts that press will it reaches 4, push button is press 4 times. then, then the conveyor stops and the reject clamp comes out for 2 seconds, once the reject clamp is retracted the conveyor.

Can some one help me how to add the timer for the within 2 seconds?

thanks for any help
 
if this sensor detects a faulty product (denoted by press a push button 4 times with[in] 2 seconds). the reject cylinder comes out and the conveyor stops while this happens. if the sensor detects 2 blips within 2 seconds it is assumed the component is good and the conveyor starts back up.

[...]

Can some one help me how to add the timer for the within 2 seconds?

The program (model) has two modes (actually three, but let's focus on the main two):
  • Parts are good, no push button presses detected, God is in His heaven and all is right with the world.
  • An initial push button press is/has been detected, we need to detect if we get three more (four total) before two seconds pass since the initial button press
Once that initial press occurs, it's a race:
  • Will the counter reach four presses ...
  • ... before the timer reaches 2s?
The key word there is before, because PLC programming is primarily about time, so when something happens is more important than what happens.

The solution is to have the completion output of each "counter" (a timer is a counter, but of time rather than of rising edges) interrupt the "count" (action) of the other "counter;" so the first one to reach its finish line "wins" the race.

Timer

The preset for the timer is 2s.

The input to the timer is the most complex; it must be held high
  • (A) from the first button press,
  • (B) AND stay high until the counter completes (four button presses total).
(A) Consider what changes after the first button press: the count increases from 0 to 1; subsequent button presses will increase the count. So one way to detect "from the first button press" is to check if the counter accumulator is greater than 0.

(B) The timer should keep running as long as
  • BOTH (A) is true (counter accumulator > 0).
  • AND counter has not reached its preset of 4 - which is the same as saying the counter output is 0
    • -]/[- NC Contact of C0.Q or counter_object.DN or C5:0/DN or etc., depending on the model of PLC
That is the total logic for the timer: if the counter accumulator reaches its preset, it will reset the timer; no additional rungs are needed to reset the timer (although it could be done that way). Also note that, if the the timer expires, that resets the counter accumulator to 0 (see below), which also resets the timer because the (A) comparison (counter accumulator > 0) becomes false.

How we configure those two conditions, (A) and (B) to feed the timer depends on the PLC model and the language chosen (ST, LAD, FBD, etc.).

Counter

The input to the button press counter is simple: it is an -] [- NO Contact on the button input; the counter has built-in edge detection, and will always, and only, increment on the rising edge each button press. Note that we could AND that button press with the timer not being expired, to prevent a simultaneous final (fourth) button press and timer expiry from being detected and muddling the logic, but I don't think that will be necessary (see Caveat below also).

All that remains is to reset the counter if the timer expires before the counter reaches its preset of 4. The simplest way to do that is to clear the counter accumulator to a value of 0 when timer expiry (.Q, .DN, /DN, etc.) is detected. It is also possible to reset the counter, but in some PLC models that can generate a false count of 0 to 1 if the button happens to be held pressed when the reset occurs.

Also note that, if the counter accumulator reaches its preset, the timer is reset (cf. the previous section), so the counter completion bit (.Q, .DN, /DN, etc.) is that flag that four presses have occurred within 2s, so putting that bit into an -] [- NO Contact can be used to trigger the reject logic, and the completion of the reject logic can eventually reset the counter.

Caveat

What does happen if the timer expires on the same cycle that the fourth button press occurs? That is up to the coder choosing in what order to execute the three rungs above : timer rung; counter rung; counter reset rung on timer expiry. Because PLC programming is primarily about time, so when something happens (e.g. the order of evaluation of each rung's logic) is more important than what happens.
 
Last edited:

Similar Topics

Hi, i have a PLC B&R X20 CP3484. The machine was shutdown for months due to which I got to loose the plc battery, in the same time ethernet...
Replies
1
Views
117
I am providing 24 volts on encoder input but getting the 24 volts on encoder output.The output voltage is not changing,so I want to ask what will...
Replies
4
Views
2,346
This is a sort of research question. A small motor burned out (3KW) the bearings seized and took out the windings, that plus multiple resetting...
Replies
8
Views
2,280
im a noob in need can someone help make a ladder logic system that can stop the production line when there is a faulty bottle, and two pneumatic...
Replies
6
Views
1,430
Hi, We have on some installations that have the FB125 profibus diagnostics and on a HMI panel we can see the nodes. 3 node's are red. So we...
Replies
2
Views
2,221
Back
Top Bottom