Introduction: MPCNC 525 Laser and Enclosure

I made a Multipurpose CNC Machine that was published on I created a few modifications and decided to add a 445nm 2W Blue Laser to the machine, but one thing led to another, so I thought I would share with you the knowledge I gained while going thru this process and the modifications I made to the software and firmware I am using.

The assumptions are that you have already built your MPCNC machine for use as an engraver / cutter with a spindle and you wish to add a 2W Laser Diode to be able to cut and etch with a Laser vs an end mill.

I will document my experience of choosing the Laser to purchase, to making an enclosure to vent the fumes. I will tell you about the software I modified, such as the Marlin firmware for the RAMPS 1.4 board, to the plugins for Inkscape, a graphic design program that creates the GCODE that drives the Laser and where to buy the parts I used in the process.

The 2W laser I am using requires a TTL (5 Volt) PWM (Pulse Width Modulation) signal to trigger the laser. Many people try to use the Fan output with an M106 command for driving the laser, but the fan output is 12V and not suitable for driving the laser and will burn the laser diode out unless you have purchased a laser driver that can accept higher voltages. Plus, we need the fan output for running an exhaust fan to remove the fumes from our work area.

In this project, we will define a pin on the RAMPS board to supply the 5V PPM signal to the laser. See the configuration.h file and pins.h in the modified Marlin firmware posted in my github account at

The pin will activate the laser when an M3 S100 GCODE command is sent to the firmware and extinguish it when an M5 command is issued.

Step 1: What You Will Need

The first and most import thing besides your MPCNC machine that you will need are safety glasses! (

These Lasers are dangerous and can blind you, so don't even think about powering one of these on without first putting on your safety glasses!

I ordered my 445nm wavelength safety glasses from (

NOTE: this laser is triggered ON by default when nothing is connected to the TTL input!

I also ordered a 12" x 12" safety sheet for the door of the enclosure so that I can safely watch the cutting process. You can find it at

You also need a Laser. If you intend to build my Laser mount, it needs to have a 40mm x 40mm footprint. The Laser I chose was this from aptlighting on eBay... (

I will talk about these more in step 3.

You will need a blower to exhaust the fumes from the Laser cutting as these are quite noxious. I made a few test cuts without one and quickly learned it takes days to get rid of the smell. I purchased one from eBay at

The enclosure is made of 3/4" insulation sheeting which I purchased as a single 4' x 8' sheet from Home Depot.


Razor Knife

If you don't have a 3D Printer, you can just cut the insulation and tape it together with duc tape. However, if you do have a 3D printer, I have published a set of components to complete the enclosure at

If you would like to purchase a set of 3D printed parts for your enclosure, contact me and I will make them for you at a reasonable cost.

Step 2: Choosing the Laser

The first step in building a Laser for your CNC machine is to choose which Laser Diode and drivers you are going to use.

I opted for a 445nm 2.5W Blue Laser from China that runs right around $100 and comes with a power supply and built in driver with a TTL input. I bought mine off eBay ( from a seller who goes by the name aptlighting. I recommend this seller because as you will hear about shortly, he is very trustworthy and bent over backward in helping me solve my problems.

In addition, I mistakenly wired 12V to my TTL input and fried the insulation off the wires, but did not damage the Laser Diode.

Certainly, there are many Laser Diodes to consider, but if you wish to build the laser mount I designed, you might want to pick one from this seller which has a 40mm x 40mm mounting distance. The Laser mount I designed can be found at and includes mounting for line lasers ( used for positioning without the need for safety googles.

Speaking of safety googles, you MUST wear eye protection when working with these Lasers! No if, ands, or but's! The beam from these Lasers can easily blind you. You need safety glasses made for the wavelength of your Laser. The 445nm Blue Laser I purchased are used with a RED filter although you can also get them in GREEN.

Step 3: Firmware for Your Laser

The MPCNC machine uses an Arduino Mega 2560 with a RAMPS 1.4 motherboard. The Arduino needs firmware to tell the RAMPS control board what to do, such as moving the X, Y, and Z axis, reading the axis limit switches, and turning the Laser on and off among other things.

The firmware you choose makes all the difference in the world as to whether your machine will do what you tell it to do.

I tried several versions and all of them had problems that made it very difficult to get started using my new Laser.

I ended up taking a version of Marlin firmware that was designed for use on Turnkey K40 Laser and making modifications to it so that it worked in my MPCNC machine. I spent many hours running different GCODE thru the firmware on a test setup and fixing issues with the firmware. It still has a few bugs that I have not gotten fixed yet, but it is better than any of the other firmware sets I have tried.

I put the code up on Github for everyone to enjoy.

Note: The firmware does not process limit switches that are wired as NC (normally closed). It was a bug in the original firmware and I opted to rewire my limit switches to use normally open contacts to trigger the endstops.

The firmware in my Github repository is setup to use an X min, Xmax, Y min, and Z max physical endstop. Feed rates and other configurable items can be tweaked in the configuration.h file.

You will need to compile the code for the Arduino Mega 2650 using the Arduino application and you will need to include the u8glib library in your build ( ).

Step 4: Software to Generate GCODE From Images

Once you have your firmware operational you will need software to create the GCODE for it.

There are some great free versions of software out there, and I recommend using inkScape and the TurnkeyLaser extension or the J-Tech Laser extension as a starting point.

Inkscape is also a free graphics software package that runs on PC or MAC. By adding extensions written in the Python language, you can add a lot of functionality.

The TurnkeyLaser extension consists of two files that are placed in the extensions folder and add an option that is designed to work with the laser firmware. I included the two files I modified in the github repository previously mentioned in an earlier step. Simply copy them to the inkscape extensions folder and select it from the extensions export menu.

If you want to learn more about the extension, visit the original authors github but replace the two files from my repository with those of the original author as they have been modified to correct bugs with the handling of G00 commands. Without the changes, your laser will not turn on during some portions of the cut.

The turnkey laser plugin as well as others I tried, lacked the ability to perform multiple passes. I took an off the shelf plugin called img2gco which I found on Github and rewrote it suit my needs. I added a pass count as well as some other niceties. It is written in PHP and HTML and can be hosted on your own server or locally on your PC if you have the support software installed. You can find it on my Github account at or on my website at It is yet another tool in your arsenal of software you may want to use.

Step 5: There Are Many Variables

You will find that there are many variables that come into play in order to use your laser effectively. It takes trial and error to find the best combination of settings when different materials come into play.

I suggest keeping a record of each thing you cut. I found an iPhone app called "airtable" that let me set up a database to store settings, images of the final cut, etc. I store feed rates, material, laser pass count and power settings for each item I cut successfully.

The 2W laser can cut 3mm Black Acrylic in 4 passes at 100mm/min at full power, but Red Acrylic takes 8 passes at 75mm/min at full power. Forget White, it won't cut at all. Balsa, requires much faster feed rates and much lower power.

The database helps setup your next job because you will have a starting point to work from when setting up a new job.

Step 6: Summary

Load your Arduino Mega 2650 with the modified version of Marlin firmware which you can get from my Github account

Purchase your 2W 445nm laser from a reputable dealer.

Build an enclosure to exhaust the fumes your laser will generate.

Use the modified version of the turnkey K40 laser inkscape extension to create the GCODE for your laser or generate GCODE with my img2gcode PHP software.

Keep track of the settings you use for each project you make.

Have fun! Be Careful! Always use safety glasses with these lasers!