Laser Manual: Difference between revisions

From Hacklab.TO Public Wiki
Jump to navigation Jump to search
(No difference)

Revision as of 16:21, 20 January 2010

Capabilities

Our laser is controlled by a Linux package called EMC2. To drive the laser, EMC2 plays G-code files. G-code is not very standardized, so you should read up on the specific variety of g-code used by EMC2.

The position of the laser is controlled by the X and Y axes, and the height of the table is the W axis. Motion on all axes is made of discreet steps and can be reproduced extremely accurately. The X and Y axes move 500 steps per inch and the W axis moves 2000 steps per inch.

The actual laser beam can be set to 15 different power levels using the switches on the panel. The power level can also be more finely controlled with G-code. To get a sharp line/cut, the laser needs to be focussed. This is done by adjusting the W axis (the table) until the surface of your workpiece is exactly 2 inches from the lower surface of the lens. There is a white plastic post that can be used to measure this. From the base of the large end of the post to the top of the tapered part is 2 inches.

Components

Precautions

  • Always run the window blower (by plugging it into the wall) while the beam is on, no matter what material you are working with. Any kind of smoke can damage the lens, so the laser chamber has to be ventilated. Leave the blower on for a few minutes after a stinky job.
  • Use only known materials in the laser. If you want to try a new material, do some research and careful experiments first. Certain things have been known to explode or release poison gas under the laser.
  • Test your jobs first with the beam power off. Watch the red light to make sure it's doing the right thing.
  • Do not eat anything that has been lasered.
  • Do not laser your body.

Techniques

HowTo: Load your image for laser cutting To send your gcode (cut) or png (etch-and-cut) image to the linux machine that runs the laser, scp your image to your account on shell.hacklab.to.

This puts your image somewhere the laser can get at it. - The best program for this on Windows is WinSCP. You can get it here: http://winscp.net/eng/index.php At the laser machine, open a terminal. If you are using scp, type: scp user@host :filename . Example for png: supernerd@shell.hacklab.to :thisismyimage.png .

Navigate to the graster directory, and run graster on the image. Graster will generate both a cut job and an etch job from the image.

Materials

EMC2

Homing

EMC 2.3 requires all axes to be homed before running any program. If you don't see little crosshairs next to the coordinates of all 4 axes, just click "Home all". If, for some reason, the gantry gets moved while AXIS is running, you need to "Home all" again because EMC2 has no way of knowing that the carriage is not in the position it thinks it's in.

Focussing

To get the tightest beam, the bottom of the lens should be exactly two inches from the surface of the workpiece. If it's closer or further, you will get less power and more charring around the beam's path.

The focus is adjusted with the W axis in EMC, which controls the table height. Use the + and - buttons to manually move the table. For fine adjustments, change the increments from "continuous" to some small amount. 0.005 inches should be precise enough.

There is a small white plastic post near the laser that can be used to measure the height. Place the fat end on the surface of your workpiece and the flat part of the notch against the side of the lens. If the post doesn't reach the lens or the lens is below the notch, make a coarse adjustment as necessary. Be careful not to bring the lens down on top of the post. When the lens is in the notch, raise the table in small steps while looking straight down at the post through the window. As soon as it moves away from the lens, back up one step.

G-code

How Our Laser Uses G-code

X axis: gantry right/left, 500 dpi
Y axis: gantry far/near, 500 dpi
W axis: table up/down, 2000 dpi

The laser is wired to spindle on/off (M3/M5) and either of the following:
move Z axis to -0.002/+0.002 (on/off respectively)
or
use "digital out" commands "M62 P0" / "M63 P0" for on/off, respectively

That is to say, the laser is on if and only if the spindle is on and one or both of the Z axis and digital out are on.

Controlling the laser with the Z axis can be tricky because EMC2 thinks that there is a moving physical object attached to the axis and tries to constrain its motion. The M62/M63 commands are realtime and instantaneous, meaning that they can be used to turn the laser on/off without affecting X/Y motion, at least in theory. You can put these commands on the same line as a motion command, in which case the laser will be turned on/off at the *beginning* of the motion.

The following feature still needs a bit of tweaking. Don't use it for anything serious yet: The power of the laser can be controlled from G-code by setting the spindle speed with S#, where the number is between 0 and 1. This will effectively be multiplied by the power level set with the hardware switches. Power level set with the S command is fairly detailed, with at least 50 distinguishable levels. The power can be set so low that it only leaves a faint mark on paper.

A G-code program for our laser should look something like this:

