586,115 active members*
3,496 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > LinuxCNC (formerly EMC2) > Spindle RPM control - Do I need an index pulse?
Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2007
    Posts
    56

    Spindle RPM control - Do I need an index pulse?

    My mill spindle motor is a smaller one. What I want to do is add some feedback to it, so that it would stay at the speed I set, and not bog down the motor by slowing, or having to run it at too fast a speed so I melt whatever I'm machining.

    Do I need to use both phase-A and the index pulse to read the rpm and control the motor? Would that give me the best results? I'm just looking for some insight from someone who has done something like this before.

    I've seen a few examples that use analog voltage to control the motor. I can control this motor directly with pwm or pdm, right from the printer port. Also I don't recall any of them using PID.

    I could very well just be confusing myself. Maybe it would work better to heat up the soldering iron and make something, but that seems rather inelegant.

    Regards,
    Bill K.

  2. #2
    Join Date
    Mar 2005
    Posts
    59
    Quote Originally Posted by Lexx0001 View Post
    My mill spindle motor is a smaller one. What I want to do is add some feedback to it, so that it would stay at the speed I set, and not bog down the motor by slowing, or having to run it at too fast a speed so I melt whatever I'm machining.

    Do I need to use both phase-A and the index pulse to read the rpm and control the motor? Would that give me the best results? I'm just looking for some insight from someone who has done something like this before.

    I've seen a few examples that use analog voltage to control the motor. I can control this motor directly with pwm or pdm, right from the printer port. Also I don't recall any of them using PID.

    I could very well just be confusing myself. Maybe it would work better to heat up the soldering iron and make something, but that seems rather inelegant.

    Regards,
    Bill K.
    Hello Bill,

    C3 board will solve your problem... You only need one pulse/revolution, I think.
    http://www.cnc4pc.com/Store/osc/prod...roducts_id=129

    Juka

  3. #3
    Join Date
    Nov 2005
    Posts
    496
    I would think an encoder component connected to a PID connected to the pwm component would do what you ask. The encoder component can be set to counter mode and then it only use one input (A) to count with. connect the velocity to the PID....

  4. #4
    Join Date
    Apr 2007
    Posts
    56
    Juka, Thanks, interesting web site. I'm going to bookmark it. Fortunately I've been collecting odds and ends like encoders and such for parts of two centuries. Older printers especially are a good source of that kind of stuff.

    Chester88, That's what I'm am thinking. The index pulse and phase A would be used if you want to know the position of the shaft, In this case, I don't care. I just want to know how long it takes to make a rotation. I suppose either the index or phase A would do that. But I'm wondering which work best, one pulse per rev or many, especially for a slightly underpowered motor.

    I could just hook it up I suppose, but sometimes I like to know what I'm doing, and why.

  5. #5
    Join Date
    Apr 2005
    Posts
    1778
    Quote Originally Posted by Lexx0001 View Post
    Juka, Thanks, interesting web site. I'm going to bookmark it. Fortunately I've been collecting odds and ends like encoders and such for parts of two centuries. Older printers especially are a good source of that kind of stuff.

    Chester88, That's what I'm am thinking. The index pulse and phase A would be used if you want to know the position of the shaft, In this case, I don't care. I just want to know how long it takes to make a rotation. I suppose either the index or phase A would do that. But I'm wondering which work best, one pulse per rev or many, especially for a slightly underpowered motor.

    I could just hook it up I suppose, but sometimes I like to know what I'm doing, and why.
    It really depends on what you are trying to do. If you are just doing straight milling and trying to maintain speed, it might be that just the index would work. However, if you are trying to do something like threading that requires axis movement coordinated with the spindle rotation, you are better off with a index plus A channel.

    Of course if the spindle is too underpowered, you won't be able to maintain speed anyway.

    Alan

  6. #6
    Join Date
    Nov 2005
    Posts
    496
    More pulses are always better. depends what you want and how you are trying to get it.
    If you read many pulses using a parallel port, it may limit your rpm (can't read the signals fast enough) then use one pulse per rev. If using a hardware card to read then use all the pulses-it is better, later you may want to ridge tap etc. The encoder component was modified to improve the one pulse per rev output- but that may just be in the TRUNK version.

  7. #7
    Join Date
    Apr 2007
    Posts
    56
    Of course if the spindle is too underpowered, you won't be able to maintain speed anyway.

    Alan
    Understood. I just want better regulation of the speed so it doesn't bog down when I mill something that should be milled slower. If I take deep cuts now, all it does is plug up the end mill. I haven't even thought about tapping.

    I've got a a couple different sensors I can try. I am going to take the rpm right from the spindle, not the motor. Hopefully this weekend I'll get a chance to get it done.

    chester, I think I'll start with two pulses per rev and see what kind of results I get. If I don't get the low speed response I want, I'll add more. I suppose its important to get them spaced equally, so I'll be watching for that.

    Bill K.

  8. #8
    Join Date
    Feb 2007
    Posts
    11
    Hi,
    I think I am going to do something similar, using an encoder and the pwm output of emc2.

    I have a brushless servo motor, and I'm driving it with a BLDC type of drive from advanced motion controls. The drive takes +-10vdc signals.

    The encoder is a renco, 1024 line encoder, with outputs for the hall effect commutation also. The commutation goes to the drive, and also single ended encoder input.

    I'm also going to connect the encoder to the paraport and read that using emc2.

    I may need to reduce the encoder count, so I am getting an encoder divider board from www.banebots.com. This will let me reduce the encoder count either by dividing by 2,4,8, or 16x. It also has provision to power the encoder.

    I want to use emc2 to control spindle speed, as well as doing things like hard tapping or using the spindle as a position controlled rotary axis. (that's why the big servo motor)

    So, what I'm thinking is having several setups:

    1) velocity control of the spindle, using PWM out and filtering it to analog =-10vdc (more on this later) and reading either the index pulse or one of the encoder channels for velocity information. Would also allow use of spindle like a vertical lathe with tools mounted to the XY table.

    2) hard tapping control of the spindle, using PWM out, PID and reading full quadrature input and index input from the encoder to give fine angular control of spindle position.

    3) (might be same as 2) using the spindle nose to mount an auxilary spindle like die grinder at 90 degrees and using again PID and PWM out to give accurate axis position control for 4 or 5 axis machining.

    What I want to try to do is take the PWM type 2 up signal and feed them into the base of a small signal transistor that is connected between the +10vdc on-board supply of the BLDC servo driver and the reference input of the drive. Thus the PWM switches the +10vdc supply, which is the velocity command to the drive. I would filter the PWM on the 10vdc using the 2 pole filter shown at: http://www.digital-diy.net/18F%20Exa...via%20PWM.aspx before I feed it into the +reference input of the drive.

    Using the other PWM type 2 down output, I'd feed that into the same setup, except using the -10vdc onboard supply switched using the transistor, the output filtered and fed into the -reference input of the drive.

    If my thinking is correct, this will allow emc2 to read the encoder, figure out the velocity command needed via the PID and output the PWM up/down signals which then command the drive to turn cw or ccw as needed.

    So, I guess I would like some feedback as to if this scheme would work or not and why or why not.

    I envision having several hal modules I can call through axis if I want either speed control from emc2 or hard tapping. And another complete config for using it as a rotary axis. The hal modules or routines or .ini files would contain the setup for the PID and which pins to read for the encoder and how to use the info. Ideally, I would like speed control for the milling, then be able to unload the speed control and switch in the hard tapping setup without shutting down and restarting emc2 (and possibly loosing position)

    Thanks for your help. Let me know if this is useful to you.

    Michael

  9. #9
    Join Date
    Apr 2007
    Posts
    56

    My story so far...

    My weekends never seem to go as planned. Sometimes for months at a time.

    I was running into difficulties controlling the motor. I made an encoder with 5 slots and attached it to the spindle. When I started the motor, I had control, but the speed wasn't staying constant. At some speeds it would ramp up slow, then a faster ramp down. At others, fast ramp up, slow ramp down. With halscope I could see the pulses to the motor were varying, which is what I expected. So I make another encoder, this time with 50 slots. Same thing. Then I add an index pulse. That didn't help either. I'm very confused at this point. Everything seemed to be working the way it should. It didn't matter if I was using PWM or PDM mode.

    So, I bring my o-scope across the shop, and hook it up. It didn't take long to see what the problem was. I had made an assumption that was wrong. The voltage was DC when measured with a meter, but rectified DC when looked at with a scope. The motor is in series with a triac, which was going to turn on when ever it got a pulse, regardless of the phase. It did work better when I had the frequency at 120 Hz.

    I think that solves the mystery. I suppose I could bring in a pulse for zero crossing, but I don't want to take the time. I've got a couple capacitors and a IGBT on order. I'll make a DC power supply. It won't be fancy, but I think it will work.

    But I've been wrong before.

    Bill K.

Similar Threads

  1. Config for using single pulse for index and speed
    By rfrenzl in forum LinuxCNC (formerly EMC2)
    Replies: 11
    Last Post: 09-08-2008, 11:49 PM
  2. How to use index pulse for homing purpose
    By Zig in forum LinuxCNC (formerly EMC2)
    Replies: 2
    Last Post: 03-28-2008, 08:16 AM
  3. rw14 - Spindle will not index on toolchange
    By 66 AC COBRA in forum Milltronics
    Replies: 2
    Last Post: 04-16-2007, 04:51 PM
  4. Taig / Digispeed XL spindle index sensor
    By Dfennell in forum Taig Mills / Lathes
    Replies: 1
    Last Post: 01-02-2007, 06:23 AM
  5. Phototransistor + Index Pulse = Z Axis THC?
    By sunmix in forum Mach Software (ArtSoft software)
    Replies: 0
    Last Post: 10-26-2006, 03:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •