PLC Conveyor Assistance

ToshJW

Member
Join Date
Mar 2021
Location
England
Posts
6
Hi everyone,
Im not after someone to do my task, I'm just after some guidance or even pointed to some online resources I may use to learn more.

I have been given a task to design a ladder diagram for a conveyor system. The system has a sensing beam & 2 sensors, lets call them A,B & C.

The beam and sensor, A & B are used to detect the width of a box. If the box is long then it will be rejected and pushed off the conveyor further down when it is sensed by sensor C. If the box is short, then it'll continue down the conveyor and land in a box.

I have designed a ladder diagram that has this working. The only problem I have came across is if 2 small boxes were placed on the conveyor tightly together. In this case, the beam and sensor will detect a short box as a long box and reject it.

Some quick information. There's a small gap between the boxes that the beam can go through and reset for a millisecond, but Sensor B isn't sensitive enough to detect the gap.

I have attached a document with a print screen of my current ladder logic. I created this on PLC fiddle

Thanks, Tosh
 
Last edited:
To be honest if there is no gap (at least so small it cannot be detected within the scan of the PLC) then the only option is to have two conveyors, one running slightly faster than the other to separate the boxes, if there is no detectable gap then you cannot do anything. The only other way is if you know that the length of two boxes together is shorter or longer than one larger box, this way it would be possible to detect the length to determine if it was one long or two short boxes, however, this would require using high speed inputs and or high speed counters/encoders to detect the length. I have seen applications where a clamp will clamp a box for a short time to create a gap but it will depend on all manner of requirements & fundamentals of the system.
You say the sensor cannot see the small gap, how do you know what the gap duration is, is this something that is written into the assignment or is it an assumption. Sensors have pretty good switch times but the PLC inputs are usually filtered to about 10ms so could easy miss a pulse.
You would need to know the switching time for the sensor, then if it switches fast enough use an interrupt routine driven off a high speed input.
Without the spec of all the equipment/boxes etc. this is impossible to determine what might work. It is better to engineer out the physical short comings rather than to try & get round them in software, If this is an assignment, then as per usual the creators of these have no real experience in the real world, do not give enough information or are just looking to see what creativity you have.
I suggest if it is possible to post the actual requirement.
 
... I'm just after some guidance or even pointed to some online resources I may use to learn more. ...
Ask The Google about High-Speed Counters (HSCs) and interrupts.

Welcome to the forum.

TL;DR


@parky got there first and summarized the problem: the duration of the gap between boxes is shorter than the time between scans, so while the sensor may detect a brief gap, it may be back to detecting the presence of a box before the PLC queries the state of that sensor for the next scan.

There is another issue:

The current program assumes any single box will either clear*, or be rejected by, Sensor C and the Pusher before the next box hits the sensors**.

My point is that, since every computer program is a model of something in the real world and the main design choice is the level of fidelity of the program (and associated hardware e.g. sampling frequency of sensors), the fundamental problem is that the current program is modeling something other than what it is trying to control.

@parky's solution would work to make the physical system fit the model, by making the gap both detectable by the PLC as well as longer than the A-to-B distance. There are multiple other ways to do that, but without a description of the PLC, its capabilities, and any other tools at hand, we are all guessing.


For example, slowing the conveyor might be another option to detect the gap, but would still have the boxes-closer-A-to-B issue.


P.S. not everyone can read MSWord documents; PDFs or PNGs are more universal.

* will clear => will have moved past

** Otherwise a long box at the sensors could trigger the rejection of an acceptable short box that is at or before Sensor C. Unless Sensor C is coincident with the latter of Sensors A and B, the situation described, two boxes with the trailing edge of the leading box within 1ms of the leading edge of the trailing box, seems to violate the assumption. So even if the PLC does detect a short gap between a short box followed by a long box, it may reject at least the short box. Furthermore, even with two acceptably short boxes close, couldn't the first box be making the downstream of Sensors A and B a 1 while the second box is making the other a 1 as well? So an additional requirement is that no two boxes can be separated by a distance less than that between Sensors A and B.
 
There should be a rule:

Don't let the temptation of using clever control scheme to resolve a mechanical / process shortcoming because you happen to the "control person". Fix the real problem
 
There should be a rule:

