External Stepper Motor Drivers - Longus/FluidNC GitHub Wiki

External Stepper Motor Drivers

External stepper motor drivers are typically used when you want more power than the the small plug-in drivers can supply. You can also get advanced features like closed loop stepper and servo motors.

As long as they accept step and direction signals, you can probably use them. They usually have an enable signal and some have a fault signal. FluidNC currently supports the enable. We hope to support the fault signal on the next generation of FluidNC.

Connections

They typically have opto isolated inputs. These use LEDs and optical sensors to isolate the signal. Any noise or spikes on the motor side cannot jump that optical gap and hurt the controller side. These LEDs are generally sized for 5V. The ESP32 outputs 3.3V, so it generally cannot directly connect to the motor drivers. See below.

Note: Some people claim that there drivers work fine at 3.3V. Be careful. It is hard to tell if the driver is happy all the time, or 99.9% of the time. Follow the published spec of the driver.

Signals

These isolating input features can add a little lag time on the speed of detecting the step, direction and enable signals. FluidNC has several settings to compensate for this.

Many signals also have to be inverted. The isolation circuit flips the signal, so FluidNC may need to adjust for that.

In the image below, you can see the pulse length requirements and required gaps between signals. The PUL (step signal) and DIR are inverted. The ENA is not, but you still might need to invert it because FluidNC considers it a disable signal.

Settings

The following settings under the stepping: group can be used to control the pulse durations.

Here are the settings. The "t" numbers from the image above are indicated.

  • pulse_us: (t4) This is the duration in microseconds of the step pulse.
  • dir_delay_us: (t2) This is the delay between the end of the direction pulse and the beginning of the step pulse.
  • disable_delay_us: (t1) This is the delay between the enable and the direction signal

Example: Stepping section

stepping:
  pulse_us: 2
  dir_delay_us: 1
  disable_delay_us: 0

3.3V to 5V Level shifting

Some controllers will have this built in. The 6 Pack has a jumper option for 3.3V and 5V output option. You should use the 5V output.

Note: Do not mix external with Trinamic drivers when using 5V. They send signals back to the ESP32 and will damage it with 5V

The 5V must have enough current to light the LEDs. The current is generally less than 20mA, but that is more than some cheap level shifts can deliver. Some level shifters (like T.I. TXB type) use a pull up resistors for the 5V and this will not power an LED.

Adapters

There are a couple of adapters available to help with this. These both send the signals to the existing connectors.

6 Pack Adapter. This is just re-routes the 5V signals to the terminal blocks. It also allows the option of common 5V or common ground.

Note: Be very careful when wiring. If you short the outputs you could permanently damage the controller.

StepStick Adapter. This adapter does level shifting and re-routes the signals to the motor connector. It would be used on controllers that don't have 5V signals. It can be used on 3.3V or 5V controllers.

Wiring

Each signal typically has a + and - connection. This allow you to wire them totally isolated from each other. The signals on the FluidNC side generally will not be isolated from each other and share a common ground.

The easiest way to wire that is to connect all the minus sides together and connect that to ground on the controller. Wire the plus sides to the signals. This is shown below.

You could also wire the + sides together and connect that to +5V on the controller side. The minus sides would connect to the signals on the controller side. This is shown below.

Troubleshooting

  • Erratic or missed steps This is often due to the step timing. These drivers often need longer pulse lengths to be reliably detected. Try lengthening the pulses.