KincoBuilder Continuously Update Position

Hello everyone,

I'm quite new to PLC programming and got myself a Kinco MK070E-33DT PLC/HMI combo. I'm trying to setup absolute positioning of a servo by pulse train output, based on analog joystick input. Trying to use PABS instruction but it only executes once on EXEC rising edge.

Could someone explain how I would set it up to continuously position the servo based on current joystick position? For example, if joystick goes full left for a few ms (unintentional user movement), the PLC would try to move there but if position changes before completing, only go to last commanded position. I hope this description is clear and you reading understand my needs. I believe this is a quite common usecase so there should be a way to set it up. 1749296950143.png
 
It sounds like you only want to "send*" a new value when it is different from the previous value by some small amount and continuously for a fixed time, is that correct? So the behavior could be called analog debounce logic (see here for discrete debounce logic pattern).

* whatever that means
 
Thank you for the reply! Sorry if I got some terminology wrong, this is my first week dealing with PLCs. I come from web development background, this is for my personal project. Perhaps if I explain the project in more detail that would make it clearer but you get the idea.

I'm building a system that will be placed in a trail buggy or similar vehicle to allow control by 2 axis analog joystick for a disabled person with limited arm movement. 2 servo motors (Stepperonline dsy 200rs) driven by pulse train outputs for vehicle control - first to move the steering wheel, second to actuate brake and accelerator by push pull rods. The PLC should read the analog input positions, apply some functions to calculate commanded position and movement speed(like depending on vehicle speed etc.). Then of course calibration and safety feature sequences will need to be implemented.

So for now I need a simple proof of concept that position of servos can be actively controlled by joystick input. At first I did consider using a raspberry Pi but decided a PLC would be more reliable and it's a good challenge to learn a different technology.
 
Okay, my question was about this:
For example, if joystick goes full left for a few ms (unintentional user movement), the PLC would try to move there but if position changes before completing, only go to last commanded position.
My interpretation was that you were trying to avoid following "unintentional" user input movement, where "unintentional" was measured/detected by input device (joystick) movement that is not persistent i.e. is corrected soon after it is initially detected.

But now that we know more about the application, it sounds like you want to continuously pass any changes in the input device (joystick) to the output device(s).

I don't know much about that particular PLC, but perhaps output %Q0.0 from the PABS instruciton is a PWM signal?

So the point is that you want the PABS to Modulate the Pulse Width of %Q0.0 as the analog input signal value Joystick_Y_GLO... changes, and to do that you need PABS to "see" a rising edge of its input rung, so something like this might work? There is a slight problem in that it will not generate a rising edge if the analog input value changes on every scan cycle, but that could be handled by slightly more nuanced logic.

1749311064974.png
 
P.S. the [<>] block is a comparison block that puts a True value on its output rung when the two values are NOT EQUAL i.e. are different. The two rungs together are an analog edge detector of sorts.
 
With this PLC the the ENO in example does nothing. I can just as well have NULL. The EN is to just make instruction enabled, I should set it to some variable like System_en. What actually controls the pulse train and dir is AXIS. There's two - 0 uses q0.0/q0.2 for pulse/dir, 1 is q0.1/0.3. EXEC is used to start movement.

I'm not sure but maybe some interrupt function could be used to command an absolute position on every cycle, cancelling previous position and immediately commanding a new position.


1749311860325.png

1749312007298.png
 
This seems to be the page in the manual where the Kinco-KW high-speed output is described. The English syntax and grammar is not very clear, but it appears to me that the PABS instruction, in concert with the other positioning control instructions, sends some number of pulses to the output starting at the rising edge of the EXEC discrete input signal i.e. PABS is for controlling a stepper(or servo?) motor with PTO, not for controlling a servomotor with PWM.

If the motors to be controlled are (i) servomotors, and (ii) are to be controlled via PWM, then the PLS instruction (page 66 here) is what should be used.
 