Don't let the temptation of using clever control scheme to resolve a mechanical / process shortcoming because you happen to the "control person". Fix the real problem




Despite the fact that @harryting is right here, good luck with that.



Someone on this forum has a signature similar to "there is never enough money to do it right but there is always enough to do it twice." So there is no point trying to succeed the first time, because adequate resources are not available until a second (or later) iteration.


We still don't know if this is an exercise or an actual, mis-designed conveyor.


Again, and assuming length not width was meant in the OP, undetectable gaps are not the only issue with the current model; any gap smaller than either the length of a box, or the distance from A/B to C, could cause a problem.
 
Last edited:
I also recommend a gapping conveyor.

Something that might not be clear here. It’s hard for me to tell if this is existing, or concept, or homework.

If it’s existing you can create a gap between two sections. You just need to increase the speed of one downstream section. This could be via vfd, gearbox, sprocket, etc.
 
Sorry, i should've been a bit more clear with my explanation.

So, we have a conveyor system with 3 sensors, lets call them Sensor 1, 2 & 3.

Sensor 1 is a beam sensor, whereas sensor 2& 3 are just normal proximity sensors (I assume). The aim of the conveyor is to detect the length of two different size boxes and to separate them via a pusher.

The length of the box should be found out via the first 2 sensors, and the third sensor should be used to show that a certain length box is in position to be pushed.

Now, my ladder diagram that i posted works if only one box was put on the conveyor at any one time. The problem arises when two or more are put on, or even when theres 2 put on right next to each other, in this case, sensor 2 and 3 are too wide so the gap isn't recognised but the gap IS recognised by the beam sensor, sensor 1.
 
So yes, i did design the ladder diagram and i had a few issues that knew would mean i needed some changes.

With the current workings, theres a few issues. It could discard a short box if it was at position sensor 3 if a long box was at sensor 1 & 2. It could also miss a second long box if the first was travelling between sensor 2 and 3, and the second was passing sensor 1 & 2.
And it could also detect two smalls as a large and discard a small.

Im just wanting pointed in some sort of direction to what i could do to get it working flawlessly. I can use timers, counters, compares, relays.
 
https://www.plctalk.net/qanda/showthread.php?t=128764

https://www.plctalk.net/qanda/showthread.php?t=128167


Solutions in those threads will handle multiple boxes in the system at once, but they are overkill; since there is only one reject station it can be done with a BSL or BSR.

As far as missing a small gap, that is a process problem that will be very difficult to robustly deal with in the PLC via software.

If the gap is slow enough (i.e. below ~10-100kHz or so), then an HSC counting regular pulses, and being reset in hardware on any gap, could be used as a proxy for the two-sensor length measurement.
 
If there is a gap then it is possible to detect the length of the boxes, however, it is almost impossible to detect two small boxes without a gap. The only other possibility is if two small boxes together do not make the same length of a large box (this assumes the box height are the same, if different heights then a sensor to detect height would work). Using high speed timers to measure the box length assuming two small boxes are longer or shorter than a large box then by starting a high speed timer on detection of front & lagging edge the value should be an approximation of the box length, assume a large box is smaller than two smaller boxes together then using simple compares of the box length it could be determined if it is two small boxes or one large box.
for example, if a small box is 300mm long & the time it takes to detect the edges of the box is 300ms then it is a small box, if the large box is 400mm then the time would be 400ms, if two small boxes together then it would be 2 x 300mm or 600mm then it should read 600ms so determining the length of time it takes a box to travel across a sensor should give you one of the three scenarios. Obviously the time values would probably not correspond to 1mm per ms but this is the only way you could do it without more mechanical means of separation. Also, depending on how far away the diverter is from the detection you may need to put in a shift register for example if the diverter is two or three box lengths from the detection then you need to store the incoming boxes in an array and make this move in sync with the conveyor.
However, I doubt that on-line PLC simulator has high speed timers/counters or even time pulses so probably will not help you, you could create a pulse using a timer I suppose but it might be a bit slow, even on dedicated PLC simulators they do not process as fast as a real PLC.
 
Hi again,

So I got a bit of a hint off my tutor but if anything its made me more confused.

So, theres obviously a short box and a long box. These boxes when next to each other have a small gap between them due to the lip at the top. This gap can be recognised by the first beam sensor but the second sensor cannot due to the width of the sensor (edge of first box still in contact with sensor when edge of second box meets it).

