Arduino Laser CNC Engraving Machine

Warning: This project uses a laser. It will hurt you if you are not careful. Please take care when handling the laser. Do not look at the beam, do not point it at yourself or anyone else. Remember that an IR Laser can damage the eye just as easily as a visible light one. A good pair of laser goggles must be worn, they must be designed to filter the colour of laser you are using and compliant to  EN207 standards.


Laser CNC

I have built a Laser CNC machine out of a couple of old DVD-RW drives, an Arduino UNO with Grbl v0.8 installed, two EasyDriver Stepper Motor Controllers and bits of wood I have around the home. The laser came from one of the DVD-RW drives.

My Engraver is vaguely based upon the Pocket Laser Engraver by Groover, except I have used an Arduino UNO and have added limit switches. G-Code is a industry standard, of sorts, used to control CNC (Computer Numerical Control) Machines, such as lathes, routers, and in this case Laser Engravers.

Here I will be providing additional information about the electronics and Grbl configuration I discovered while building the Laser CNC. I have used the following software:

Electronics

Stepper Motor Controller

There are four electronic parts to this setup. The 5v power supply, a relay circuit to control the laser driver, the Laser Driver to control power to the laser, and the limit switch circuit used by Grbl to provide a stop indication on the axes.

The Power supply is a nothing glamorous, its a basic 7805 design giving a 5v output.
5v Power Supply
I use a 2A Switched Mode Power Supply plugged into the mains, similar to this 17W Switched Mode AC/DC Multi Voltage Power Supply from Maplins. Using 7.5v as the input is enough to keep the 7805 running without it having to convert too many volts into heat.

To control the laser from the Arduino, I have added a relay circuit. The 5v relay is powered by the power supply above, on one side of the normally open switches is a 5v fan to blow the smoke away, and on the other the Laser Driver, remember to switch the laser driver circuit rather than the laser diode.
relay circuit

The Laser driver using a LM317 Adjustable Regulator is a little more involved, as calculations have to be made to establish the output current. You want enough power to scorch or cut card, but not so much as to burn the laser diode out.
Laser Driver

The power output of the Laser Driver is set by the resistors R1 and R2. This video tutorial gives some explanation. Going above 500mA with a red laser will definitely cause it to blow, I have limited the power to 330mA as I only have a limited supply of lasers. I used this page for calculating resistors in parallel. Here are some milliamp output values using a couple of standard resistors.

Resistors volts / ohm mA
2 x 10R 1.25v / 5R 250mA
2 x 9R1 1.25v / 4R5 270mA
2 x 8R2 1.25v / 4R1 300mA
2 x 7R5 1.25v / 3R7 330mA

The final circuit is for the limit switches, and is based upon one found here:
limit switches
The switches need to be very sensitive, I found using that the motors were not strong enough to push button switches. I used those found in the one of the drives, and a couple from an old cassette deck. Check that you have connected up the switches correctly, X to X, Y to Y, confusion arises when they are the wrong way round and Grbl doesn’t say which switch has made contact.

In Grbl set $16=0 (hard limits, bool) if your image is larger than the allowed size then will just make your drawing look wrong, setting it to 1 (true) will cause the G-Code program to be aborted. $17=1 (homing cycle, bool) will cause Grbl to expect an $H (home) command when started, $H will cause your axes to move to their start positions.

Switch

 

Software Configuration

The only real issue with setting up Grbl, was getting the X and Y axes operating in the expected direction. There are two problems, getting the right start point, and having them go in the correct direction. You will be wanting the image in Inkscape to appear correctly. There are two settings within grbl v0.8 that need to be configured so that it works: $6 (step port invert mask) and $18 (homing dir invert mask). Having spent a while trying out various settings, I wrote a little mask calculator to assist me with this, to find your mask, click the checkboxes, or you can enter the current mask number and click set to find the binary code.

Current
Mask
Axis:
New
Mask
Invert Bit: $6=0
Set:

The documentation says that the first two bits are not used for inversion, but have found that there is a change in the direction of the motors.

Test with your favorite terminal program, on this Linux box I used: minicom -b 9600 -D /dev/ttyAMA0, turn local echo on with Ctrl-A E. Make the table go forward 1cm with X10, or in reverse X-10, Same for the Y axis, Y10, Y-10 further experimentation may be needed when you first start etching, I had a images and text appearing mirrored at first.

