PLCs play a major role when it comes to material or package handling operations. Conveyors, motors, drives, object detection sensors and of course controllers are used quite often when it comes to delivering your suitcase to the right airplane or getting the laptop you ordered to the right delivery truck. But how would you go about coding the PLC for a package handling application? Fortunately, I have firsthand experience with these kinds of systems and I’ll show you one way to go about it.
One thing to remember with encoder signals is that the speed of the conveyor belt will determine if high-speed input capability is required. Using the example encoder above, if the conveyor at our facility is run at a speed of 120 ft/m, with 1,000 pulses coming into the PLC every 12 inches, that would be 2,000 pulses per second (trust me it works out ). The PLC might not be able to keep up with these encoder pulses during its normal scan time and therefore would require high-speed input functionality to be sure no pulses were missed. Missed pulses mean the tracking will be off, and if it’s off enough, that could mean a diverter missing a suitcase on its way to the plane or crushing the laptop you just ordered.
For our example, we don’t need a high level of accuracy so for simplicity we are going to use an encoder that provides 1 pulse per every inch of travel. We’ll also need a photoeye, so the PLC knows when a box is present at the start of the conveyor line. We’ll be controlling three diverters and for a little extra, we’ll add a selector switch to determine which chute the package should divert to depending on the day of the week. Once we have all that installed and wired up, we are ready to code.
Getting a Handle on Package Handling
When it comes to programming any device, there are many methods and techniques possible. I am going to use ladder logic for this package handling application. I will utilize a shift register, a FIFO queue, a counter, and a few other elements. Oh, and I will be doing all of this with the FREE Do-more Designer PLC software. This software is very powerful, and the convenient simulator will allow me to testthe logic operation and hopefully prove this
actually works.
The photoeye will determine whether a 1 or a 0 is shifted into the register. When the eye is clear, 0’s will be shifted in and when it’s blocked 1’s will. This creates a group of 1’s, that represent the box, being shifted through the register, which represents the length of the conveyor belt. As soon as the C164 bit has a 1 shifted into it, I know the leading edge of the box has arrived at the middle of Chute 3.
Now when using diverters, it’s important that you do not fire too early on the box since it could be crushed against the side wall or too late since it may just spin and not fall down the chute. You want to aim for the middle of the box. To do that, in the next set of rungs, I’m calculating the middle point of each passing box. The counter in rung 2 will increment the count, while the photoeye is blocked, for each inch the encoder moves. This will count the number of inches needed for the box to completely pass the photoeye or, in other words, it supplies the length of the box in inches.
Once the box clears the photoeye, in rung 3, I then take the length counted and divide it in half to get the middle point. The middle point is stored in D0 and the count is reset for the next box.
In a normal package handling operation, there are many packages being conveyed and diverted. To keep track of the numerous middle points I could have, and to keep them in sequential order, I queue up these values using the FIFO in rung 4. Once each box clears the photoeye, the middle point for that box is loaded in the FIFO queue. Then the next middle point is loaded and so on. The FIFO queue is set up to hold 255 middle points, which for our facility is more than needed for this conveyor line.
On the other side of the FIFO, rung 5 will unload one value from the queue when the leading edge of a box (represented by the first 1 in the shifted group of 1’s mentioned earlier) has reached the register bit that corresponds to the needed diverter. C300 is being used to hold the value of the bit in the shift register that pertains to the correct diverter location. This is done so the selector switch can change the register bit for the required diverter. As mentioned previously, Chute 3’s bit in the shift register is C164. When the leading 1 in the group of 1’s being shifted finally reaches this bit, the middle point value for that box will be unloaded. That value is then decremented once with each encoder pulse to delay the diverter firing until the box moves the correct number of extra inches along the belt. This will make the diverter arm strike the middle of the box as opposed to the front. Rungs 6,7 and 8 will turn on the output to fire each diverter as selected by the selector switch. To do so, the corresponding shift register bit must see a 1 and the middle point value must have been counted down to 0.
the conveyor.
And that’s it! Each package loaded should be diverted to the appropriate chute. As mentioned previously, there are many ways to go about coding an application such as this. The way I did it here is just one of the ways it can be done. Regardless, as you can see, the shift register and FIFO instructions within the Do-more Designer software made quick work out of coding this. Although I did not discuss it much, the project simulator was also a giant help. If you would like more information on the FREE Do-more Designer software or the Do-more BRX PLC, head on over to www.BRXPLC.com.
No comments:
Post a Comment