After the proliferation of 3D printers and working with the same XY axis system, desktop laser engravers have appeared on the market, just googling the title of this post to realize the wide variety available.

The “assembly” that is exposed in this article is already a classic in the DIY world, it is about reusing parts of old CD or DVD drives, specifically the stepper motors and the corresponding guide system of two DVD drives to get our X and Y axes. Of course, due to the small size of these recycled parts, we will achieve only an engraving area of only 38 x 38 mm.

These stepper motors will be controlled just like those of a 3D printer using A4988 modules also known as “pololu” or “step-stick”. These circuits generate the four signals that control the windings of a typical stepper motor with four wires (bipolar motor) from two input signals, STEP where we enter a pulse to advance one step, and DIR to select the direction .

These two pins are connected to the MCU / Arduino, so we will use four IO lines, two for the X axis and two for the Y. We will use an Arduino Nano running grbl which is a CNC firmware commonly used in this type of projects. The connection is as follows:

  • STEP X ———- D2
  • STEP Y ———- D3
  • DIR X ———— D5
  • DIR Y ———— D6

The StepStick is powered at 5V on the Vdd and GND pins but the stepper motors require 8V to 35V on the Vm and GND pins. Reset and Sleep connected to each other and enable to GND, although we could control it with the MCU to activate and deactivate the motors getting some energy savings.

Finally there are three pins that require special attention: M0, M1 and M2 are used to configure the microstepping option, highly recommended for several reasons and is also used by Grbl. Microstepping is a technique that significantly increases the resolution of the motor and therefore its accuracy and smoothness of operation, reducing energy consumption and the emission of electromagnetic interference. If a stepper motor normally runs at 200 steps per turn with microstepping, each step is divided on 2, 4, 8, or 16 microsteps so that we will have 400, 800, 1600 or 3200 steps per turn. We can select the number of microsteps by putting Vcc or Gnd pins M0, M1 and M2 as follows (we will use 1/16):

M0M1M2
000Full step (1/1)
1001/2 step
0101/4 step
1101/8 step
1111/16 step

The laser will be mounted on the X axis and the surface to be engraved will move perpendicularly on the Y axis rails in a similar way to the extruder and bed of most printers. The ON / OFF control of the laser is done by a MOSFET transistor controlled by pin D12 of the nano.

As for the laser to be used, there are several options, there are people who reuse the laser diode of one of the DVDR units but I have found it unreliable and should not be hopeful if you decide to travel that path, in addition to the diodes of the DVD Although they are valid, they do not have much power. The most reliable is to acquire a laser diode on ebay or similar. One of the most used is the 1W blue 445nm laser diode, with price about 10eur. On the other hand, a special circuit or driver is needed to power the diode since it works at a constant current and if its nominal current is exceeded it would be damaged or even destroyed.

A driver based on the integrated LM317 can be built in a simple way as shown in the following diagram:

However I have purchased a slightly more reliable one at www.odicforce.com based on the operational LM358 and a FET transistor that allows currents of up to 1500mA. Having a reliable driver is important as laser diodes are extremely sensitive and delicate. This circuit can also be replicated according to the following schematic:

In addition, the laser diode must be mounted in a housing with the proper thermal dissipation capacity since although we feed it correctly it requires dissipating a significant amount of heat, without which the rising temperature would end up ruining the semiconductor. There are different models of housings on the market that also incorporate collimating lenses that are essential to focus the laser beam that would otherwise be totally divergent.

To physically connect the whole set I have designed a support with Autodesk Fusion 360 3D design software, which is free for students and educators and is quite powerful, simple and highly recommended. As another option, you can always reach a solution with simple materials and a bit of thinking.

Once everything is assembled, we will install Grbl in the Arduino Nano or any other based on the Atmega 328p. To do this we download it from its Github repository and, as its wiki explains, we install it in the Arduino IDE as a library and compile and flash it through an example of this library called GrblUpload. Needless to say, the documentation should be read …

Once the firmware has been flashed, it must be configured. To do this, we connect the arduino to the PC and open the serial monitor. You should see a message like this:

Grbl 0.9b
'$' to dump current settings

Obtaining a list of the configuration options when entering the ‘$’ command:

$0 = 400.0 (steps/mm x)
$1 = 400.0 (steps/mm y)
$2 = 400.0 (steps/mm z)
$3 = 30 (microseconds step pulse)
$4 = 480.0 (mm/sec default feed rate)
$5 = 480.0 (mm/sec default seek rate)
$6 = 0.100 (mm/arc segment)
$7 = 0 (step port invert mask. binary = 0)
$8 = 25 (acceleration in mm/sec^2)
$9 = 300 (max instant cornering speed change in delta mm/min)
‘$x=value’ to set parameter or just ‘$’ to dump current settings

