Closed loop with steppers

More
16 Feb 2018 18:23 #106033 by Pasteur
Hello everybody.

I'm a little new in LinuxCNC , and I wanna make a simple question.

How could I implement a closed loop for a stepper motor in LinuxCNC?

I'm gonna to do the most clear that I can to explain my problem.

I have a machine that have different backlash in different points. I have a very precise rulers that can measure the position of the tool and I want to connect this rulers to LinuxCNC (I guess that is possible with HAL) and correct the trajectory in real time creating the closed loop.The trajectory correction , I guess in this case, is only add more pulses to the motor if the tool not reach the indicated position by G-Code. I understand that in theory is simple and I read that is possible but I don't know how that is possible.
I read, also , that is possible using a PID but I don't know if it is real or no.

Beyond my previous question , I want to know if this is implemented in LinuxCNC or I must design a HAL component to do it possible.

Thanks!

Please Log in or Create an account to join the conversation.

More
16 Feb 2018 18:53 #106037 by Todd Zuercher
You would do it using a PID loop, but be careful step motors do not always respond well to this. (it can lead to stalling)

The problem being if the pid is detecting a stall, it will command the stepper to move faster to catch up which will insure that it will stall, the opposite of what is needed to prevent a stepper from stalling.

Please Log in or Create an account to join the conversation.

More
27 Feb 2018 19:35 #106651 by Pasteur
Replied by Pasteur on topic Closed loop with steppers
Ok thanks Todd , but after I researched in many sites I reach at the conclusion that I must write a HAL component because the PID will cause problems, but first I need understand how PID is configured in HAL file I guess. Basically I guess I need a very good example of PID configuration , I write to you because the linuxcnc's forum is large and maybe you know about a very good one configuration example .
My first doubt is how configure the 'feedback' in HAL with PID. If I know that, I guess that I can start with some tests

I will apreciate your answer.

Bye!

Please Log in or Create an account to join the conversation.

More
27 Feb 2018 20:20 #106658 by raglanlittlejohn
Heres a schematic I did (one axis shown only), with a couple of other contributers links. I don't think you need a new component. I use 2000 ppr encoders in quadrature with index. It's useful for keeping track of true position, and homing.

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:
The following user(s) said Thank You: tivoi

Please Log in or Create an account to join the conversation.

More
05 Mar 2018 21:19 #106975 by andypugh
Replied by andypugh on topic Closed loop with steppers
You should be able to do it with PID without too many problems.

The trick is to set the step-generators to velocity mode, and then the PID component requests a speed of movement required to keep the error low.

You shouldn't need a special HAL component.

But you probably will need to tune the PID loop, just as you would with a velocity-mode servo,

Please Log in or Create an account to join the conversation.

Time to create page: 0.072 seconds
Powered by Kunena Forum