Instructables

Arduino Laser Engraver

Featured
I started this project because I wanted to make something that had mechanical, electrical and software components. After looking around on Instructables, I figured that an Arduino based laser engraver would be an interesting machine to make, and that the machine itself could make interesting things. Laser diodes have also advanced quite a lot in the last few years, allowing reasonably powerful DIY laser engravers to be made without the hassles of laser tubes.

This machine can engrave wood and cut paper. I haven't tried other materials yet because there is no fume extraction capability - plastics generally create toxic gases when burnt.

SAFETY WARNING - Please be safe when using lasers. The laser used in this machine can cause permanent eyesight damage, and probably even blindness. When working with powerful lasers (>5mW), always wear a pair of laser safety glasses designed to block your laser's wavelength.

For a quick overview of the guts of the machine, have a look at the video below
(Note: The machine runs slightly faster now, and also has a different laser heatsink to the one in the video)



For pictures of engravings, skip to the end, or visit my website's gallery:
http://getburnt.weebly.com/gallery.html

A spreadsheet containing the parts list is below.


Also, for any Aussies unsure about the laser import laws, I've attached the current rules (at Dec 2013) below. Laser diodes and laser modules (such as the one in this machine) are legal, however laser pointers are prohibited.
This is a pdf version of the following webpage: http://www.customs.gov.au/site/page4372.asp
 
Remove these adsRemove these ads by Signing Up

Step 1: Frame Design

Picture of Frame Design
machine3d.png
Before starting construction, I made a CAD model of the machine to make sure that everything would fit, and to figure out the dimensions of the parts. Some screenshots of the machine's CAD model are above.

The y-axis is on the bottom of the machine, and provides a moving base for the engraved piece. The x-axis is on the top, and moves the laser assembly (the laser isn't shown in the model).
1-40 of 65Next »
zero2one135 days ago

sir can i have your cad file? tp get the detailed measurements for the frame, if its alright. thanks.... :)
zero2one0813@gmail.com

imont12 days ago

can you explain the steeps to print raster image, how do set the place where to print? how do you send the firle to print_? what do you charge in your arduino?

getburnt (author)  imont11 days ago

Here are some detailed steps. Let me know if there is a section that you'd like more details about.

Arduino:

Upload "cncmotors_driver3.ino" to the Arduino
through the Arduino IDE (sketch editor).

You can edit parameters such as time
delays and the "scalefactor" variable to match your machine, then upload to the Arduino

Processing:

The Processing sketch streams the text file to the Arduino. Try
the steps below to get it working:

Copy the "textfilestreamer2.pde" file to a
location on your computer. As an example, I'm going to use "C:\"

Open the "textfilestreamer2.pde" file. If
Processing has been installed correctly, a popup message will appear, and tell
you that the file needs to be inside a sketch folder. Click ok, to create the
folder.

You will now have the folder "C:\textfilestreamer2\"

Create the folder "C:\textfilestreamer2\data\"

Copy the text file you generated and paste it into
"C:\textfilestreamer2\data\"

In Processing, click "Run"

It should start sending data to your Arduino - the Rx/Tx
status LEDs on your Arduino should start flashing.

Note: The Processing sketch has been configured to use
"COM3" to talk to the Arduino. If your Arduino is on a different COM
port, you can either change it to COM3 in Windows Device Manager, or edit the
sketch to match your configuration.

Setting Start Position:

You can use the serial monitor in the Arduino
IDE (sketch editor), to send manual user inputs and set the start position.

Click "Tools" -> "Serial Monitor". Then, you can enter
the numbers 1,3,5 or 7 to move the X/Y position. For example, sending the text
"1111111111" will send instructions to make the laser move 10 steps (1mm) to the right.

imont getburnt11 days ago
thanks a lot, now is very clear. One more question, in order to set the speed of the motors, i must to use the same size of stepper motor in both axis (x,y) Is this correct?
getburnt (author)  imont10 days ago

Yes, I recommend using the same motors for both axes, so that properties such as the number of steps per revolution are the same.

The motor speed is set by the variables "shortdelay" and "longdelay" in the Arduino sketch. A smaller delay will result in the motor rotating faster, but if it is too small, the motor will stall.

Also, if you are using different motors, with different steps/rev, you can still use them, but you may need to modify the Arduino/Processing sketches, to correct image distortions.

imont12 days ago

can you explain the steps for raster engraving please, i only know ho to get the instruction from the image, then i lost, i have the processing.exe but i dont know how to send the image to my cnc laser