The most important thing to configure is the number of steps per millimeter for the X and Y axes that we will set to 53,333 by entering “$1=53,333” and “$2=53,333”. Once done we check it by entering the gcode line: “G91 G28 X0 Y0” (which assigns as coordinates the current position and selects displacements in mm), followed by “X10 Y10”, which should produce 10mm of displacement on each axis . If the movement is not executed in the desired directions, the movement of the axes can be reversed with the $7 command. You can increase the acceleration above 100 and the feed rate and seek rate up to 1000.

Once configured, like any CNC machine, our laser engraver will execute the movements that we request through gcode instructions transmitted through the serial port from a PC. For this we need an application on the PC that sends the contents of a gcode file. We will find several options if we search on google “gcode sender”. I use SourceRabbit GCode Sender.

To convert a graphic file, either photography or drawing, to gcode format to send it to our machine we have two very different options that are not always applicable to any type of image, work in “raster” or “bitmap format” or work in “vector graphics format”.

In raster format, the image is formed by horizontal lines of black or white pixels, the generated gcode file being very large as well as the engraving execution time. This procedure is suitable for engraving photographic images of portraits, landscapes, etc. and we will use DotG utility for this, which requires 1bit bmp files as input in black and white. These can be obtained from any image with one of the many photo retouching or image processing applications and in this case I use FastStone Image Viewer.

It should be noted that in order to use DotG we have to define a postprocessor. There is a user manual where it is more or less clear how to generate a .dgp file to use as a postprocessor, it specifies what type of gcode commands correspond to the movement actions generated from the image. I have written a simple postprocessor that works perfectly for me:

 {header
( - DotG program - processed by amalzaga - amadoralzaga.com )
( - BMP:[bmpfile] - )
( Xmin:[xmin] Ymin:[ymin] )
( Xmax:[xmax] Ymax:[ymax] )
X[xh] Y[yh]
}
{moving
X[xa] Y[ya] F[f]
M3
ifsl
X[sl] F[f]
endsl
M5
}
{pgmend
( end of program )
X[xh] Y[yh]
}

Here I leave a link to download, you have to rename it with a .dgp extension and copy it to the Post folder within the DotG installation, then select it from the user interface of the program.

The following images are a sample of engravings obtained by the raster technique:

On the other hand, to work with vector format graphics, suitable for engraving of more or less complex geometric figures, we will use the open source software Inkscape. It is a powerful editing program for this type of graphics that works with .SVG extension files, acronym for “Scalable Vector Graphics”. In this format the images are formed by lines defined by vectors, whose coordinates are saved in the file, so that they are susceptible to being transformed mathematically (by matrix algebra) without any loss of quality. Scale, rotation, symmetry, etc. can easily be applied.

In order to use a laser engraver with Inkscape generating the corresponding gcode we must install an extension called Laser Engraver. If we look for it on the web, it is likely that it will not work because of a bug caused by changes in Inkscape version 0.92, this is solved by replacing the code line 3080 of the laserengraver.py file as follows:

Original line:
doc_height = inkex.unittouu(self.document.getroot().get('height'))

New line:
doc_height = self.unittouu(self.document.getroot().xpath('@height', namespaces=inkex.NSS)[0])

I have tried to leave an already corrected copy of the laserengraver extension, but my hosting provider does not let me insert zip files for security :-(, we will have to upload it to github … And in the following link we have it available —> https : //github.com/amalzaga/LaserEngraver

We must copy the repository files to the shared/extensions/ folder within the Inkscape installation path on our system, it will require administrator privileges. Once done when starting Inkscape we will have the extension available but how to use it?

We have to start from a graphic in vector format that we can draw ourselves in Inkscape, download SVG files from the internet (most of them are not free or are quite bad) or, which is very, very interesting, we can vectorize with Inkscape images that are originally in bitmap format, that is, any image file. If the original image is formed by well-defined geometric shapes and is not excessively complex, the result can be very good, however with photographs with many details and poor lighting the thing does not usually work. To do this in Inkscape we import the image file and then select “vectorize bitmap” in the “Path” menu. It will generate an object formed by vector paths that define the lines of the drawing and we can save it as an SVG file.

Once we have a vector image, with it selected we go to extensions-> laserengraver, select the output directory and file name, as well as the engraving speed in mm/s and when applying it will generate the corresponding gcode file that, finally , we will send to our CNC-Laser with SourceRabbit GCode Sender. Results such as those shown in the following images are obtained.