Problem with servo SG90 (and grbl)

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?

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.

I don't see how it would work with a hobby servo.

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.

Jabberwock:
recently it has also added PWM control for additional equipment,

Thanks for the clarification.

A lot of people think it's too bad the servo's input signal is so frequently called PWM. It's very different than what a laser or drill would need.

There are several servo examples in the Arduino IDE. I'm sure you could get lots of help if you wanted to use a different method to control the servo.

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.

...R

maybe late to post here
but there is a GRBL version for a servo on pin 11:

working here with arduino uno 2 stepper motors and a HTX900 micro servo

This will still come in handy, although I will probably need to swap the firmware when I want to use a laser instead of the pen attachment.

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.