rjjong1 (Customer) asked a question.

How can I synchronize a line scan camera with my rotary encoder using a Productiviy 2000 PLC with a HSI and HSO module

I have set up my HSI module to count pulses of my encoder with quadrature (x4). (20 counts = 1mm). So now I want to trigger my line scan camera every count so that it is synchronized with my encoder. But there is a second challenge which makes this task more difficult. I don’t want to trigger my camera when my direction is backwards and only want to resume triggering when the same position was reached before it went back.

 

So for instance, when my encoder counts 5000mm and therefor my line scan camera triggers 5000 times as well. Now the encoder counts 1000mm in the opposite direction, making the total traveled distance 4000mm. The line scan camera does not trigger when moving backwards. Then the encoder again moves in the forward direction, reaching 8000mm and then stops. The camera only resumes triggering when it reached 5000mm and onwards until the machine stops at 8000mm (meaning that it skipped the 4000mm-5000mm when it traveled backwards).

 

I have trigger my camera like this, so I don't get duplicant images during operation.

 

Does anyone have any suggestion or idea on how I can synchronize my line scan camera like this?

 


  • Adisharr (Customer)

    Out of curiosity, what vision system are you using? I know some support an accumulating count function natively already.

     

    Also, what's your pulse frequency and can you handle an additional pulse or two or missing a few?

    • rjjong1 (Customer)

      We will be using two cameras. I have not yet deciced on what line scan camera I will be using. But for reference we use a Basler ral2048-48gm for our testing.

       

      The encoder generates 5000 pulses per meter. The max velocity is 3 m/s, so the encoder will generate 15000 pulses max. The linescan camera needs to trigger at that frequency but with quadrature (x4) to get a higher resolution so max 60kHz.

       

      The encoder only has the A and B channel wired on the HSI module. Both GP inputs on the HSI are used to signal a defect in the inspected material by the two cameras. The four GP outputs are used for a label applicator and for timing a flashlight for the camera but these are optional.

       

      On the HSO I want the two cameras to be triggered in sync with the encoder and no other ports are connected (for now).

      Expand Post
  • PouchesInc (Customer)

    I honestly don't know if you will be able to do it in Productivity. I am trying to think of everything I know and it all comes back to only being able to do it in ladder logic which would not work due to scan time.

     

    MAYBE you could do it on a BRX, using some sort of AXFOLLOW or some instruction like that to follow the encoder pulses exactly, and using interrupts to start the axis going again when you get to the right count in the forward direction. That would be the only way I can think of to get it down to the exactness this would need and not hindered by ladder scan time and variance.

     

    If you want your PLC program to be on a Productivity controller, you could always use an 18 IO point BRX and do the line camera on that and then send/receive data back to Productivity over EtherNet/IP

    Expand Post
    • rjjong1 (Customer)

      We used to have a Siemens PLC for our machines, but we are looking for cheaper options, and the Productivity 2000 fits all our specs.

       

      I've looked at the BRX but it lacked the memory we need.

       

      I don't want to use both PLCs in one machine because that would further increase the cost.

      Expand Post
  • rjjong1 (Customer)

    Maybe I need to devide the problem in smaller steps in order to find a solution.

    How can I program the HSI and the HSO module so that the camera in sync with the encoder? Preferably four times as fast using quadrature (x4).

  • z28z34man (Customer)

    is it possible to use an encoder splitter and give the cameras the raw encoder and have an enable disable output in the PLC maybe using a programmable limit switch instruction?

  • rjjong1 (Customer)

    Yes I need to try that, but then I'm not using quadrature times four. So I would need a faster encoder.

  • z28z34man (Customer)

    I could be completely mistaken but I have seen an encoder splitter that allows a not channel output from an encoder that does not have the not channels. I do not know if this will help in your situation

     

    https://www.motrona.com/en/products/signal-converters/level-converters-signal-splitters.html

     

    on page 6 of this manual it says that it will automatically add the inverted channels even if they don't exist on the input encoder

    https://www.motrona.com/fileadmin/files/bedienungsanleitungen/Gv210_e.pdf

    Expand Post
  • PouchesInc (Customer)

    If you use an HSO to trigger the output pulses to your camera and flash strobe, the only way you can turn on the outputs of the HSO are with a ladder instruction as far as I know. As Productivity has no interrupt capability, that means you will have variance introduced by the scan time of the ladder logic.

    If you simply left a velocity move instruction active to constantly follow the encoder it would work until you moved backwards, and then that would throw stuff off since you don't want any pulses when travelling backwards and then until you got to the forward count position again.

     

    You may be able to work around this problem by having the machine only able to move forward again at "jog/creep speed" until it finds the exact position it had previously stopped moving forward. Do a short stop and confirm everything is aligned to the exact count once again, and then resume normal forward run speed.

     

    The lack of interrupts is the #1 complaint I have always had with the PLC line. I was told that the CPU doesn't have interrupt pins exposed how the hardware is designed, so there is no chance we will ever get interrupts down the line either. The only way to get them would be for a new CPU to be released with the hardware capability for it.

     

     

     

     

    If you were to do this on a BRX, all you would have to do is set a variable "tag" to one of the match register locations. Have an AXFOLLOW instruction keeping your pulse output at 4:1 ratio of the encoder input and it will follow it exactly. When the machine moves in the reverse, break power to the AXFOLLOW rung and copy the position to the match register tag. When you move forward again, when the match register is equal to the position again, an interrupt runs to immediately turn on the AXFOLLOW again. Simple.

    Expand Post