MPCNC with Rambo 1.4a running GBRL Mega 5X

My CNC works fine. I installed a Aenbuslm 10W laser on it. I connected the PWM to pin45 on the MK2 pin row. I connected the + - to a 12VDC 15 amp external power supply. My issue is the laser stays on all the time. I sent a M5 command and it will not turn off. It will burn but leaves connecting lines in between. Im stumped here. Any help would be greatly appreciated.

I’m not sure of your specific problem, but want to make you aware that there is a laser safety timeout that turns the laser off after 1 second. This will happen if you turn your laser on from the menu or if it remains stationary for some other reason. Later versions of Marlin have the menu issue fixed, but V1 has not taken a Marlin drop recently.

You can play with pin 45 directly by using M42 in order to troubleshoot the problem.

Robert thanks for your reply. Im running GBRL Mega 5X so it says those commands don"t work

I grounded the PWM and - on the laser and turned it on. No laser beam. I put my oscope on pin 45 . When i ran a test gcode in light burn i never had power on pin 45. Firmware setting maybe? Not sure where to look at this point.

I’m sorry I read past ‘GRBL’ in your title. Pin 45 is defined explicitly in Marlin, and there are other pins on the Rambo that could have been used. It is possible that the GRBL for the Rambo board selected some other pin besides 45, or, as you suggest, a firmware setting. Do you have a link to the source for the GRBL for the Rambo?

I got it off this forum,.

I’m a bit of a hack with the hardware stuff, but when I look through the GRBL files, I find this section in cpu_map.h:

  // Define spindle output pins.
  #define SPINDLE_PWM_DDR   DDRH
  #define SPINDLE_PWM_PORT  PORTH
  #define SPINDLE_PWM_BIT   5 // MEGA2560 Digital Pin 7

If this is correct and they are using Pin 7 for spindle (and for you laser) control, there is an issue. For the Rambo board, Pin 7 is used to control the heated bed. It is ground side switching and the positive pin is 12/24V. This kind of pin does not work well for a laser. If you are set up to compile this code, and if there is any kind of forum for this code, ask how to redefine these three values to map to pin 45.

In a quick skim, I did not get a solid understanding of Ports, but just based on patterns, I’m guessing you want the following for Pin 45:

  // Define spindle output pins.
  #define SPINDLE_PWM_DDR   DDRL
  #define SPINDLE_PWM_PORT  PORTL
  #define SPINDLE_PWM_BIT   5 // MEGA2560 Digital Pin 45

This assumes that DDRL and PORTL have been defined elsewhere.

Another approach is to convert the ground-side switching of pin 7 to a normal 5V PWM signal. I’ve seen a couple of circuits on this forum for converting fan pins (which have the same issue).

you pointed me in the right direction. I had to use PH4 for my Aenbuslm laser. But in the mean time i did not ground the external power supply to the board. Thanks for your help