andrew_h8 months ago
How did you go getting the laser 1.5W modules into Australia or did you buy them locally somehow? I've got a chinese CNC machine that i've been thinking about adding a laser engraver to for ages - This would be an easy mod...
jonrb andrew_h1 month ago

I know I'm very late to this one, but for the benefit of anybody else wondering about this, I thought I'd answer.

Depending on your state, laser diodes themselves aren't actually outlawed. Victoria, for example, bans only the importing of laser pointers, which it defines as being handheld battery powered devices. Importing the diode itself is fine, and if they confiscate it, you have the right to whine.

getburnt (author)  andrew_h8 months ago
Yeah, I had the same concerns before I bough the lasers from the US. When I checked the Customs restrictions, my understanding was that only fully assembled portable lasers (eg those flashlight / torch types) are illegal. It should be legal to import the laser modules that I've used because they can't actually work until you add extra electronics.
If you're unsure, you could also check with the seller to see if they've encountered any problems delivering to Australia.
KennethRJ1 month ago

Very nice and professional build! I am wondering: Isn't it overkill to use high torque motors when (only) operating a laser ? The build seems strong enough to be use as a dedicated CNC machine, but this must add to the cost ?

getburnt (author)  KennethRJ1 month ago

Thanks! Yes, the motors are a bit overpowered for the task, but this has some advantages. Since the machine has been assembled, the motors have never skipped any steps or stalled. This gives me some extra confidence when engraving larger images (which can take 2+ hours), because it reduces the chance of the machine creating wonky or corrupted engravings.

However, I think motors with less torque should work properly too.

gwork11 month ago

This is one of the best instructables I have ever seen. My diode arrived today, time for some fun :)

I have a question about the photographic style images - what preprocessing was applied to the bitmaps? If I load any colour image, of course no pixels are white, so the result is total blackout.

gwork1 gwork11 month ago

I also wondered why your image processing takes so long. I tried the C# code below, it only takes a few seconds. Writing a file is not going to add materially to that (although I will use C# as my GUI and to communicate with the Arduino, I have this working for my CNC lathe)

using System.Drawing;

private void buttonOpenFile_Click(object sender, EventArgs e)
{
Bitmap image1;
OpenFileDialog fDialog = new OpenFileDialog();
fDialog.Title = "Open bitmap file";
fDialog.Filter = "Bitmap files|*.bmp;*.jpg;*.gif" ;
fDialog.InitialDirectory = @"C:\Dropzone";
if (fDialog.ShowDialog() == DialogResult.OK)
{MessageBox.Show(fDialog.FileName.ToString());
image1 = new Bitmap(fDialog.FileName.ToString());
pictureBoxMain.Image = image1;
int x, y;
for (x = 0; x < image1.Width; x++)
{
for (y = 0; y < image1.Height; y++)
{
Color pixelColor = image1.GetPixel(x, y);
if (pixelColor.R != 255 || pixelColor.G!= 255 || pixelColor.B!=255)
{
Color newColor = Color.FromArgb(0, 0, 0);
image1.SetPixel(x, y, newColor);

}
}
}
}
}

getburnt (author)  gwork11 month ago

For the photos, I used a combination of GIMP (www.gimp.org) and MS Paint.
The general steps I used are:
1. Open the photo in GIMP
2. Increase the brightness by +127
3. Increase the brightness again by +50
4. Convert to grayscale (Image -> Mode -> Grayscale)
5. Convert to 1-bit dithered image (Image -> Mode -> Indexed). In the dialog box, select "Use black and white (1-bit) palette", and select "Floyd-Steinberg normal" dithering.
6. Export the image as a bitmap (File -> Export, and export as a Windows bitmap). The file will be saved as a 1-bit bitmap.
7. Open the file in MS Paint, and resave it as a 24-bit bitmap.
The brightness adjustments are probably machine specific, and would depend on your machine's pixel pitch and laser power. I just used trial and error to find the settings that would produce an image with good contrast.