M63 P0             (start with laser off)
G0 Z0.002          (ditto)
G0 X2.5 Y3         (move to start position)
F60                (set feed rate)
M3 S1              (enable laser and set to full power)
G1 X7.5 Y3 M62 P0  (turn laser on and start controlled movement)
...
G0 X0 Y17.5 M63 P0 (turn laser off and move gantry out of the way)
M5                 (disable laser)
M2                 (end program)

Since EMC2 automatically turns off the spindle when a program stops, there should be no danger of the laser ever being on unexpectedly. However, just to be safe, you should turn off all laser related signals at the beginning and end of every program.

Converting Files

There are generally two kinds of jobs you can do with the laser: raster and vector.

A raster job fills in a solid shape by moving the laser back and forth and etching each horizontal line of the shape. If you want to draw an image on something, this is generally the way to do it.

With a vector job, the laser moves along an arbitrary path. This is mostly for cutting, but if you just want to draw razor thin lines, you can use vectors for that too.

Graster

To create raster jobs, use Graster: http://github.com/jedediah/graster

Warning: you cannot use the "touch off" feature of EMC with a Graster job, it will not work and bad stuff will probably happen. Before starting a job, make sure the coordinate system is reset by going to Machine -> Zero Coordinate System -> P1 (the first option).

Graster is already installed on the laser PC in the bathroom and you should use it there, if possible, because it is still a bit tricky to install.

To run Graster yourself, you will need Ruby 1.9, not Ruby 1.8. At present, the version of 1.9 in the Debian/Ubuntu repository is very old, do not install it. You will have to build Ruby 1.9 (or later) from source (http://www.ruby-lang.org/en/downloads/). You will also need to install RubyGems and a gem called rmagick (which is used to read image files). This is all a bit of a hassle and a simpler install method is planned for The Future.

Run graster.rb for usage instructions.

The image can be any common format.. PNG is probably best. A job can be configured with command line options or a configuration file. You can generate a default config file with the -g option. A config file looks like this:

dpi: [500, 500]
on_range: [0.0, 0.5]
overshoot: 0.5
offset: [1.0, 1.0]
repeat: [1, 1]
tile_size: [3, 1]
tile_spacing: [0.125, 0.125]
feed: 120
cut_feed: 20
corner_radius: 0.125

dpi: The resolution you want to draw the image at, in dots-per-inch. The laser's natural resolution is 500x500 so you should probably use that for best results. This means that 500 pixels in your image will be one inch on the laser. If you want it bigger, you should scale up the image in an image editing program that has good filtering or better yet, get a higher quality source image.

on_range: The range of lightness values for which the laser will be on. Images are converted to greyscale with range 0..1 and tested against this range. Since the laser tends to darken things, the default is to laser dark pixels.

overshoot: The stepper motors that move the laser can't start and stop instantly, they need time accelerate and decelerate. When drawing raster lines, you want to the laser to be moving at a constant speed from one end all the way to the other. We overshoot the end of the image so the X axis motor can change direction without affecting the burn. The default value seems to be enough for even the fastest speed.

offset: The location of the bottom left corner of the image, relative to the bottom left corner of the laser table. This allows you to reposition the whole image. EMC has a similar feature in AXIS but you can't use that feature with Graster.

repeat: Number of times to repeat the image in the X and Y directions. Yup, this lets you burn a whole batch of things instead of just one.

TODO:

tile_size: Size of repeated images tile_spacing: Gap between repeated images feed: Feed rate for rastering cut_feed: Feed rate for cutout corner_radius: Corner radius of cutout, 0 for pointy corners

Other Tools

DXF Workflow

  • I have had success doing 2D designs in QCad which is free for Linux and has ready-to-run packages in Ubuntu. It is installed on pubtoob at the lab. QCad saves very clean DXF files.
  • I have used this python dxf2gcode converter. It's pretty rough feeling, but if you set it up properly you can make gcode that works on the laser. Sometimes it has trouble with curves and makes invalid gcode, but it's open source so you can fix it!
  • I have found that DXF files from CAD programs other than QCad cause the dxf2gcode converter to break. Your mileage may vary!

SVG Workflow

  • Avatar-X developed an SVG to Gcode converter. It runs in Windows and is available from svn here: avbrand svn with a username and password of guest/guest. Avatar-X is no longer a Hacklab member so I'm not sure how long this will be around or supported.
  • the SVG converter works well with files from Inkscape which is free on many platforms and I think also installed on pubtoob.

Troubleshooting

Beam does not turn on/stays on all the time during Graster job

  • Ensure the coordinate system is reset by going to Machine -> Zero Coordinate System -> P1. You can't use the "touch off" feature of AXIS with Graster.

Obsolete Stuff (ignore this)

Gallery

LaserProtocol