Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding servo control using variable spindle. #991

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrhuerta
Copy link

Defined new symbol SPINDLE_SERVO_CONTROL on config.h that when defined
will cause the prescaler for PWM on pin 11 to be set to 1/1024 instead
of the original 1/8 bringing PWM freq down to 61Hz.

Defined configuration values:

  • SERVO_MIN_PULSE_WIDTH
  • SERVO_MAX_PULSE_WIDTH

and symbol:

  • INVERT_SERVO_ENABLE

Than can be used to configure the servo movement range and direction.
Restrict SPINDLE_SERVO_CONTROL and MINIMUM_SPINDLE_PWM enabled at the
same time.

Defined new symbol SPINDLE_SERVO_CONTROL on config.h that when defined
will cause the prescaler for PWM on pin 11 to be set to 1/1024 instead
of the original 1/8 bringing PWM freq down to 61Hz.

Defined configuration values:
- SERVO_MIN_PULSE_WIDTH
- SERVO_MAX_PULSE_WIDTH

and symbol:
- INVERT_SERVO_ENABLE

Than can be used to configure the servo movement range and direction.
Restrict SPINDLE_SERVO_CONTROL and MINIMUM_SPINDLE_PWM enabled at the
same time.
@jrhuerta
Copy link
Author

Hi!
I read the issues section trying to find how to configure grbl to use a servo. I found several references to this modification grbl-servo but it was not a fork and it's for the previous release. I thought this would be a great learning opportunity and a useful feature so I decided to give it a try and this is the outcome.

I did some tests using a mini xy cnc setup from dvd drives, a hxt-900 servo, a multi-meter and a dso nano v3 oscilloscope. These are the things I tested for:

  • SPINDLE_SERVO_CONTROL disabled:
    System is able to home.
    Orignal 1/8 prescaler is used.
    Min spindle PWM limit works.
    PWM turns off on spindle stop.
    Spindle enable pin turns high or low according to settings.
    Spindle rpm varies PWM output from 0 to 5v.
  • SPINDLE_SERVO_CONTROL enabled:
    System is able to home.
    Min spindle PWM enabled causes a compile time error.
    1/1024 prescaler is used, PWM freq is 61Hz
    PWM set to min or max on spindle stop depending on settings.
    Spindle enable pin turns high or low according to settings.
    Spindle rpm varies PWM from SERVO_MIN_PULSE to SERVO_MAX_PULSE according to settings.

If you have a chance please take a look and let me know if it's of any value.
Have a nice day!

@jrhuerta
Copy link
Author

@chamnit I would appreciate some feedback on this pull request if possible. Thanks a lot for your time.

@chamnit
Copy link
Member

chamnit commented Jun 12, 2016

@jrhuerta : Apologies for tardiness. Been having a series of life events happening over the last couple of months. I'd like to hold off on servo support on the 328p version of Grbl until after v1.0 comes out. You'll see why when it does. After v1.0 though, I don't plan on working a lot on the firmware, since I'll be devoting my time to continuing to develop Grbl-ARM and add things to Grbl-Mega (2560). We can look into servo support officially then, but don't remove your pull request. It's still useful as providing a template to work from.

@jrhuerta
Copy link
Author

Thanks a lot for your time! Let me know if I can help in anyway, I would be interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants