Precise material cutter

The problem was described in owen.ru forum.

Here’s the problem:

  1. The motor shaft of the material transport is connected to the encoder that has resolution of 500 pulses / rev
  2. The maximum engine speed is 3000 rev / min (typically about 2000 / min)
  3. The time to supply the desired amount of material is near 0.4..0.6 seconds
  4. The motor has low inertia, so the stop occurs almost instantly.

The task is to count the required number of pulses and stop the motor.

As described above the counter should be reliable up to 30 kHz.

If you have Hardella IDE opened, you can either open code sample in the IDE, or you can create a new project with this code (File > New > Project > Material cutter).

Solution

Let’s create a enumeration for the system state (in order to do that you need to right-click, then select New > c.g.v.iec66131.types > type alias):

Enum for the system state

Then we need to create a ST logic:

The logic of the cutter

It is more or less clear: it performs one or the another action depending on the current state.

If the movement is complete (that is current state is STOP), then it waits for the enable to become FALSE.

In the initial state INIT it waits for the setup of run length (runLength), then it waits for the start flag (enable)

During the run, it counts the run length into offset variable and stops as the required run length is achieved.

PRU program

PRU program is just 3 lines long:

  1. The first line calls ABZ encoder to get its position
  2. The second line calls the cutter logic. It uses the value of 4th input for the cntr argument
  3. The motor is controlled via fast output 3 (out3), and the value comes from the cutter logic (cutter.out)

Updated:

Leave a Comment