If you are not using a VFD, and your spindle motor is a DC motor of low enough power, you can control it directly using the MOSFETs on the Smoothieboard.
The power must be low enough in both voltage and current, including any current extremes when stalled.
MOSFETs are present on-board, but have limited current capacity (up to 12A).
They need to be protected by a ‘flyback’ diode when controlling a motor, electromechanical relay or other inductive load.
For more information, see:
Motors have the property of inductance, which is the electrical equivalent of inertia.
The motor current will continue to flow after the MOSFET is switched off, because the energy stored in the inductor by the current does not instantly disappear.
The current will decrease as the stored energy is dissipated.
This current flow results in the voltage across the motor reversing and increasing (or “spiking”) until the current finds a path to flow.
An appropriately connected ‘flyback’ diode with sufficient voltage and current ratings will provide a safe, intended path for the motor current.
Without a diode, when the MOSFET turns off the motor voltage will spike up until the current finds an unintended path.
Typically this degrades or immediately destroys the MOSFET and perhaps other circuitry such as that driving the MOSFET gate.
Connect the diode in reverse across the motor (when the MOSFET is on, it must NOT cause power to flow through the diode).
Connect the anode (‘arrow’) to the MOSFET Drain terminal and the cathode (‘bar’, often marked by a line on the package) to the motor power supply.
The diode rating should be rated with Voltage exceeding the maximum expected supply voltage by at least 20% (usually low cost to get a higher voltage rating).
And (conservatively) Current at least equal to half the motor current (the current through the diode will not be continuous).
An example part number is 6A4-T, rated 6A and 400V, under $1 USD.
The same considerations apply to other inductive loads such as solenoid valves and relay coils.
Solid state relays are controlled via a GPIO pin, and can control higher loads.
But are on/off only (no control of the exact amount of power sent via PWM).
For more information about SSRs, see this appendix.
A MOSFET cannot provide power if it is not provided power via an input.
Make sure you properly connect both the input power and output connections.
Smoothie has up to 6 MOSFET controls (6 on 5X, 4 on 4X, and 2 on 3X).
The MOSFETs act as switches to ground: loads must be connected between the power source and the MOSFET switched terminal.
When the MOSFET is switched on, power will be applied to the load.
When the MOSFET is switched off, power will be removed, because one load terminal will be essentially disconnected and current cannot flow.
The exception being inductive load ‘flyback’ switching transients, discussed above.
Connect your PSU to the power input connector for those FETs (providing power to the load), and connect your power-consuming element (be it heating element, spindle, etc.) between the power output terminal and the MOSFET terminal.
Smoothie connects/disconnects the element’s ground as needed to maintain temperature or as requested by G-codes.
There are three main pairs of MOSFETs on the board:
Smoothieboard v2 has a simplified and safer MOSFET architecture compared to v1:
| Output Type | Count | Current | Purpose |
|---|---|---|---|
| Low-Current FETs | 4 | ~5A each | Hotend1, Hotend2, Fan1, Fan2 |
| Bed FET | 1 (2× parallel) | ~10-12A | Heated bed |
| SSR Outputs | 2 | Milliamps | Solid-state relay control |
All MOSFET outputs are powered from the VFET power input (2× XT30 connectors, 30A total).
How it works:
Bed FET Independence:
| Specification | Value |
|---|---|
| Outputs | 4 (hotend1, hotend2, fan1, fan2) |
| Current Rating | ~5A per output |
| Voltage | Up to 24V |
| Power Source | Shared +VFET rail |
| Safety | High-side PFET watchdog |
| Control | PWM capable (firmware-controlled frequency) |
| LED Indicators | Yes (per output) |
| Specification | Value |
|---|---|
| Configuration | 2× MOSFETs in parallel |
| Combined Current | ~10-12A |
| Voltage | Up to 24V |
| Power Source | Direct from VFET (not through PFET watchdog) |
| Control | PWM capable |
| LED Indicator | Yes |
| Specification | Value |
|---|---|
| Outputs | SSR1, SSR2 |
| Type | Logic-level (3.3V or 5V signal) |
| Current | Milliamps (for SSR coil drive) |
| Use Cases | Solid-state relay control, auxiliary outputs |
Use SSR outputs to control external solid-state relays for:
Each MOSFET output has its own LED indicator showing when it’s active:
Big MOSFET pair: Their outputs are labeled P
Small MOSFET pair: Their outputs are labeled P
Mixed MOSFET pair: Their outputs are labeled P
MOSFETs list:
| MOSFET group | MOSFET name | Controlling pin | Output connector | Input method | Voltage | Current |
|---|---|---|---|---|---|---|
| Big MOSFETs | First big MOSFET | X15 | Big MOSFETs power input X13 | 12-24V | 12.5A max | |
| Big MOSFETs | Second big MOSFET | X10 | Big MOSFETs power input X13 | 12-24V | 12.5A max | |
| Small MOSFETs | First small MOSFET | X7 | Small MOSFETs power input X6 | 12-24V | 3A max | |
| Small MOSFETs | Second small MOSFET | X8 | Small MOSFETs power input X6 | 12-24V | 3A max | |
| Mixed MOSFETs | Third big MOSFET | X16 | VBB (motor) input | 12-24V | 12.5A max | |
| Mixed MOSFETs | Third small MOSFET | X9 | VBB (motor) input | 12-24V | 3A max |
+ on that connector to + on your PSU, and - to - on the PSU.
Never use the big MOSFETS for more than 12.5A (and monitor connector and MOSFET temperatures at that current use, too much heating can be a sign of a bad wire connection), and the small MOSFETS should never be used for more than 3A.
Trying to power a 40W (or more) hotend cartridge heater at 12V with the small FETs will destroy them, usually locking (melting) them to the “ON” state (shorted) and possibly destroying the circuitry driving the MOSFET gate.
If you need to control more than 12 Amps, you cannot do it with one of the MOSFETS on board, however, you can use a Solid State Relay.
For information see the Solid State Relay Appendix on this page.
All MOSFET outputs on Smoothieboard v2 are powered from the VFET power input:
Wiring steps:
| Output | Type | Current | Typical Use |
|---|---|---|---|
| Hotend1 | Low-current FET | ~5A | First hotend heater |
| Hotend2 | Low-current FET | ~5A | Second hotend heater |
| Fan1 | Low-current FET | ~5A | Part cooling fan |
| Fan2 | Low-current FET | ~5A | Auxiliary fan |
| Bed | Dual parallel FETs | ~10-12A | Heated bed |
| SSR1 | Logic output | mA | External SSR control |
| SSR2 | Logic output | mA | External SSR control |
+ on your PSU to the + terminal on the XT30 connectors.
If you need to control more than 10-12A (the bed FET limit), use the SSR outputs to control an external Solid State Relay:
For information see the Solid State Relay Appendix.
In order to configure your Smoothieboard to use a specific MOSFET, you need to know which pin corresponds to which MOSFET.
Here is a recapitulating table to help you find that out:
This page documents the MOSFET outputs available on Smoothieboard and their specifications.
MOSFETs are used to control high-power devices like heated beds, hotends, fans, and other accessories.
| MOSFET Pair | Big MOSFETS | Small MOSFETS | Mixed MOSFETS | |||
|---|---|---|---|---|---|---|
| Label on diagram | P |
P |
P |
P |
P |
P |
| Digital output pin | ||||||
| Power Input | Between P |
Between P |
Taken from VBB | |||
| Size | Big | Big | Small | Small | Big | Small |
| Maximum current | 12A | 12A | 3A | 3A | 12A | 3A |
| Used by default for | Heated bed | Hotend 0 | Fan | Hotend 1 |
Smoothieboard has three MOSFET pairs:
| Output | Controlling Pin | Current Rating | Typical Use |
|---|---|---|---|
| Hotend A | ~5A | Primary hotend heater | |
| Hotend B | ~5A | Secondary hotend heater | |
| Fan 1 | ~5A | Part cooling fan | |
| Fan 2 | ~5A | Auxiliary fan | |
| Bed | ~10-12A | Heated bed (dual parallel FETs) | |
| SSR1 | Logic output | mA | External SSR control |
| SSR2 | Logic output | mA | External SSR control |
Smoothieboard v2 has a simplified MOSFET architecture:
To configure a MOSFET output in your config file, use the appropriate pin number from the “Digital output pin” row.
Example for configuring a heated bed on P
temperature_control.bed.heater_pin 2.7
Example for configuring a hotend on P
temperature_control.hotend.heater_pin 2.4
Example for configuring a heated bed on P
[temperature_control.bed]
heater_pin = 2.7
Example for configuring a hotend on P
[temperature_control.hotend]
heater_pin = 2.4
TODO: diagram
Now that you have located which MOSFET you are going to use for Spindle control, and what GPIO pin it corresponds to, you need to add a spindle control section to your configuration file.
We will be doing this using the Switch module.
Add this to your configuration file:
V1 Configuration (flat namespace):
# Spindle control Switch module
switch.spindle.enable true #
switch.spindle.input_on_command M3 #
switch.spindle.input_off_command M5 #
switch.spindle.output_pin 2.7 # Here we are using the first big MOSFET
switch.spindle.output_type pwm # pwm output settable with S parameter in the input_on_command
switch.spindle.max_pwm 255 # set max pwm for the pin default is 255
V2 Configuration (INI sections):
# Spindle control Switch module
[switch]
spindle.enable = true #
spindle.input_on_command = M3 #
spindle.input_off_command = M5 #
spindle.output_pin = 2.7 # Here we are using the first big MOSFET
spindle.output_type = pwm # pwm output settable with S parameter in the input_on_command
spindle.max_pwm = 255 # set max pwm for the pin default is 255
Now that everything is configured, you can use G-codes to control the Spindle.
You can do this either manually by sending G-codes directly to the board via serial or your host software, or add those G-codes to the beginning/end of your files.
You can choose the exact G-codes in the configuration.
Here we used the standard
If you need to choose the power (speed) of your Spindle, you can do so because the output is configured as PWM.
Simply do:
M3 S128
To set the spindle to half power/speed.
PWM values go from 0 to 255.
0 means no power to the spindle, and 255 means full power to the spindle.
Because the spindle can feed power back into the MOSFET and damage the MOSFET, you also need to wire a diode of sufficient size across the output.
See notes in the first section above.
To get more accurate RPM control, you can use a feedback sensor.
This can be optical or a hall effect sensor, which senses the rotation of the spindle.
Smoothie then measures the real RPM of the spindle and adjusts the PWM value accordingly.
To use this module, you need to connect your spindle to pins with proper hardware support:
| V1 Setting | V2 Setting | Description |
|---|---|---|
| Enables the spindle control module. When true, the spindle module is loaded and available for G-code control (M3/M5 commands). V1 provides a dedicated spindle module with PID control, tachometer feedback, and Modbus VFD support. V2 uses a simple switch module instance for basic on/off or PWM control (no PID or feedback). | ||
| Spindle control mode. V1 supports three types: pwm (closed-loop PID control with tachometer feedback for precise RPM), analog (open-loop PWM output for VFDs/ESCs with 0-10V or PWM inputs), or modbus (RS485 communication for Modbus VFDs like Huanyang). V2 only supports: digital (on/off relay) or pwm (variable speed, open-loop only). | ||
| PWM output pin for spindle control. Must be hardware PWM-capable ( |
||
| PWM frequency for spindle control. V1 uses period in microseconds (default 1000µs = 1kHz, frequency = 1,000,000 / period). V2 uses frequency in Hz via pwm1.frequency or pwm2.frequency settings. Most VFDs and spindle controllers work with 1-50 kHz. Check your VFD documentation for required frequency. | ||
| Maximum PWM duty cycle (0.0-1.0). Acts as both a safety limit and calibration factor. Some spindle controllers (like MC2100) require less than 100% duty cycle for maximum speed (MC2100 uses 0.85). Setting below 1.0 limits maximum spindle speed even when G-code requests full power, protecting the motor from overcurrent. | ||
| Controls spindle behavior during emergency stop. When false (recommended), spindle stops immediately on any halt condition (emergency stop, limit switch trigger) for safety. When true, spindle continues running during halts. This is a safety-critical setting - use with extreme caution. | ||
| — | Tachometer input pin for closed-loop RPM control (V1 PWM mode only). Must be an interrupt-capable pin on Port 0 or Port 2 (pin number must be 2.x or 0.x). Receives pulses from hall-effect sensor, optical encoder, or other tachometer. Used with PID controller for precise RPM maintenance. Not available in V2. | |
| — | Number of tachometer pulses per spindle revolution (V1 PWM mode only). Used to calculate actual RPM from tachometer feedback. Hall-effect sensors typically provide 1 pulse per revolution, optical encoders may provide many pulses per revolution. Essential for accurate RPM calculation in closed-loop mode. Not available in V2. | |
| — | Default RPM when M3 is issued without S parameter (V1 PWM mode only). If G-code contains "M3" without specifying speed, this RPM will be used. Default 5000 RPM. Only applies to PWM spindle type with feedback control. Not available in V2. | |
| — | PID proportional term for closed-loop spindle control (V1 PWM mode only). Controls how aggressively the controller responds to RPM error. Higher values provide faster response but may cause oscillation. Lower values provide smoother operation but slower response. Requires tuning for specific spindle. Unit is 1/RPM. Default 0.0001. Not available in V2. | |
| — | PID integral term for closed-loop spindle control (V1 PWM mode only). Eliminates steady-state error by accumulating error over time. Higher values eliminate offset faster but may cause overshoot. Set too high and system becomes unstable. Requires tuning for specific spindle. Unit is 1/(RPM × seconds). Default 0.0001. Not available in V2. | |
| — | PID derivative term for closed-loop spindle control (V1 PWM mode only). Responds to rate of change of error, providing damping to reduce overshoot and oscillation. Higher values provide more damping but may slow response and amplify noise. Often set lower than P and I terms. Unit is 1/(RPM/seconds). Default 0.0001. Not available in V2. | |
| — | Low-pass filter time constant in seconds for tachometer smoothing (V1 PWM mode only). Filters out noise and transient fluctuations in RPM measurement. Higher values provide more smoothing but slower response to actual speed changes. Lower values provide faster response but may amplify tachometer noise. Default 0.1 seconds. Not available in V2. | |
| — | Minimum RPM when spindle is on (V1 analog mode only). When spindle is enabled, speed cannot go below this value. Prevents stalling and ensures minimum cutting speed. If G-code requests speed below min_rpm (but greater than 0), this minimum will be used instead. |
|
| — | Maximum RPM at 100% PWM (V1 analog mode only). Calibrates PWM output to spindle's maximum speed. For example, if your VFD is configured for 24000 RPM maximum and you request 12000 RPM (S12000), the system will output 50% PWM. Essential for accurate speed control with VFDs and ESCs. Default 5000 RPM. Not available in V2. | |
| — | Optional digital output pin to enable VFD/power supply (V1 analog mode only). Typically connected to VFD's RUN/ENABLE input via optocoupler. Goes high when spindle is commanded on ( |
|
| — | VFD manufacturer/model for Modbus control (V1 modbus mode only). Currently only supports "huanyang" VFDs. Determines the Modbus protocol and register mapping used for RS485 communication. Huanyang VFDs must be configured for RS485 control before use: PD001=2 (run command source: communication port), PD002=2 (frequency source: communication port), PD163=1 (address: 1), PD164=1 (baud: 9600), PD165=3 (data method: 8N1 RTU). Not available in V2. | |
| — | RS485 receive pin for Modbus communication (V1 modbus mode only). Used with TX and DIR pins to communicate with Modbus VFDs. Requires RS485 transceiver chip (MAX485 or similar) between Smoothieboard and VFD. This pin receives data from the VFD. Not available in V2. | |
| — | RS485 transmit pin for Modbus communication (V1 modbus mode only). Used with RX and DIR pins to communicate with Modbus VFDs. Requires RS485 transceiver chip. This pin sends data to the VFD. Not available in V2. | |
| — | RS485 direction control pin (V1 modbus mode only). RS485 is half-duplex, so a single pair of wires is used for both sending and receiving. This pin switches the RS485 transceiver between transmit and receive modes. Typically connected to DE/RE pins on MAX485 chip. Not available in V2. | |
| — | G-code command to turn spindle on (V2 only, via switch module). Typically M3 for spindle clockwise. Can be configured to any G-code or M-code. Not needed in V1 (M3 is hardcoded). | |
| — | G-code command to turn spindle off (V2 only, via switch module). Typically M5 for spindle stop. Can be configured to any G-code or M-code. Not needed in V1 (M5 is hardcoded). |
Available G-code commands for PID spindle control:
There is no PID autotuning for spindle parameters currently.
You can use the following process to manually tune the PID:
Now set the parameters to:
Some manual tuning may be needed after this.
Test speed changes using the