Direct Connect Spindle to Duet Board - Solution for SoftStart



  • I'm using duet board to recorver old CNC machines. In some of my implementation I use heater or bed output to directly drive the spindle motor...

    So if spindle motor don't takes to much power when runing, if i start it imediatly at full power i'll notice some voltage drop in porwer source, and depending on power source maybe voltage can be lower then minimum voltage needed to get all working properlly.

    So one solution was put a "bigger" and more expensive power source. But makes no sense once it will only be necessary when I turn ON spindle.

    My solution, that i wanna share with all, is to implement a "soft start" spindle, by incresing PWM output until reach the speed requested.

    I just chenge SetRpm() function in Spindle.cpp file in firmware:

    void Spindle::SetRpm(float rpm)
    {
    	const float pwm = abs(rpm / maxRpm);
    	if (rpm >= 0.0)
    	{
    		spindleReversePort.WriteAnalog(0.0);
    		//add by IPTRONICA for soft start
    		for (uint8_t spindlestep=4;spindlestep > 0; spindlestep--) {
    			const float step_pwm=(pwm/spindlestep);
    			if ( step_pwm >= 0.20) {
    				spindleForwardPort.WriteAnalog(step_pwm);
    				delay((spindlestep)*200);
    			}
    		}
    	}
    	else
    	{
    		spindleForwardPort.WriteAnalog(0.0);
    		//add by IPTRONICA for soft start
    		for (uint8_t spindlestep=4;spindlestep > 0; spindlestep--) {
    			const float step_pwm=(pwm/spindlestep);
    			if ( step_pwm >= 0.20) {
    				spindleForwardPort.WriteAnalog(step_pwm);
    				delay((spindlestep)*200);
    			}
    		}
    	}
    	currentRpm = configuredRpm = rpm;
    }
    

    Hope this will contribute to project, and maybe someone can easy create a M??? P? parameter to define a soft start time to put in config.g


Log in to reply