The time taken for the C# program to process images seems to increase exponentially with image size - I haven't really got round to fixing this yet.
Some background info: when you run the program, you'll notice that it creates two text files. One of these (imagearray.txt) is just the image converted into a 2D array of 0s and 1s, and this gets created almost instantly. The second file (cncinstructions.txt) is the one that can take a very long time, where the program produces the motor/laser instructions using the 2D array of 0s and 1s. It does this by iterating through the 2D array of 0s and 1s, row by row. For each row, it initially finds the location of the first burnt pixel and does a count of the burnt pixels. Once it has this information, it starts to calculate the motor/laser instructions for the row, by moving to the first pixel, and working its way through to the last pixel in the row. Also, the program scans consecutive rows in opposite directions (eg row 1 L-R, row 2 R-L, row 3 L-R,....). The slowness might be due to the way C# handles 2D arrays - some articles I've read suggest flattening a 2D array into a 1D array for a big performance improvement. There are also some nested loops which would need to be run many more times for higher resolution images. If you want, you can send me an email (getburnt1@gmail.com), and I'll send you my C# source code.

Also, don't forget to wear your laser safety glasses!

gwork11 month ago

255 oz/inches seems way overpowered! I run a metal lathe with 125oz/inch motors. One is a little underpowered (the leadscrew), the other (cross slide) is fine. This is pushing a heavy cross slide holding a cutter chewing into metal. And on Acme threads which have higher friction than ballscrews. I'm very surprised that a Nema 11 would not be powerful enough.

getburnt (author)  gwork11 month ago

Yes, the motors have much higher torque than required by this machine. When I was building it, I didn't know what speed the machine could run at, so I got overpowered motors to be completely sure that they would never stall or skip steps at any speed. In an earlier design, I used NEMA 17 motors with M8 threaded rod leadscrews, and they stalled very easily (unless they were running at a very low speed).

have you worked on anodized aluminium since then?

getburnt (author)  TfdPaintball1 month ago

I haven't tried it yet, but unfortunately I don't think it will work. The laser diode isn't very powerful (compared to laser engravers with laser tubes), and it may also be the wrong wavelength for anodized aluminium. There's a comparison of some laser wavelengths here:

http://www.troteclaser.com/en-US/Support/FAQs/Page...

Also, these Kickstarter campaigns use laser diodes that are similar to my machine, and they both list the materials they have tested:

https://www.kickstarter.com/projects/1537608281/la...

https://www.kickstarter.com/projects/mrbeam/mr-bea...

They both say that aluminium can't be engraved.

bob1.6187 months ago
The third pin on those laser diodes is an optical feedback pin, which lets you set the appropriate input power. If you don't use it, you risk destroying the diode with thermal runaway if you drive it near the rated output, or so I've heard. You can build a simple feedback supply for a few bucks more than the one shown above. Look here for ideas: http://www.repairfaq.org/sam/laserdps.htm.
Send me the circuit of the above I couldn't under stand which wire goes where.
getburnt (author)  bob1.6187 months ago
Thanks for the info!
When I upgrade the laser diode to a more powerful one, I'll look into using that third pin in a new laser driver circuit. I don't want to end up with very expensive LEDs :P
imont7 months ago
Hi, can you explain me the steeps to print raster images, please.
getburnt (author)  imont7 months ago
Hi, if you are planning to use the software on step 8, here is a more detailed overview of the procedure:

First, you will need the Processing IDE installed on your computer (link is on step 8). Currently, I am using version 2.0.1 32-bit, with the Serial library. (Serial doesn't work with the 64-bit version at the moment)

From Step 8, download and extract "CNC Image Program.zip" to a folder on your computer (eg C:\CNC Image Program). There should be three files in the folder

Prepare a 24-bit bitmap file. Find a picture, convert it to black and white only (eg use GIMP / Photoshop to dither it to a 1-bit image) then save it as a 24-bit bitmap.

Run the "CNC Image Program.exe" program
In the program's text box, enter the full path to your bitmap file. There is a sample bitmap (arduino.bmp) included with the program that you can try first. The path would be something like "C:\CNC Image Program\arduino.bmp" (depending on where you put the folder)
Click "OK" and after a while, the image should be displayed by the program. The file "cncinstructions.txt" should have been created in the folder (eg C:\CNC Image Program\cncinstructions.txt)
(If you need to run the program again, clear all .txt files in the folder)

From Step 8, download and extract "processing_sketch.zip" to somewhere on your computer (eg C:\). Run the file "textfilestreamer2.pde". The Processing IDE should start, and ask you if it can move the file into a folder. Click yes/ok, and the .pde file will be in a new folder (eg C:\textfilestreamer2\texfilestreamer2.pde)
In the folder, create a new folder called "data" (eg C:\textfilestreamer2\data) Copy the generated file, cncinstructions.txt, into the data folder

From Step 8, download and extract "arduino_sketch.zip" to somewhere on your computer (eg C:\). Open the .ino file and upload it to your arduino. Also, the Arduino needs to be configured to use COM3

After all these steps, all you need to do is click run in the processing sketch. It will open a serial connection to the arduino, and begin sending instructions. The arduino will interpret the commands and move the motors / control the laser.

Tried to run "CNC Image Program.exe" program, keep getting 'not a valid Win32 application', my system is winxp 32

getburnt (author)  atlantisarn4 months ago

I've just uploaded a version that has been compiled for Windows XP. Give this one a try (it's also on Step 8) - let me know if it still doesn't work

