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

rename 'zAxisAuto' to 'spindleAutomate' #635

Merged

Conversation

blurfl
Copy link
Collaborator

@blurfl blurfl commented Feb 16, 2018

PR #458 added a setting to enable/disable spindle control. The setting was named 'zAxisAuto' which seems confusing as it is being used as an on/off control for spindle power. Change the name to 'spindleAutomation' to better reflect its use. Note that the change in GC will match an accompanying PR in Firmware.

This accompanies Firmware PR #392

PR MaslowCNC#458 added a setting to enable/disable spindle control. The setting was named 'zAxisAuto' which seems confusing as it is being used as an on/off control for spindle power. Change the name to 'spindleAutomation' to better reflect its use. Note that the change in GC will match an accompanying PR in Firmware.
@blurfl
Copy link
Collaborator Author

blurfl commented Feb 16, 2018

On further thought, this setting chooses between 'on/off' and 'servo-control' modes. Is there a better name than 'spindleAutomate' to convey this?
Too, the description seems misleading:
"Should the spindle start and stop automatically based on gcode? Leave off for default stepper control."
Both modes achieve on/off control via AUX1, one providing a 5V signal for 'on' and the other by means of a servo control signal where 0 degrees is off, 90 degrees is neutral and 180 degrees is on.

the setting chooses between external servo control (the default) and external relay control.
@@ -215,8 +215,8 @@
{
"type": "bool",
"title": "Spindle Automation",
"desc": "Should the spindle start and stop automatically based on gcode? Leave off for default stepper control.",
"key": "zAxisAuto",
"desc": "How should the spindle start and stop automatically based on gcode? Leave off for default external servo control, on for external relay control.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still feel like I wouldn't understand...or maybe I am just thinking the setting does something different.

The options are off -> The pin toggles digitally high/low to control a relay or on -> The pin is a PWM to set speed...is that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's backwards... if the setting is off (the default) AUX1 has a servo signal that is controlled by Mx codes. If the setting is on, the output is LOW or HIGH as would be used to drive an external relay. Maybe 'auxServoRelay'?
Servo control is different from PWM. Servos, as used here, are motor/gearchain/crank devices that are driven to specific positions of the crank. While the signal is a controlled pulse width, the width of the pulse represents an angle instead of a speed. A 1.5mS pulse will put the servo at its 'neutral' angle, the middle of its range. Varying the pulse width up or down by 1mS will turn the output by 90 degrees in either direction. Removing the signal leaves the output at its present location for some of the simpler examples. That is the way this servo signal is configured, a brief drive to one of the active positions (0 or 180 degrees) followed by a brief 'return to center' pulse train.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woah, thanks for the explanation...that is way different than what I would have expected.

I like that we have the servo option, but I'm not sure it should be the default...I vote for just regular on off to be the default...but that's not about this PR 😀

@BarbourSmith
Copy link
Member

Now that I understand what we're doing 🙄 I think this looks great! I'm glad that text is clarified.

@BarbourSmith BarbourSmith merged commit 6366b30 into MaslowCNC:master Feb 17, 2018
@davidelang
Copy link
Contributor

davidelang commented Feb 17, 2018 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 17, 2018

Unfortunately PWM isn't available on any PowerControl board AUX pins. These two options satisfy all the currently available output control options.

@davidelang
Copy link
Contributor

davidelang commented Feb 17, 2018 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 17, 2018

Yes, anything’s possible with software 😉. In practice, though, the Servo library is doing bit-bang PWM at 50Hz. Would that be suitable for laser power control?

@davidelang
Copy link
Contributor

davidelang commented Feb 17, 2018 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 17, 2018

The Servo library pretty much limits the PWM to 50Hz ranging from 2.7% to 12% duty cycle, the standard servo signal range. So long as the PWM control for laser power or router speed can live within those limits...

@BarbourSmith
Copy link
Member

I think the 2.7% to 12% duty cycle is going to be an issue for a laser, but there is no reason we couldn't add an option using the digitalWrite() function which would give us 0%-100% duty cycle options

@blurfl
Copy link
Collaborator Author

blurfl commented Feb 19, 2018

I don't see how that would work, unless someone also wrote a bit-bang PWM routine to run on a timer. We're already running into situations where PID calculations don't finish in time before the next timer call, I would hesitate to add more time critical overhead like this.
The TimerOne library only does PWM for the pins controlled by timer1 (pins 11, 12, 13), more's the pity. There are three PWM pins (44,45, 46) on the 36-pin connector of the Mega, though, for board REV1.x...

@BarbourSmith
Copy link
Member

You are right, I had it in my head that analogWrite() would handle the bit-banging behind the scenes (which would probably still have been too slow), but from the docs:

On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.

@blurfl blurfl deleted the rename-'zAxisAuto'-to-'spindleAutomate' branch February 19, 2018 21:36
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.

3 participants