Grbl Mega 5X, RAMPS Board, TTL Laser pin solution

I managed to get my laser working under GRBL Mega 5X which was written for an Arduino Mega 2560 and RAMPS 1.4. The way Gauthier Briere has written the control pin for Spindle PWM places it on D8 which is ordinarily for the heated bed and runs at 12V. My little 3.5W laser runs on 12V but has a third wire for TTL which wants 5V. I have read a variety of solutions, some simple and some complicated. I finally found this solution:

In short, it uses the D6 Pin located in the Servo area on the RAMPS board. This pin doesn’t seem to be used for anything else. It is associated with an 8 bit timer which gives 255 power levels (instead of a 10 bit timer and 1000+ levels with D8) but this seems to work just fine for me so far.
To implement it I downloaded the Mega 5X Edge file with all of the various GRBL related folders, Cut and Pasted the solution into the cpu_map.h file over the one specifying D8 (right at the end of the file), recompiled everything in Arduino IDE, created a Hex file which quickly uploaded with Xloader.

In the end this was a very easy solution so a Big Thanks to the guy who figured it out and posted it!

The big bonus is that I can use the laser with Grblgru and a 4th axis on my CNC. The program makes the laser follow the curves I map in and so stays in focus! Otherwise it controls my TTL laser in the usual XY(Z) suitable for Lightburn.

Can you add a video showing your work. this modified support TTL ??

Looks like the forum doesn’t want a video file so here is a photo of a rough piece I burned quickly. I left the laser a little unfocused to make a bigger mark to see. MPCNC with a 3.5 watt laser about 50% power. It clearly follows the curve of the piece.

1 Like


dear friend I’m interested in the subject.

I can not speak much english. sorry.

PWM AND TTL control this method right ?
Can you make a sample explanation (TTL USE)

It depends on your laser. If it is a 2 wire 12 volt laser you need the 12 volt port on your control board. This is controlled by PWM (pulse width modulation). This is also often for Spindle control too.

If you have a 3 wire laser then 12 volt + and - go to 2 of the wires and a TTL (transistor to transistor logic) or PWM pin is for the third wire. Hook the + and - wires to power. The - connection should be shared with the control board so there is a circuit for the TTL signal. In this case TTL and PWM are the same thing. This can also be for Spindle control depending on the Spindle wiring.

You will need to figure out your control board and laser to find the correct pins.

I power my laser and my RAMPS board with 12 volt so the - (Gnd) is them shared.

i do use marlin. my solution for TTL .

Power ttl control


i do laser machine manufactory .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.