I don’t have a laser, but I’ve helped a couple of people get their laser working. First, there is a potentially “easy” way of getting it working. You can plug TTL/PWM input into a set of fan pins and control the laser with the g-codes that set fan PWM for those pins. Depending on how these pins are wired, there can be issues. And even if they work, I’ve read complaints about poor performance in Lightburn (popular laser driving software) when driving the laser this way.
Fairly recently there has been laser work done in Marlin, plus Ryan/Jeff have enabled and tested the laser support for some boards. They are only enabling the laser support by default on boards they have personally tested, and the Ramps boards in not one of them. So your first task will be to make a few changes to the firmware and flash the board. Here is a list of line differences in configuration_Adv.h between the Ramps board, which does not have the laser enabled, and the Rambo board, which does.
The pin to use for the laser is defined in Ramps.h in these lines:
// // M3/M4/M5 - Spindle/Laser Control // #if HAS_CUTTER && !defined(SPINDLE_LASER_ENA_PIN) #if !NUM_SERVOS // Use servo connector if possible #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown! #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM #define SPINDLE_DIR_PIN 5
So your laser will need to connect to pin 6 on your Ramps board. You can find a schematic for the Ramps 1.4 board here. Pin 6 is on the Servos block and there are ground pins for the other wire in this block also.
You can test your laser using the M3 and M5 g-code commands. With this laser code enabled, Marlin will also allow you to drive your laser using the G0 and G1 commands with the S parameter.