The latest release of grbl, firmware for CNC machines, has by default one pin dedicated to PWM. As far as I understand, if I provide a relevant g-code (e.g. M3 S200) the PWM signal changes accordingly.
However, it seems SG90 does not work. I suppose that the PWM signal has to be configured specifically in grbl code, but what should I look for exactly?
While grbl naturally works with stepper motors for axis positions, recently it has also added PWM control for additional equipment, such as drills, lasers, etc. To quote the docs:
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.
But on reading the tech sheet for SG90 indeed the principle of operation seems to be different.
I strongly suspect the PWM signal produced by GRBL is designed to control the power going to a DC motor and has nothing to do with the signal needed to get a servo to move to a specific angle.
For servos the pulse width defines the position (angle). For DC motors the pulse width determines the power. They are not interchangeable.
DuaneDegn:
I doubt grbl is intended to control hobby servos. I haven't used grbl but I'd imagine the PWM output is for sending step pulses to a stepper driver.
No its for the spindle I think - there's G-code to set spindle speed.