Hobby CNC machines are usually based on Arduino/Woodpecker CNC controllers with cheap motor drivers and 775 spindle motors. Motors are specified to run on 36V but CNC machines usually run it on 24V. That means motors run on slower speed than what they can do. Some controllers are able to run 36V but 24V power supplied are delivered with them. Newer Woodpecker CNC controllers are specified to run on 24V only.
Some specifications claim that 775 motor used for spindle runs at 3000-6000 rpm when powered at 24V and gets up to 9000 when powered at 36V. I wanted to run spindle at maximum possible speed for better milling results.
Woodpecker CNC controller uses IRF540N MOSFET to drive spindle motor. It can handle 100 V and 23 A so it should do good with 36 V. Powering controller with 36V would probably work but I was not eager to try. It is also possible to hack original MOSFET driver on CNC controller and inject 36 V to the board to do the job but I was not willing to experiment that way either. Therefore I constructed additional driver for this purpose.
As I did not have IRF540N, I used IRF520 which has similar characteristics except lower power (7A). It did good job for testing but for production IRF540N should be used.
Driver uses PWM signal from CNC controller for input. IRF540N requires 5 to 10 V at the gate to be fully saturated. That leaved me two options. One is to use 5V PWM signal meant to control laser and the other to use 24 PWM meant to run spindle but to reduce voltage for driving the MOSFET gate. Both solutions are acceptable.
I tested using 5V PWM and circuit worked flawlessly. However, I prefer using 24V PWM as it has RFI protection. RFI (Radio Frequency Interference) is very nasty product of high power DC motor running in PWM mode and can cause lot of issues with controller electronics.
For practicality I designed input to support both PWM sources. There is jumper switch JP1 that selects if input will come from 5V or 24V source. If 24V PWM is used simple resistor divider (R2,R3,R1,D1) reduces it to 5V range.
MOSFET circuit is generic. 10K resistor R3 from gate to GND secures that MOSFET is closed if there is no input signal attached at all. It is not good idea to let motor run randomly. 100 ohm resistor R4 in series with the gate prevents ringing of the MOSFET. LED D1 with R1 is there just to show that input signal is present.
Source is connected directly to the GND and motor is driven via drain pin. Motor is connected between MOSFET drain and +36V coming from power supply. Schottky diode D3 parallel to motor is necessary. It regulates induced current coming from motor itself. If diode is not there motor would not run, except it would release audio tone of 1 kHz which is frequency of PWM signal. Diode used on Woodpecker board is SS54 so I use it in schematics. I did not have that exact diode so I used diode marked as BA160-200 (not sure what it is), which does the job.
Condensers 0.1 μF are there to prevent RFI. In my tests there were no RFI issues without them, but it is recommended to have them in the circuit.
Led D2 together with R5 signals that circuit works and controls motor.
Aluminum cooler for MOSFET is recommended.
You do not have to make this circuit from scratch
There is actually no need to make this circuit from zero. You can easily buy ready made IRF540 MOSFET module that already contains most of the parts from this schematics.
It accepts 5V PWM signal and drives motor. You have to add diode parallel to motor (and condensers) for motor drive.If you want to use 24V PWM you have to add resistor voltage divider at the input. That is all simple to do. Do not forget do add aluminum cooler to MOSFET.
Possible other use
You may use similar circuit if you upgrade spindle motor on your machine. All You have to do is to use MOSFET suitable for voltage and current requirements of a spindle.