Now it is a case of loading your line-art into Inkscape, thin lines work best, creating the G-Code file using the laserengraver option in the extensions menu. Then sending the file to the Arduino with the Universal G-Code Sender. A Guide

My Grbl settings:

Etchnings

Links:

18 thoughts on “Arduino Laser CNC Engraving Machine”

  1. Hi. Thank you for sharing your knowledge and project.

    Im building sort of machine but Imstruggle in the point that I need to drive those steppers usign phase clock signals and not step direction fashion, as it defaults in GRBL. I would appreciate if you could point me some direction.

    Thanks

  2. Great project & write-up! You achieved very nice results. Do you need to wear goggles around this to watch?

    Also, you can reverse the direction of a bipolar stepper by reversing the wires for a single coil.

    Thanks for sharing.

  3. Very nice build. But I have a question, your picture shows you connect your relay curcuit to the spindle enable pin on Arduino but doesn’t the spindle turn on at the beginning of use and shutoff when complete staying on throughout the entire procces? Wouldn’t this cause you laser to be on throughout the entire drawing? Or does the laser engraver extension in inkscape solve that problem?

    Thanks.

    1. Matthew,
      The laser turns on and off throughout the etching. The inkscape extension must be controlling the spindle. I can’t remember the grbl commands to do this now.

  4. Hello Karl,

    You have done a nice job with this project but I have to inject a note of caution.
    Protective eyewear for use with coherent light sources should be of the complementary colour to the laser being used NOT the same colour as you have stated -if you use red goggles with a red laser, by definition they will transmit red light.

    Coherent light entering the eye undergoes an approximate 10exp5 amplification as the beam is brought to a diffraction-limited spot and, although the resultant spot is only a few hundred nm across, the energy density is high enough to cause steam cavitation. The thermo-accoustic shockwave from such a cavitation event can cause damage to the retina much larger than the original spot so please take care.

    Arn

  5. Hello Karl its Matthew again. I just finished up my on my project, which is very similar to yours, and I have only one problem. My CD drives do not run very smooth at slow speeds. Mine jump along the track in a jerky motion as if they’re meeting a lot of friction. I have cleaned and lubricated the tracks but it did not help too much.

    I’m considering wiring the easydrivers to microsteping mode but I am not sure if this will help. Did you have similar problems? Any advice/comments?

    Thanks, Matthew

  6. Great Job! I am trying desperatly to emulate this for engraving wood spoons. Have you tried this on wood? Im thinking if it the wood is to reflective I could darken the surface, then engrave heavily, then lightly sand off the darkened surface..
    Thanks Again!!

    1. Hello Wayne,
      Not tried it myself but don’t see why not, hope you like the smell of burnt wood. Simply up the laser power until it works!, look into comparing the power outputs of blue vs. red lasers (wear the correct safety goggles). On metal one method is to paint the area to engrave matt black then wash it off afterwards.

  7. Hi Karl,
    Your project is great, i’m jealous! I’m trying do the same, but with a pen instead of the laser. The structure is ok, grbl is correctly installed and with manual coordinates it works, but as i try to send an image (i presume is correctly g-coded, because the G-Code visualiser is working and i also tested it with other OpenSCAM), the machine starts to do line with “no-sense”.
    I’ve done many test with different options, but with no results.
    My last possibility is what you say in “Software Configuration”, but I haven’t understood what “mask”, “direction” and “step” are.
    I would be really grateful if you could help me solving this problem because i’m going crazy!
    Thanks in advance

    1. This is what I *think* mask, direct and step mean:

      – Mask: the 8 bits (eg: 01000000) used to configure the step and direction for the X,Y and Z spindles.
      – Step: the pulse to move the motor, is the required pulse high (1) or low (0)?
      – Direction: the direction the motor rotates after it receives a pulse. The direction is determined by the wiring, so 1 could mean forward or reverse.

      Hope that helps, its been more than a year since I last looked at this so I’m working from memory.

    1. I’ve not used that chip but I don’t think it will work, the L293D looks to be for ordinary motors rather than for the stepper motors used in the DVD drives.

  8. Hello, very good your project, ask if it would be possible to write a printed circuit board with this laser?

    A hug

Leave a Reply

Your email address will not be published. Required fields are marked *