Spindle RPM - headache

Goal is to: Control spindle RPM with cmmd := M03 Sxxxx, where S is RPM value

Firmware changes:
in Configuration_adv.h:

#define SPINDLE_FEATURE  // Enabled

than enabled PWM on pin which is defined in pins_RAMPS.h: (pin 8 )

  #define SPINDLE_LASER_PWM     true   
  #define SPINDLE_LASER_PWM_INVERT      false

And now the part that gives me the headache:

  • Speed / Power can be set (‘M3 S’) and displayed in terms of:
    • PWM255 (S0 - S255)
    • PERCENT (S0 - S100)
    • RPM (S0 - S50000) Best for use with a spindle



if CUTTER_POWER_UNIT is seated as RPM and command M03 Sxxxxx is send, it turns on PWM on pin but voltage is between 0v and 0.56v.

if CUTTER_POWER_UNIT is seated as PERCENT or PWM255 it works like charm.
In percent mode I can send for example

M03 S50

and voltage on the pin will be ~6v, with

M03 S100

voltage on the pin is 12v, also if it is in PWM255 mode with command M03 Sxxx it works without the problem.

Ups… posted to soon accidentally, sorry guys.

So what you think, did I missed something…any ideas how to solve the issue.

The RPM has dinner more parameters. I think it basically has a min and max rpm. So if you set the min to zero and the max to 30000, M3 S30000 will turn it on 100% M3 S3000 will turn it on 3%.