Tracking Problems with AB Micrologix

10dulkar

Member
Join Date
Apr 2004
Posts
31
I have a machine with a AB Micrologix 1200 PLC which I am trying to write some code for. I cant figure out a good way of doing this. Any help/inputs are appreciated. Here is the problem:

- I have a can filling machine with cans riding on a conveyor feeding back position through an encoder. There is a dispenser and sensor located as in the pic below:

test.JPG

- There are 2 can sizes small & medium. And the plc knows which can size is being fed.

- Based on the sensor trigger (at leading/trailing edge of the can), can size and encoder position I need to fire the dispense pump everytime I see a can.

- The distance between the cans extremely variable and the cans are fed very sporadically.

- The distance between the dispense and the sensor is constant.

Thanks for your inputs in advance!
 
Questions:
In your picture are the cans moving from right to left?
Is there always a minimum spacing between cans?
How fast is the belt/conveyor moving?

Is this an existing application that you are changing or a new installation?
 
Ken,

The cans are moving from the right to the left so the sensor triggers and then I have to track them to the dispense.

There is always a spacing between the cans: minimum one pitch. There is no maximum that can be specified so the cans might or might not be there after one pitch.

Conveyor is moving extremely slow... Dont know the exact speed but say around 5 feet/min of linear travel.

It is a new application from scratch.

Thanks!
 
If you control the rate/time of the dispenser output using the info for can size you said was known by the plc, then just let the sensor/conveyor speed determine when to fire the output.
 
Unfortunately I cant make anymore changes to the hardware i.e. adding/moving sensors. I am restricted to using the only one sensor I have in that position. The good thing (I guess) is that the dispenser is a one shot type. So once I fire the output I dont have to worry about how long to fire it for.

Usually for an indexer I am able to use FFL/FFU function in Micrologix to track the part around but cannot apply it here because of inconsistent positioning.

Thanks.
 
how far away is the sensor? If it's close (within 2"), something simple should work...if the distances are greater, I'm sure others here will have better ways of controlling the timing.
 
Stasis,

Unfortunately the sensor is much further away from the dispense. More than 3 pitches of the small can and about 2 of the medium.

Thanks!
 
Why not use a FIFO based on a timer?

Determine how long it takes for the can to move between the sensor and the dispenser. When the can moves past the sensor, obtain the timers value, add the time required for the can to get to the dispenser, and store in a FIFO. Then when timer's value = stored value open dispenser. If you use a timer then you can stop the timer if the conveyor stops, this way you shouldn't have to reset the line.
 
SWAG answer:
Use flip flop circuit to turn on a "sensed" bit at leading edge, off at trailing edge. You will need to know distance per pulse, and distance from sensor to dispenser. Use indirect addressing and an index pointer, use the "sensed" bit to index the pointer.
When the bit goes high grab the current encoder value and do a compare on the current valve until the value is within tolerance, then fire the dispenser. Your going to need a lot of error handling, and so forth.

This by no means is the answer just doing a little on line brain storming. Something I mentioned might get you or someone else down the right path.
 
Can you determine how many encoder pulses you will get between when a can is first picked up and when it will be under the nozzle? Lets call this value A. You will also need to know how many encoder pulses wide the can is, Lets call this value B.



I would probably set up a FIFO which is large enough that it can accommodate the max possible cans on the belt. As soon as a can is detected under the right sensor place the value A in the Fifo. Now you need to continuously decrement this value as the conveyor moves. When the last value in the FIFO reaches zero, then fill. Fill duration cannot continue past the can width. As soon as a can is filled, then unload that value from the FIFO, shifting all the values forward. Every entry in the FIFO needs to be decremented. Alternatively, you could snapshot the current conveyor position, add to it the value of A, and stick that in the FIFO, and when the conveyor encoder equals the value at the top of the FIFO then start filling. Depending on how your system is set up and software already structured, that might be easier.


