Spindle Control through EMC2

More
23 Aug 2010 23:37 #3858 by Peter_Cassar
I've been googling on the Subject of Spindle Control through EMC2 and yet have not found anything concrete on the subject.

I believe that EMC2 can output a PWM signal to control spindle speed. What about direction? And what about step and direction control as supported in TurboCNC? I'd like to know if EMC2 can do step and direction for spindle speed control. Can someone confirm this for me please.

Also on the subject of spindle encoders. I have read in places that EMC2 can use a simple 1 pulser per revolution signal. I've also read that it can accept quadrature encoded signals. Which is better?

I would appreciate some advice on these questions as I'm in the process of deciding on harwdware for a lathe conversion.

Cheers,
Peter.

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

More
24 Aug 2010 06:25 - 24 Aug 2010 06:36 #3860 by ulda
Maybe this emc wiki entry will help:
wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Clo...pindle_Speed_Control

also see the sample code for lathe-pluto
...and the emc integrators manual section 71:

motion.spindle-brake OUT bit TRUE when the spindle brake should be applied
motion.spindle-forward OUT bit TRUE when the spindle should rotate forward
motion.spindle-reverse OUT bit TRUE when the spindle should rotate backward
motion.spindle-on OUT bit TRUE when spindle should rotate
motion.spindle-speed-out OUT float Desired spindle speed in rotations per minute
motion.spindle-index-enable I/O bit For correct operation of spindle synchronized moves, this
signal must be hooked to the index-enable pin of the spindle encoder.
motion.spindle-revs IN float For correct operation of spindle synchronized moves, this signal must
be hooked to the position pin of the spindle encoder.

What encoder you need is a question of what machine you have: if you need spindle syncronized motion (a lathe doing threading) an encoder is better, else you only need speed signal.


/ulda
Last edit: 24 Aug 2010 06:36 by ulda.

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

More
24 Aug 2010 16:22 #3862 by andypugh
Peter_Cassar wrote:

I believe that EMC2 can output a PWM signal to control spindle speed. What about direction?

There are spindle-cw and spindle-ccw pins that can be directed to output pins (parallel port or DIO card).

And what about step and direction control as supported in TurboCNC? I'd like to know if EMC2 can do step and direction for spindle speed control

Yes, no problem. You would connect the spindle speed to a velocity-mode stepgen component in HAL and then take the output pins of that to physical output pins.
HAL is the EMC "HArdware Abstraction Layer" which allows you to connect all the inputs and outputs of the various parts of EMC together in almost any way you choose, optionally through intemediate processing and logic blocks. This is all done in a configuration file, and lines like
net spindle-cmd motion.spindle-speed-out => stepgen.4.velocity-cmd
means that the current spindle speed demand is passed to a step generation function. (which in turn has output pins that are linked to physical IO using similar lines).
For most configurations this file can be created by the stepconf (or pncconf) wizard. For a step-dir spindle you would need to hand-edit as it is a non-typical configuration.
You can do almost anything in HAL, and when you find something you can't do then it is surprisingly easy to create a custom HAL component that does do what you want. Most things already exist though, there is a full list of them beginning half way down this page:
www.linuxcnc.org/docview/html/

Also on the subject of spindle encoders. I have read in places that EMC2 can use a simple 1 pulser per revolution signal. I've also read that it can accept quadrature encoded signals. Which is better?

You need one pulse per rev anyway for spindle index. Quadrature adds finer resolution and better feedback, which is good for spindle-coordinated motion like rigid tapping, lathe threading or even elaborate things like cam-turning:

I would appreciate some advice on these questions as I'm in the process of deciding on harwdware for a lathe conversion. .

You might want to think about making your own spindle encoder. The problem being that lathes have large through-bores and encoders typically don't.
Otherwise plan to run the encoder from a toothed belt on the spindle.
If there is a handy gear fixed to the spindle then a pair of proximity sensors an integer number of pitches + 0.5 apart will give you the quadrature signal, and the index can be from any convenient feature.
If the lathe is fairly heavy, such that spindle speed varies little during a threading pass then you can start with just a 1ppr encoder and see how it goes.
The first encoder I had was made with a laser printer, stripes and an index wrapped round the spindle tube. It actually worked fairly well, but started to peel off and was replaced by an aluminium disc on the drive pulley with slitting-saw slots in it.
A Parallel port has enough pins for a stepper-based lathe, and you probably won't run out of speed with software step generation on the axes. You might find that you run out of step rate with a step-direction spindle drive though. You also need to look carefully at the spindle encoder resolution and the base thread rate of your PC if you are going to use software encoder counters.

There is a wide range of external/internal hardware that can be used for step / pwm / encoder / motor driving etc. If you are thinking along those lines than perhaps start a new thread asking for advice. All I will say at this point is that a Mesa 7i43 is $80 and converts your P-Port into a 48 channel IO device with enormously faster PWM, stepgen and encoder counters. Other hardware and suppliers exist, though and might have hardware better suited to your needs.

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

More
25 Aug 2010 10:21 #3867 by Peter_Cassar
Andy, I've replied to your post but haven't seen it come through after 6 hours or so, I'll try again. Thanks again for the info. I'm impressed by the video of eccentric turing. I'm wondering now if 100CPR is adequate to achieve enough resolution. I've had a look at the US Digital rotary encoders and I might end up with a 400CPR wheel and HEDS unit, alternatively I'll make up a 100 slot disk with IR sensors.
Cheers,
Peter.

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

More
25 Aug 2010 13:04 #3870 by andypugh
Peter_Cassar wrote:

I'm wondering now if 100CPR is adequate to achieve enough resolution.

The video is done with a 100-slot (400 edge-count) encoder ring.
If you run a 20uS base thread and a software encoder counter following a 400 count encoder you start to run into problems at 3000rpm or so. But then you are rather unlikely to be doing coordinated moves at 3000rpm.

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

Time to create page: 0.200 seconds
Powered by Kunena Forum