Change spindle pwm pin in GRBL-Mega1.1

I hope someone can help, as my weeks-long search has not yielded any answers looking at different forums and google searches.

I have a laser that I am wanting to control with PWM using the GRBL-Mega fork. I am using a MKS Gen L board, so the default pin 8 for PWM spindle control is too high of a voltage, as it is running at 24V. My other problem is that pin 6 is also not working and therefore I need to switch to another PWM pin. I have Pin 11 free right now, but even if I switch the DDR and PORT to B and the PWM-Bit to 5, nothing happens on pin 11. I am assuming that it has something to do with the other lines above that make no sense to me.

Does anyone have a good method or resource for changing the pins used in grbl? I would be forever indebted to you as this is a project for my wife and she is not happy that I cannot get it working.


Are you sure your MKS outputs a PWM signal at 24v? I would have thought it much more likely to be 5v.

Ahhh… perhaps the pin 8 is a fan output pin?.. I don’t have that board…in which case it possibly will be 24v…It will also probably be switching the negative and not the positive so that will need inverting to feed into a laser PWM, have you considered just using an opto-isolator to convert your 24v down to 5V PWM and invert it at the same time… Take a look here

1 Like

The board uses Pin 8 as the heated bed control, so 12/24v depending on your power supply.

I had not looked into a separate converter, as I figured switching pins that are already there and not in use would be the easiest. But maybe not…

Many have use the Buck boost type converter
3.5-28V to 1.25-26V DC-DC Converter Boost Buck Step Up step Down Voltage Module
ebay suppliers