We use cookies to personalize content, interact with our analytics companies, advertising networks and cooperatives, and demographic companies, provide social media features, and to analyze our traffic. Our social media, advertising and analytics partners may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services. Learn more.
Hi,
I need some help in seting variable spindle sped in GRBL so that I can trun the spindle on and off by M03 and M05 commands and control speed. My purpose is not to control the speed but use this pwm output to control the power of laser
FYI: PWM signal and a voltage signal are closely related but still too different things.
So in order to hook up your laser one needs to know:
Does the laser require a PWM signal or an voltage (analog) signal?
PWM is generally 0 to 100% duty cycle
Voltage is generally 0 to 5V.
However honestly this doesn’t matter, since you don’t have control over this anyway…
Like you measured already, you can only tell GRBL the speed you want, and it will adjust the PWM for you.
Realisticly, the higher the PWM the higher the voltage will be.
From the same GRLB wiki:
If you have a desire or need for spindle or coolant control, Grbl will toggle these output pins (D12, D13, A3) high or low, depending on the G-code commands you send to Grbl. With v0.9 and variable spindle PWM enabled, the D11 pin will output a range of voltages from 0V to 5V depending the spindle speed G-code command. 0V indicates spindle off in this case. Since these pins are all application dependent in how they are used, we’ll leave it to you to determine how to control and use these for your machine. You can also hack the spindle and coolant control source files to easily alter how they work and then compile and upload your modified Grbl through the Arduino IDE.
Try a M3 S99999 and see what the max voltage is. Hopefully it’s 5V. Scale your GCODE software from there when controlling the laser.
I solved it.
I had to change the config.h file in GRBL
#define VARIABLE_SPINDLE // Default enabled. Comment to disable.
// Used by the variable spindle output only. These parameters set the maximum and minimum spindle speed
// “S” g-code values to correspond to the maximum and minimum pin voltages. There are 256 discrete and
// equally divided voltage bins between the maximum and minimum spindle speeds. So for a 5V pin, 1000
// max rpm, and 250 min rpm, the spindle output voltage would be set for the following “S” commands:
// “S1000” @ 5V, “S250” @ 0.02V, and “S625” @ 2.5V (mid-range). The pin outputs 0V when disabled. #define SPINDLE_MAX_RPM 1000.0 // Max spindle RPM. This value is equal to 100% duty cycle on the PWM. #define SPINDLE_MIN_RPM 0.0 // Min spindle RPM. This value is equal to (1/256) duty cycle on the PWM.