Compactlogix encoder tracking on conveyor Help needed

tmath820

Member
Join Date
Dec 2015
Location
Illinois
Posts
9
Hi Guys,
Been years since I have done this stuff. I am struggling with the tracking/encoder and marrying the camera result data to the encoder count/ package location.
Here is the application.
Compactlogix 1769-L18ER-BB1B using 1734-vhsc counter module.
System has two cameras mounted on conveyor about 24" apart.
A single photo eye at entrance to zone starts the whole thing off.
I need to take the photo eye input and count X ticks before turning on camera 1.
The result from camera 1 (pass=1/fail=0) is then put into shift register...or should I use a fifo?
Then Y (24") ticks down the line turn on camera 2. Again pass-fail.
Then a reject device is z ticks(12") down the line needs to fire based on the pass fail of both cameras.
There will be multiple packages on the conveyor(6-10) at any time between entrance sensor and reject.

So I have a hacked up mess in the program and can't figure out the right way to do this. The 1734 counter module is a project in itself to me with all of the tags in it.
If anybody could provide some samples of both tracking the package pass/fail and firing the cameras based on encoder count and tracking the pass fail through the system I would greatly appreciate it!
Thanks
 
I use a counter that rolls over to create a "tracking number" for each item, the counter needs to count high enough that you won't run out of tracking numbers for the amount of space you have on the conveyor. When an item blocks your induct eye the tracking number is entered into an an array of DINTs that is shifted by the encoder pulses. The next item increments the tracking number generating counter and so on, until you have to deal with rolling it over. The "tracking number" is then used as the index to enter or lookup data in a "lookup table". In your case the lookup table could be an array of length equal to your max tracking number of UDT's, the UDT could contain bools for Cam1, and Cam2. For example you know camera one is 124 pulses from the induct eye. You get a fail result from Cam1 so you look at myShiftRegister[124] and see that it has a value of 34 (tracking number), so Cam1_PackageID:=34;. You then update the data in your LookUp table, LookUpTable[Cam1_PackageID].Cam1 :=1; When you get to your decision point, pull the PackageID from the shift register, evaluate the data in the lookup table and determine the correct action.

I've never used a VHSC for the pulse input, usually the resolution isn't that important on the stuff I do, and the encoder is chosen so that the time between pulses will be at least 2x the length between program scans and IO update rates. If you actually need the VHSC you're going to see multiple pulses between IO updates and you'll have to figure out how to fill data into the shift register appropriately, and how to shift it multiple positions at a time without jumping past items (so really, the resolution at which you can act is still limited by scan time and IO update speed).

Another interesting thing about the new L1 compactlogix, the onboard inputs can be used to trigger an Event Task, something you used to have to buy a controllogix for, might allow you to avoid the VHSC (I believe it counts as a "specialty" module and will drive your IO update times up by 20ms)
See this post for info about L1 IO update rates:
http://www.plctalk.net/qanda/showpost.php?p=466904&postcount=14
 
thank cleeton. The counter was something I never thought about. This is way more complicated than I thought it would be. At least for a guy that doesn't do this as his main job. I will stare at it and see what I can implement.
Thanks for the help
 
Tmath:
One question, why are you using counting to trigger second camera.
I would use another photo eye to trigger second camera and use HSC counter to pass/reject actions.
Definitively i would also use tracking as mentiones by Cleeton.
 
Still not sure what I am doing. I am currently stuck on why BSL loads array10 as expected but when watching the array the response does not directly match the trigger and data that should be shifted in. For example on every trigger I should see a 1 or 0 and then watch them bump down. However it seems like it takes two triggers to get the array to shift.For some reason it appears to lag. If the array is loaded shouldnt .0 always be loaded first?
The problem is not electrical but something I don't get about the BSL.
Anybody with sample code would be greatly appreciated.
Thanks
 
How many items can be located between the two cameras. Normally I would use a FIFO with a number of elements bigger than the maximum number of items between the cameras, if item XXX fail on camera 1 and item XXX fail on camera 2 the item is rejected. Crate and udt that includes tracking number, pass/fail on camera1, pass/fail on camera 2.
 
# of items in queue depends on product size. but less than 10 from start to reject. I decided on BSL over fifo after reading the forums since I don't have to unload the fifo as everyone says. So I think it is simpler. I am not advanced at all with this so some of what you guys say goes right over my head. I have the pass fail results loaded into the arrays. Now I have to figure out how to marry them together and then figure out the encoder.
It seems like most take the encoder value at trigger and then add or subtract for distance to reject. Then compare values and if = fire the output. Simple enough with 1 product in queue but with 5 to 10 seems like there I will have to use fifo?
 
If number of items is maximum 10 then your fifo should be 11 or more.
Be careful on how many items can be located between camera 2 and reject/pass station if more than one element then you need to keep on using the same BSL of same fifo. In this case fifo number of elements has to be bigger that max number of items between camera 1 and pass/fail station.
You must load fifo at photo eye on camera one unload fifo at pass/fail station.
 
For example on every trigger I should see a 1 or 0 and then watch them bump down. However it seems like it takes two triggers to get the array to shift. For some reason it appears to lag. If the array is loaded shouldnt .0 always be loaded first?

Could it be that the BSL trigger is staying on too long? Maybe try inserting a one-shot in front of the BSL.

For your consideration: Use three BSL instructions. First one tracks the presence of an item. When this bit reaches a specified point use it to trigger/read the scanner_1 decision. Second BSL inserts scanner_1 read status into #2 register parallel with the tracking bit. Third BSL does for scanner_2 as the second does for scanner_1. At the reject point you can use either or both of the scanner BSLs to activate the diverter.

YMMV
 
Hi

I use a udt with a number of bits
_active
_partfailcam1
_partPasscam1
_partfailcam2
_partPasscam2
_timetriggerdelay
_timerejectnoresult
_cam1distance
_cam1lowerlimit
_cam1upperlomit
_cam2distance
_cam2lowerlimit
_can2upperdistance


I then use a sensor to trigger the part is in place, I then add the distance to the current encoder position and place the result in _cam1distance.I would then subtract a set value from the to give me a target lower position and add the same set value to give me a target upper position.
I also always mark the part as bad and only a good signal from the camera makes it good.
I use a cop instruction to copy an array of the udt then based on encoder position
I have only ever used this for 1 camera but it could do the 2 no problem
I must stress to always mark the part as bad first just to be safe

Donnchadh
 
Trying to work on the encoder trigger position. I am using the present postion and adding 500 to it for my trigger position. Then tried using a greater than or equal to set the trigger output. As you probably know this then triggers all the time once the present count exceeds the calculated trigger position. So I tried OSR and it doesnt like that. Now I am looking at the LIM function but concerned that I will still miss triggering in the range. The encoder I am using is 500ppr or 500 pulses every 6 inches. My trigger needs to be within a half inch or 40-50 pulses. Stuck again.
Thanks for the help guys
 
Hi

The lim instruction should work ,but you could also latch a bit when the sensor is triggered. I use the _active but fur this reason, the grt instruction then can trigger the camera and unlatch the _active bit which you can use as an interlock
To stop the camera from been triggered

Donnchadh
 
First question...So I can load a shift register with the status bits I get from the camera but I cant get it to load into a FFL. The problem is the data types. I get an argument error when creating the fifo. The camera data type is SINT484. The value it gives for pass or fail is a 1 or a 0. I dont know how to get the fifo to take the source data type of SINT484. If I pint the fifo to the BSL register for the source I have no problem BOOL and BOOL. What am I doing wrong here?

Second question is...I have 3 cameras and 1 reject. 2 cameras are in the same location so I can pair them together easily in a fifo or with BSL. The third camera is down stream and I need to pair its results with the first two and then when the product gets to the reject point decide reject or not. If I was certain of the number of products between the two cameras it seems like BSR with length of 5 for the first cameras and BSR with length of 3 for the last cameras would work. When the .0 bit was updated in each I could check and decide pass or reject but I would have to always have the same number of product between the first two cameras and the last so it does nt seem like the solution
What is the best way to do this? BSL -BSR-FIFO-FAL??

Third question is...I am using S:FS to start a heartbeat with a PC when the system starts. What do I use to check the number pulses from the encoder that happen each scan?
I want to use the reset function of the 1734-VHSC and keep adding to each fifo position so I know when the product is in place at the cameras and reject. So I need to know how to get the pulses each scan.

I appreciate the help you guys have given. Sorry for the stupid questions and lack of understanding.
 
First question...So I can load a shift register with the status bits I get from the camera but I cant get it to load into a FFL. The problem is the data types.
Not sure why you'd want to do this. Do you need more than the simple pass/fail condition from the scanner?

If I was certain of the number of products between the two cameras it seems like BSR with length of 5 for the first cameras and BSR with length of 3 for the last cameras would work. When the .0 bit was updated in each I could check and decide pass or reject but I would have to always have the same number of product between the first two cameras and the last so it does not seem like the solution
Make all of the BSLs, however many you've got, the same length. By experimentation determine where the 'inject point' for each scanner corresponds to a particular BSL bit. Do the same for the reject station.

Say scanner 1, and therefore the item it just scanned, aligns with s.r. stage 29. Don't send this status into the s.r. via the BSL, at bit zero. Rather, set up the logic to turn on bit 28 in the s.r. Use a one-shot or you might get multiple ones going through the register.

In the same way determine by experiment (you should be able to get pretty close by calculation) where the second scanner and the reject point correspond to shift register bits. Monitor the bit corresponding to the reject for a status of 1 and actuate the diverter when it's seen.
 

Similar Topics

Hello PLCs.net! I have a sliding table controlled by a servo. The coupling on this servo is not reliable and we need to reteach the positions the...
Replies
11
Views
4,464
I'll set the scene a little before I explain the issue that I am having. I have an application where I have a Linear Servo Slide acting as a...
Replies
17
Views
7,657
Does anyone know of a way to use CAN Bus encoders on a Compact Logix system.
Replies
5
Views
4,559
I have a 1769-L18ER CompactLogix processor running Firmware 20.12 and I am trying to add a connection to an Allen Bradley 842E-MIP Encoder. I have...
Replies
1
Views
3,798
I have the choice between a TTL pulse train and 1 Vpp versions - which would be easier to integrate with the AB 1769? I know there is a 5V TTL...
Replies
6
Views
2,807
Back
Top Bottom