Thanks, it works

Now, I'm trying to figure out how to get laser work, you used pin 12 or pin13 to control laser pulse?

getburnt (author)  atlantisarn4 months ago

The Arduino sketch in Step 8 uses pin 51 (I used an Arduino Mega for the raster engraving). You can change it to any pin you want, by configuring the variable "LASER".

works great

I'm using salvaged stepper motors, pretty sure they are less 200steps per rotation, and they have different steps, so I need to increase scalefactor separately for both of them and delays as well?

for now, I have a result of flattened image

I set two different scale factor for x and y motors, the result is much better.

I burned the image on a piece of black paper, will try the wood later

awesome works, by the way

sample.jpg

engraving on wood

IMG_20140324_032239.jpg
getburnt (author)  atlantisarn4 months ago

looks great!

DBender5 months ago

Hello friend, I changed the resolution to 2 and the image was distorted, changed to 4 and also was bad ... you know tell me why? the laser is always on? Arduino which pin should I connect the laser? thank you

getburnt (author)  DBender5 months ago

The distortion is probably because of a timing problem.

If the Processing sketch is sending new instructions to the Arduino before the motors have completed their previous instructions, the image will be distorted. Try setting larger delay values in the Processing sketch. Once you have delays that work, you can gradually reduce them until you get to the fastest speed for your machine.

The laser is pin 51 (I used an Arduino Mega). You'll need to change this if you aren't using a Mega

DBender5 months ago

Friend, I took a look here, I think the problem is that my machine uses belts and not zone, so the motor moves the laser more than one zone ... how can I change the software zone for belt?

getburnt (author)  DBender5 months ago

In the Arduino sketch, you can change the value of the "scalefactor" variable. It is currently set at 8 (8 motor steps per pixel). You can change the value to suit your machine.

Also, if you change it, you may need to change the value of the delays in the Arduino sketch and the Processing sketch. The delays in the Processing sketch should always be a little bit bigger than the corresponding delays in the Arduino sketch.

DBender5 months ago

Olá amigo, Em primeiro lugar, obrigado por seu apoio e ajuda.

Fiz algumas correções e agora os motores se mover, mas ele se move não só em um sentido, o que poderia ser? estabelecer limites passo? ou erro?

They move only one direction until hitting the limit of the machine.

Obrigado.

DBender6 months ago

Hello friend, I'm trying to make it work, I did everything correctly, apparently the program sends data to the arduino, the RX LED blink but the motors do not move ... what can be? thank you

DBender DBender6 months ago

EASYDRIVER used motor driver

getburnt (author)  DBender5 months ago

This could be caused by a number of different things. Here's what I would check first:

  • is there a common ground connection for all components? (arduino, stepper drivers, power supply)
  • is there an enable pin on the stepper driver that has to be pulled high or low?
  • is there enough power supplied to the motor driver?
  • are the step / direction inputs on the driver connected correctly?

While you are troubleshooting, remember that you can manually drive the motors using the Arduino Serial Monitor. Just type in the relevant numbers to send instructions to the motor driver. eg "11111" should make the X motor move the equivalent of 5 pixels. It is easier to experiment using the Serial Monitor, than by sending a full picture to your laser engraver.

Hope this helps!

DBender6 months ago

Hello friend, I have the following error appearing in processing:

The file "cncinstructions.txt" is missing or inaccessible, make sure the URL is valid or the file has been que added to your sketch and is readable.

Exception in thread "Animation Thread" java.lang.NullPointerException

at sketch_140131a.setup (sketch_140131a.java: 43)

at processing.core.PApplet.handleDraw (PApplet.java: 2117)

at processing.core.PGraphicsJava2D.requestDraw (PGraphicsJava2D.java: 193)

at processing.core.PApplet.run (PApplet.java 2020)

at java.lang.Thread.run (Thread.java: 662)

What could it be? Thank you friend.

1-40 of 65Next »