Finally i’ve sorted it! Thanks for your replies. I think the issue was with the VFD.
I used a potentiometer on 5v, ACM and VI to test with a switch between DCM and FOR. This made it easier to test the VFD standalone. It was setting pd002 = 1 that was the key. What is it set to on yours?
On all the blogs I read I think that people are just setting the values to make it work without understanding what they are setting. Here is my understanding, which may be wrong:
The VFD is a Variable Frequency Drive inverter. This takes your input voltage (100,120,220 etc.) and converts it to 3-phase (the inverter part). The spindles are induction motors (https://en.wikipedia.org/wiki/Induction_motor) and have no electrical connection to the rotor (no brushes so only the bearings are a wearing part). To make them rotate they need ‘rotational’ voltage (3-phase) where each phase is 1/3rd, 120deg out of sync (out of phase). This creates a rotating magnetic field.
Frequency: If the frequency is 1 Hz the peak and trough of each phase’s AC wave will be 1 second apart and I think the motor will turn 180 deg per cycle if it has 2 coils in the motor per phase.
the equation is: https://wikimedia.org/api/rest_v1/media/math/render/svg/5231fede7f546303caa0201cd3bd71403c501292
at 400HZ : 120 x frequency / 2 poles = 24,000 RPM, so it must be a 2 pole motor.
so to work out what frequency you need to generate a specific RPM:
frequency = (RPM*2)/120 so to get 6000 RPM you need 100HZ.
The speed of the spindle is controlled by varying the frequency. There are lots of warnings from people that setting the wrong frequency will fry the spindle. The VFD is often set at 50Hz from the factory and it will run too hot. If you reduce the speed of your spindle to run at 3000 RPM then you are essentially running at 50Hz. I’ve read that >100 Hz (6000 RPM) is safe.
The settings on the VFD just set the minimum at maximum frequency.
I set my VFD settings in this order:
pd013 = 8 resets the vfd to factory settings
pd005 = 400 max operating frequency (Hz)
pd004 = 400 base frequency (Hz)
pd003 = 400 main frequency (Hz)
pd011 = 0 frequency lower limit (Hz) should really be set to 100Hz but setting to zero allows 0v from the
PWM to turn off the spindle. maybe there is a better way with a digital output contacting a relay
between DCM and FOR. Not direct from arduino chip as VFD logic pulled HIGH 24v, GND
(DCM) to trigger
pd070 = 1 sets Analog in type 0-5v
pd072 = 400 higher analog frequency (Hz)
pd073 = 0 lower analog frequency (Hz)
pd143 = 2 number of poles in motor- changing this from 4 doesn’t seem to do anything??
pd144 = 3000 rated motor revolution. Ok so the motor is 24000rpm so i thought setting this to 2400 (only 4
digits available) would be right but then the rpm is way off at 400Hz
pd001 = 1 sets the VFD to use the contact closure (24v) from DCM to FOR to start forward rotation
pd002 =1 sets the VFD to use the VI and ACM to control the frequency (and thus the speed)
PWM output from GRBL board outputs 0-5 VDC, referenced to its GND pin.
VFD is set to receive a 0-5 VDC analog input to control the speed.
send gcode $30=24000 to shapeoko to set the max spindle speed at 24000 RPM. This means that if you ask shapeoko to go to 24,000 RPM (gcode m3s24000), it will output 5V to the VFD.
The VFD is set to a high analog in frequency (pd072 = 400) of 400Hz, so the 5V will give 400Hz which = 24000 RPM.
Setting spindle off (gcode m5) will output 0v, 0Hz and 0 RPM.
Setting the spindle at <6000 RPM will set VFD to 100Hz and is supposedly bad for it.
I think I will look at making a way for the grbl board to switch the FOR control using a relay, or have this as my emergency stop.
Another useful thing in the VFD settings is the Acceleration and Deceleration control.
So, I don’t know what parameters are safe… but setting pd015 = 2 (default 10 seconds) will make it stop in 2 seconds. This is much better for cutting off the spindle safely.