Skip to content

Threading setup and use

Huub Buis edited this page Aug 23, 2019 · 25 revisions

What you need:

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.
Optionally, to compensate for spindle speed changes during a threading pass, you need synchronization pulses. A second sensor and 4 magnets will do for synchronization pulses.

Magnet:

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. Place the magnet for the **index **pulse in such way, that the index pulse lays between two synchronization pulses.

Sensor:

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.

Connecting the sensors:

  • 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 also used as synchronization pulse. In that case, the probe pin should not be used.

Configuring GRBL-L for spindle synchronization

  • 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).

Command examples:

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

Error messages:

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)

Limitations:

  • 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 threading 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 maximum 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.

Threading accuracy:

The threading accuracy is reported as push message **and **in the real time status report, depending on setting $10. Monitor the threading accuracy to see how your lathe threading setup is doing. Beware, at the threading start and end, the synchronization error will be higher due to the acceleration and deceleration of the carriage. To decrease the synchronization error:

  • 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.