My tutor said that my ladder diagram i posted originally is a pass but i dont just want to "Pass". He stated that to get it working flawlessly id need to make it so that the logic has to remember the sequence of long/short boxes so they can be either rejected by the pusher at the third sensor or just ignored to carry on down the conveyor.

My confusion is how do I do this with a combination of timers, counters, compare functions, etc..

Im well and truly lost.
 
How about this?

Model assumptions

  1. Sensor 1 is most upstream sensor
  2. Sensor 2 is next sensor downstream of Sensor 1
  3. Distance from Sensor 1 to Sensor 2 is length of longest acceptable box
  4. HSC 1 count increments on falling edge of Sensor 1: hardware controlled
    1. Sensor 1 falling edge is never missed in hardware i.e. HSC 1
      1. Requires [conveyor speed:minimum gap length] ratio to be less than 20kHz (MicroLogix 1100; 200-250kHz for CompactLogix/ControlLogix/Micro8xx/S7-1200)
  5. HSC 2 count increments on rising edge of Sensor 2
  6. No boxes near, or between, Sensors 1 and 2 at initialization
  7. No edge cases, during PLC scan, in detection of Sensor 2 state, HSC 1 count, and HSC 2 count.
Program

  • Initialize HSC 1 and 2 counts to same value
    • N.B. model assumption (6) above
  • Reject box when
    • HSC 1 and HSC 2 accumulating counts are the same
    • AND
    • Sensor 2 is 1
Miscellany

  • Handling counter rollover is left as an exercise for the OP, if necessary
    • Ideally HSC accumulating counts are 32-bits and rollover never happens
  • Sensor 3 is not needed if conveyor motion is known and consistent i.e. can be modeled, e.g. either
    • Sprocket teeth count is linear with motion
    • OR
    • Conveyor speed and timekeeping are reasonably constant
  • HSC 2 could possibly be a normal, in-program PLC counter
    • Does not have to be High-Speed
    • Depends on how much of a knife-edge the length boundary is
 
So, theres obviously a short box and a long box. These boxes when next to each other have a small gap between them due to the lip at the top. This gap can be recognised by the first beam sensor but the second sensor cannot due to the width of the sensor (edge of first box still in contact with sensor when edge of second box meets it).

If second sensor cannot be relied upon to detect edge of a box then it cannot be used.

However, if Sensor 1 reliably detects all edges, and that detection makes in into the PLC scan, then long boxes can be detected by Sensor 1 being 1 continuously beyond a certain duration: either some number of conveyor sprocket teeth, or a timer assuming constant box speed.

E.g.
Code:
 Sensor1
---] [-------[TON longton  ]---
             [           DN]---
             [Pre  LongTime]
             [Acc         0]


  longton.DN    LongBox
-----] [---------( )------
LongBox will become 1 exactly LongTime intervals after a long box first edge hits Sensor1. That can be used, along with a BSL or BSR instruction, to model when that long box will be at the reject diverter/pusher, and Sensor3 is not needed.


Alternatively, a 0 could be pushed onto a FIFO array at the FIFO's first position on every rising edge of Sensor 1, changed to a 1 in that position whenever LongBox is 1, and the value popped off of the FIFO on Sensor3 rising edge determines whether to activate the pusher. This assumes that Sensor3 also does not miss any boxes. It also assumes there are no boxes at initialization.
 
Last edited:

Similar Topics

the conveyor can stop because of a safety sensor or safety switch. And also it can stop because of an object jam detector sensor. If the conveyor...
Replies
5
Views
154
Need help with designing and test a PLC-controlled pneumatic system that conveys manufactured parts and loads them on a packing machine. I am...
Replies
8
Views
2,653
Hi, I need help in designing a control system for conveyor. The goal is to connect PLC to bar code sensor and then connect plc to serve to...
Replies
1
Views
1,283
Hey I am having issues witb this project im working on and I seem to have trouble on how to approach the objective can someone assist me please
Replies
18
Views
3,158
Good Morning Everyone, I am entry level PLC programmer and this is going to be my first PLC project at my company. I would like to thank you for...
Replies
13
Views
4,218
Back
Top Bottom