Assuming that there are 10,000 pulses between the sensor and the nozzle, the FIFO could look something like this.

FIFO.JPG


Starting with the top, only one value is in the FIFO - after a time it has decremented to 9000, and then 8,000 at which time a new part is detected, so now there are two entries in the FIFO. After a while a third part is detected, but eventually the left number in the FIFO continuously decrements till it reaches zero, at which point you know a can is under the nozzle. Once its filled, unload the left value from the FIFO, which will shift everything to the left.

This is only an idea, lots of details would need to be solved.
 
Last edited:
10dulkar,

This is a classic problem, and appears in many PLC textbooks as a "Bottle Fill Line". You have all the conditions: encoder on a conveyor, varying speed and position of containers, a container sensor, and a filling device. The textbook solution is to use Bit Shift Registers.

The Bit Shift Register becomes an indicator of the physical position of each can on the conveyor. If a Small or Medium can is present at the sensor position, then a "1" is entered into the appropriate BSR. If you need to know whether the can is Small or Medium, then you can ADD your own rungs to measure the width of the cans by counting the number of encoder pulses that occur for Medium-sized cans while the sensor is "on". Then change the Sensor Input bits I:1/7 and I:1/8 to be your new calculated Small & Medium inputs. This way you are not limited by the speed of the conveyor.

You can watch the "1" move through the Shift Register each time the encoder pulses by looking at the Data Tables for words B3:4 and B3:6. The advantages are that it doesn't matter how fast the conveyor runs, or how evenly the cans are spaced, as long as your sensor can detect the cans and your encoder is accurate for the speeds being used.

I have edited an old classroom example. Maybe this will get you in the ballpark. There are some things you will have to add on your own. You will have to determine the ratio of your encoder output versus physical distance traveled. Then adjust the B3:4 and B3:6 trigger bits (and the "Length" setting of each BSR if it is more than 10 encoder pulses between the sensor and the dispenser). Also, there are only 16 bits per word, so it if is more than 16 encoder pulses between sensor and dispenser, you will need to set the length to, say 32, and let the BSR wrap over into the next "word". For example, the Small Can BSR would wrap to word B3:5, and your Dispense position bit would then be somewhere like B3:5/12. There was not enough room to show the "Initialize" subroutine to clear the variables to 0 at startup.
CAN_FILL.JPG
 
Last edited:
Thanks for the inputs guys!

Here are some thoughts:

- I will try Alaric's and Lancie1's programs.

- There will be quite a bit of encoder pulses between 2 positions at the current resolution of the encoder. I'll try to lower the resolution to make Lancie1's program work.

- Ken's post will actually help me make sure that if I dont see triggers at both edges I dont have to dispense.

- Thomas I actually had been using 'pitch' incorrectly. I was referring to the width of the can.

I just heard this morning that the conveyor from the vendor is delayed by a week :). I will have some time to test these things out. Will update on what happens.

Thanks again!!!
 
I am waiting to see the level of success.

Lancie, as configures the width? Is bits in 2 byte? No, automatic adjust it fix. Type:
Is "0001 1111 1111 1000" large
Is "0000 0111 1110 0000" small
 

Similar Topics

I am attempting to reject a bottle If the label fails. The rejection works fine at normal line speed but at low speed the rejector fires (air...
Replies
35
Views
1,121
Is it possible to gather OPC data through a 1783-NATR? Searching around, it sounds like OPC data might be blocked by any NAT... Is there any work...
Replies
2
Views
241
Hi All. I have a very specific question about tracking using an encoder and bitshift register. We would like to use a Compact or Control Logix PLC...
Replies
40
Views
1,695
Hello, I have a servo motor running a conveyor belt system. I do not have the exact circumference of the head pully and therefore I get some...
Replies
5
Views
1,380
Hello I'm currently using a guard logix L7 processor, studio 5000 v34. Our existing machine uses nest tracking for history of each part cycled...
Replies
1
Views
767
Back
Top Bottom