There are also servo drives that take a PTO input signal and convert it to a PWM output signal that is passed to a servomotor, e.g. see this ancient thead, so that makes it seem that a servomotor is controlled by a PTO signal, but it is the servo drive in between the PTO signal and the servo motor that essentially turns the servo motor into a system somewhat similar to a stepper motor.

We need to know how OP's motors are actually controlled, i.e. whether a PTO or a PWM output signal from the PLC is required.

This is not my specialty, so someone please step in if I am going astray!
 
The DSY Servies servo uses pulse train, not PWM. Positioning works as expected but only once on EXEC rising edge, the motor spins exactly the steps given.

Here's the servo motor shop page and documentation.
Okay, then that is a servo motor+driver system (see the image below, extracted from that shop page). From the other documentation, it appears that a move can be cancelled, and further movement prevented, with the PSTOP instruction, which also sets the value of the ESTOP flag (SMD201.7/SMD231.7) to 1. The user program can then write a 0 to that bit to re-enable movement.

So, to get back to the original post:
Could someone explain how I would set it up to continuously position the servo based on current joystick position? For example, if joystick goes full left for a few ms (unintentional user movement), the PLC would try to move there but if position changes before completing, only go to last commanded position.
It looks like, what needs to happen when the joystick moves and a new position command is desired*, is to implement the following sequence:
  1. the PSTOP instruction is triggered,
  2. then the ESTOP flag should reset by the program to a value of 0, and
    1. the value of the EXEC bit to PABS also should be reset by the program to 0, and
  3. then update the PABS POS parameter (target value), and
  4. then set the value of the EXEC bit to 1 to trigger the new move.
How to determine how much of a joystick move triggers the need for a new position command is OP's bailiwick so that logic is TBD; perhaps a non-zero-width deadband around the last commanded joystick-driven POSition could be implemented while a command is active. That deadband could be reduced to zero when the DONE output bit value of the PABS command becomes 1, to allow smaller subsequent adjustments to be including without continuously issuing ESTOP/PSTOP commands.

The overall PLC program could be a state machine, where each state will follow a particular sequence, and the transitions between states compose a meta-sequence around the individual per-state sequences. There would be a few primary states, mirroring the model from the manual (second image below):
  • Standstill
    • EXEC bit value is 0
    • Write new PABS POS value in this state
  • Discrete Motion
    • PABS command is active
      • EXEC bit value transition for 0 (Standstill) to 1
    • DONE and ERR bit values are still 0
    • transition to Standstill when DONE bit value changes to 1
    • transition to Stopped ESTOP flag value changes to 1
      • As driven there by PSTOP instruction
        • and PSTOP instruction is triggered
          • if new joystick command is needed
            • as determined by some TBD logic
  • Stopped
    • ESTOP flag value is 1
    • transition to Standstill when ESTOP flag value is reset to 0
  • Error?
    • response to PABS ERR bit value becoming 1
    • Logic and transitions TBD
  • Homing?
    • TBD?

1749401854229.png

1749403044332.png
 
Thank you for this suggestion. I took this advice and implemented the 3 states with transitions. The servo now follows joystick commands perfectly, allowing for live control smoothly and responsively. I'll need to refactor and implement scaling, calibration, emergency sequences but it seems the biggest issue is solved. Here's the LD screenshot of my implementation:
1749546010081.png
 

Similar Topics

Hello everyone, I have a problem with an S7-300 system and would appreciate some help. I have two S7-300 PLCs communicating via Profinet. One for...
1
Replies
211
Views
I'm working on a system with three Panelview 7's connected in a DLR. The system started having miscellaneous DLR faults and they were supposedly...
1
Replies
1,090
Views
Hi everyone. Been banging my head against a wall trying to figure out tracking on a servo driven conveyor. I already have a tracking array setup...
12
Replies
5,487
Views
I have established communication with a sensor via ASCII protocol using the Micro-850 PLC. I have a program which writes to the sensor using an...
2
Replies
2,502
Views
Are they serious ? Replacing, every few months, a shaft seal on a Servomotor ! Shaft Seal Kits...
2
Replies
3,080
Views
Top