Sign in to follow this  
Followers 0
zblum

Encoder Interrupt Help

4 posts in this topic

Hey guys, I am working on an application that tracks irregularly spaced PET bottles on a conveyor line and then blows them into boxes waiting on the side of the conveyor. I believe I have working logic, but I am having issues with the encoder at operating conveyor speeds.

I believe the best logic for my project is to use a photoeye to detect the presence of a bottle (a one-shot makes sure it is only detected once), and then "store" the "presence" of the bottle in a binary file using an encoder pulse to trigger a BSL function. Using this logic, the bits in the file are analogous to a real, physical location on the conveyor, and I can just monitor specific addresses in the file where my real-world air nozzles are located.

My current problem is that as my conveyor speeds increase, the PLC begins to miss pulses from the encoder. During my initial set-up, I took data at very slow speeds to experimentally determine how many pulses were between the photoeye and each air valve, but when I run at full speed, I only detect about 70% of the pulses detected at slow speeds. Not good. Althought the "skipped pulses" seem to be proportional to the detected pulses at slow speeds.

I am using an encoder that only runs at 60ppr, so I would think that my PLC (MicroLogix 1200) can handle this...I did the math before I purchased the encoder and thought I found the pulses to be infrequent enough that the PLC wouldn't miss any.

My 2 trains of thought:

1) I need to use an interrupt for each encoder pulse since they occur so quickly (utilizing an EII), which I am not fluent in. I can find instructions to intitially configure the EII file, but I am unsure of how you are supposed to correctly set up the ladder logic to utilize the interrupt.

2) There is an electrical issue. The encoder I bought uses pull-up resistors. The resistor value I selected only drops the detected voltage to 14V from 24V. Is it possible that the encoder does not spend enough time in the "off" state at high speeds because of this high voltage value? OR does the usage of a resistor introduce a time-lag into the system which further complicates the issue?

Any help would be appreciated,

Thanks!

Share this post


Link to post
Share on other sites

The scope...PET bottle is seen by a photoeye, PLC sees photoeye one-shot event, capture encoder position counts, PLC logic BSL to trigger an air blowoff nozzle when target encoder counts is measured.

Ideally, for an encoder and to insure scalable accuracy as line speed is varied, the encoder should be wired into high-speed inputs.  Are you using the high-speed inputs?  ML1200, for HSC function can utilize inputs 0-3.  These high-speed inputs map into dedicated a HSC high-speed counter register.

If the encoder is wired into high-speed inputs, are you using the built-in HSC register, or are you using the input registers for encoder position?

Are you using a single-ended encoder or a quadrature encoder?  A quadrature encoder should give you better scalable resolution compared to a single-ended encoder.

Judging by 60 PPR, I suspect you are using a single-ended encoder with low resolution.  Higher resolution and quadrature should give you better accuracy.

Share this post


Link to post
Share on other sites
19 hours ago, kaiser_will said:

The scope...PET bottle is seen by a photoeye, PLC sees photoeye one-shot event, capture encoder position counts, PLC logic BSL to trigger an air blowoff nozzle when target encoder counts is measured.

Ideally, for an encoder and to insure scalable accuracy as line speed is varied, the encoder should be wired into high-speed inputs.  Are you using the high-speed inputs?  ML1200, for HSC function can utilize inputs 0-3.  These high-speed inputs map into dedicated a HSC high-speed counter register.

If the encoder is wired into high-speed inputs, are you using the built-in HSC register, or are you using the input registers for encoder position?

Are you using a single-ended encoder or a quadrature encoder?  A quadrature encoder should give you better scalable resolution compared to a single-ended encoder.

Judging by 60 PPR, I suspect you are using a single-ended encoder with low resolution.  Higher resolution and quadrature should give you better accuracy.

Thanks for your response!

I am, in fact, using the high-speed inputs. I have the input filter set to 25 microseconds and I do NOT have pulse-catching enabled.

I chose a low-pulse encoder to try and avoid this in the first place...however, in regard to your response, I am not using encoder "position", as most would use. I would have to continuously track 20+ "positions" at any given time. It seems like the bit shift is a better option for this. So I am not using the HSC, because I am just looking for individual pulses from the encoder; I am trying to use the EII. I was told the HSC is only useful if you are truly keeping "count", i.e. greater than 1.

The encoder is, in fact, quadrature, with A leading B. I am only working with channel B at the moment.

Another idea I had was by using the HSC, with a high preset of 60, I could use a 360ppr encoder and get the same resolution, while maybe avoiding some of the problems inherent to my method.

If it matters, the encoder I am using is a Red Lion ZOH0060A. It was the only encoder I found with such a low pulse count.

Thanks!

Share this post


Link to post
Share on other sites

I believe the ML-series high-speed inputs utilize mapping the high-speed inputs into the HSC block which acts similar to the SLC-500 "IIM" (Immediate Input with Mask).  Since you are not using the HSC function, you could utilize the IIM function and get the code to respond to encoder pulse train input change.  Refer to page 229.  http://literature.rockwellautomation.com/idc/groups/literature/documents/rm/1762-rm001_-en-p.pdf

The early I/O-based processors (SLC-500, PLC-5, early MicroLogix) read inputs, execute logic, update output table.  The IIM function interrupts the typical scan cycle when the designated input changes per the mask (one can mask out low or high bits to not respond to "noise"), executes that logic, then returns to where it was in the read/execute/update scan.

With IIM functions, create a new ladder for the IIM code, set the ladder reference in the IIM block of the Settings.

Essentially, the high-speed inputs if not utilized through the HSC block does not gain the advantages of high-speed control.  Using a high-speed function, such as the IIM, gets you the fast action you are looking for.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0