-
Notifications
You must be signed in to change notification settings - Fork 9
Threading setup and use
Threading needs a spindle index pulse to start at the same spindle position every threading pass. A magnet on the spindle and a magnetic sensor is basically all you need. Make a holder for the sensor and mount the sensor on the bed by using 3 magnets and you can start threading.
To more accurately compensate for spindle speed changes, you can add synchronization pulses. A second sensor and 4 magnets will do. Place the magnet for the index pulse is such way that the index pulse false between two synchronization pulses.
an inductive sensor like the NJK-5002C (5 Volt version) will do. If you are using limit switches, use the same type (NO or NC) sensor because the limit pin invert setting is for all limit pins.
Use small 4..6 mm Neodym magnets. It is important that they are equally strong, so use magnets out of one batch. Position the magnets as accurately as possible.
- Connect the index pulse to the Y-limit pin.
- Connect the synchronization pulse to the Probe pin.
If there are no synchronization pulses, the index pulse is used to synchronize and the probe pin should not be used.
- Set the number of synchronization pulses (set $40)
- Enable hardware limits (set $21 to 1)
- For normally open sensors (NO) set $5 to 0
- For normally closed sensors (NC) set $5 to 1 and connect the X-limit and Z-limit pin to GND, if there are no limit switches connected to them.
- The actual (measured) spindle speed can be reported in the real time status report instead of the spindle speed set by GRBL, by setting bit 1 in the report option ($10) high (add 2).
- The spindle synchronization error can be reported in the real time status report (|SE x.xxx) by setting bit 2 in the report option ($10) high (add 4).
- The spindle synchronization error can be reported as feedback message during threading at every index puls ([Se:x.xxx]) by setting bit 3 in the report option ($10) high (add 8).
Threading can be done by sending a G33 code to the GRBL-L controller. The target position and pitch (feed in units per revolution) have to be set. When $13 = 0, units are mm otherwise inches
- G90 G33 Z-5 K1; Moves the Z-axis to absolute position Z-5 and a pitch of 1 unit per revolution.
- G91 G33 Z-5 K0.5; Moves the Z-axis -5 units at a pitch of 0.5 units per revolution
- G91 G33 Z-5 X-1 K1; Moves the Z-axis -5 units & the X-axis -1 units at a pitch of 1 unit per revolution. The pitch is based on the Z-X travel length!
Full example
G0 X1 Z0 ; go to start position
G0 X-0.5 ; go to cutting depth, clear of workpiece
G90 G33 Z-5 K1 ; Threading pass at a pitch of 1 unit per revolution
G0X1 ; retract at end of move
Z0 ; end of pass
There are 4 (3 new) error messages related to threading G33:
- 18 No index pulse detected in the last 6 seconds.
- 19 No synchronization pulse detected in the last 6 seconds.
- 39 Invalid GCode when G33 is sent but the number of synchronization pulses is set to 0 ($40=0).
- 40 Invalid GCode when G33 is sent but hardware limits are not enabled ($21=0)
- You cant start threading at the tip of the workpiece. The Z-axis needs time to accelerate. Depending on your settings, it may take 2 to 8 synchronization pulses to start.
- Don't change the spindle speed during a threading pass.
- Don't stop during a threading pass, but after the pass is done, you may stop and turn the spindle in any direction
- Run at least at 0.1 RPM
- Don't use high resolution encoders for synchronization because the Arduino Uno and Mega processors don't have enough processing power. The higher the encoder resolution, the slower the spindle has to run. In practice, I think the limit will be 8 pulses per revolution.
- There is a limit on the spindle speed you can run. The actual limit depends on the number of sync pulses per revolution, spindle speed drop during threading, max feed rate(s) Z (X), max acceleration(s) Z (X), Pitch size, etc.
The threading accuracy is reported as push message and in the real time status report depending on settings. Monitor the threading accuracy to see how your lathe threading setup is doing.
- Setup your spindle pulleys / gears for the highest torque.
- Run the spindle at low speeds.
- Take shallow cuts.
- Use sharp cutting tools.
If all is working well, find the limits of your setup and make a note of the threading conditions, material and workpiece diameter for future use.
Threading is done by sending G33 commands to the controller. When the controller receives a G33 command it:
- waits until the planner buffer is empty so all moving will stop.
- waits for 3 index pulses and calculates the initial feed rate.
- waits for a synchronization pulse.
- adds the G33 command to the planner buffer.
- waits until the G33 command is finished before adding commands to the planner.
To start at the same spindle position every threading pass, it needs an index pulse and a synchronization pulse. There can be only one index pulse per revolution.
To compensate for spindle speed changes: - the actual tool position is calculated based on the synchronization pulse count.
- the synchronization error is calculated and reported as a push message or at the next real time status update, depending on the report options set.
- the feed rate required to be at the right position at the next synchronization pulse is calculated.
- the feed rate is set to be at the right position at the next synchronization pulse. If there are no synchronization pulses, the index pulse is used to synchronize.