GRBL PWM frequency for DWP611 duty cycle rpm mapping

By chance, I am temporarily in possession of an optical rpm sensor. A pretty nice one, too. I have a solid state relay, an outlet for a project box, and a Dewalt 611 router. I also have an Arduino lying around, to make the PWM signal and sweep through the duty cycles. I want to see what actual rpms qualite with different PWM duty cycles and router speed settings on the turn dial. However, I’m having trouble finding exactly what the PWM frequency for a GRBL spindle speed controller is. Is it fixed or variable?

The PWM carrier frequency is about 7.8kHz. It uses one of the 8-bit timers and has 255 output voltage levels 5/255 V for the min rpm and 5V for the max rpm. 0V for disabled.

FWIW, I’ll be releasing a new Grbl v1.0 beta on Github later this week (in the edge branch). This will include ‘$’ settings for max and min rpm to help you dial in the rpm with Grbl’s voltage output signal.

1 Like

How will Grbl control RPM of different spindles? I’m not sure I understand what the new update will offer. Also, if the PWM frequency is 7.8kHz, wouldn’t that signal driving a solid state DC to AC relay powering a 120VAC router result in a nearly “always on” situation? Because SSR’s latch on once enabled?

Grbl changes the spindle rpm pin based on voltage only by changing the duty cycle of the “fast-mode” PWM. The frequency does not change. Nor does it have to. If your system requires a shift in PWM frequency (common on servos), then it’s not compatible with Grbl.

Hi Sonny @SungeunJeon

Can we have an update please on any enhancements to Grbl to support lasers please? E.g. a laser mode. I really don’t want to go with one of the laser specific firmwares when I want to use the Inventables build to drive the X-Carve for carving. Being able to switch mods through GCode would be just excellent. :smile:

Cheers

Ian

Yes. It’s on the development path and high up there. Just hang tight. Some cool stuff is coming down the pipeline.

1 Like

So then Grbl can’t really control RPM, just the average on-time of the spindle. That’s why I want to map the RPMs to different speed settings on the Dewalt router dial and PWM duty cycles.

EDIT: And that still doesn’t solve the problem of latching the SSR. At 7.8kHz, the Grbl controller should not be able to adjust the duty cycle to any AC device with an SSR.

1 Like

Grbl CAN control rpm by providing a voltage level defined by max and min rpm settings. X voltage = X rpm. It’s not more complicated than that. It just sounds like this is not the output you want or need.

As a simple solution, you can easily program a small cheap micro controller, like an Arduino Micro, to convert the voltage signal from Grbl to whatever you need to run your Dewalt router directly.

You keep saying voltage instead of duty cycle. I’m not sure you’re talking about PWM any more.

100% duty cycle = 5V
50% duty cycle = 2.5V
10% duty cycle = 0.5V
Etc

Not sure what the confusion here is.

Typically, a PWM signal doesn’t output a variable voltage- it turns a digital output high and low at a set frequency, and the duty cycle refers to ratio of the amount of time the output is high vs low. So a 50% duty cycle would mean, for example a PWM signal at 25Hz, a signal would be high for 20 milliseconds and then low for 20 milliseconds. What you’re describing is an analog output, where the controller could be programmed to output 2.5V. A PWM signal at 50% duty cycle is not 0V or 5V or 2.5V. It is 0V and 5V for an equal amount of time, alternating between the two.

Whether the controller works as an analog output or a PWM output, neither is a solution for controlling AC powered spindles, like a router. The SSR’s I’ve seen being referenced in drawings and shown pictures of around the forum are similar to this, those cheap white SSR’s on eBay. Well, these SSR’s are zero crossover, meaning the output is latched full on until the load current falls to zero. If your PWM signal is running at 7.8kHz, the output is going to be triggered almost instantly at the beginning of the 60Hz AC voltage sinusoidal curve. It doesn’t matter what duty cycle you’re outputting, that output is already latched and the spindle will remain full on until the voltage falls to 0 (zero crossover), at which point the cycle will repeat. Any duty cycle at 7.8kHz would effectively be 100% duty cycle in applications with an SSR controlling an AC load/spindle.

Analog output is performed by PWM by digital switching IO pins like the arduino has. The average voltage of a pin at 50% duty cycle is 2.5V. Or half of the 5V logic high. At a high fixed frequency and or with a small capacitor in parallel, you get a steady voltage output at 2.5V.

Like I stated before, Grbl sends out a signal which indicates the RPM for a spindle controller to interpret and execute based on the user Grbl settings. It’s not Grbls job to directly control a spindle. Only to tell when to turn on the spindle and what speed. That is precisely what the Inventables spindle controller does, as well as the Super PID. If neither solution works for your application, you’ll need to come up with your own electronics to do so.

Ok, now I see. The arduino and motor shield running Grbl cannot control the spindle speed without an external controller to interpret that output signal. Without an Inventables Spoindle Controller or Super PID an AC spindle cannot be controlled beyond turning off and on? A single SSR will do nothing to control the speed of an AC router?