[Home]Rastering With A Laser

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Difference (from prior major revision) (no other diffs)

Changed: 3c3
There are many applications that needs to run faster than usual. Especially laser rastering and high-resolution vectorial movements.
There are many applications that need to run faster than usual. Especially laser rastering and high-resolution vector movements.

Changed: 5c5
But there are several factors which slow down the system, like the time that EMC2 takes to execute each line of Gcode.
But there are several factors which slow down the system, like the time that LinuxCNC takes to execute each line of G-code.

Changed: 7c7
Taking into account these difficulties, this guide aims to bring rastering to users to the least painful way possible.
Taking into account these difficulties, this guide aims to bring rastering to users in the least painful way possible.

Changed: 17c17
EMC2 is usually used for engrave vector graphics, moving a drill or a laser along the edges of a shape, for example. Rastering mode means move to the next pixel and update the laser power rapidly in one axis (like X axis). This movement should be at constant speed at X axis. You can find videos on youtube about rastering to have a clearer idea.
LinuxCNC is usually used to engrave vector graphics, moving a drill or a laser along the edges of a shape, for example. Rastering mode means move to the next pixel and update the laser power rapidly in one axis (like X axis). This movement should be at constant speed at X axis. You can find videos on YouTube about rastering to have a clearer idea.

Changed: 19c19
Actually, if you go from X0 to X100 to X200 to X300, EMC2 will stops at X100, then goes to X200 and stop then goes to X300 and stops. That means the laser will burn more time at the points 0, 100, 200, 300, etc. If you're engraving a picture, then the laser will stop at each pixel. So, the actual configuration is impractical for this type of applications, and it is necessary to make some changes to solve this problems.
Actually, if you go from X0 to X100 to X200 to X300, EMC2 will stop at X100, then go to X200 and stop, then go to X300 and stop. That means the laser will burn more time at the points 0, 100, 200, 300, etc. If you're engraving a picture, then the laser will stop at each pixel. So, the normal LinuxCNC configuration is impractical for this type of application, and it is necessary to make some changes to solve this problem.

Changed: 26c26
From Hacklab Toronto, "Graster" is the name of a Image to Gcode converter (made in Ruby language), and it's designed to work with a particular kind of HAL component for EMC2.
From Hacklab Toronto, "Graster" is the name of a Image to Gcode converter (made in Ruby language), and it's designed to work with a particular kind of HAL component for LinuxCNC.

Changed: 28c28
Graster produce two types of files: .NGC and .gmask files. NGC files contains the X and Y movements, and gmask files contains only the laser on/off commands. One reason to separate these instructions in two different files is that EMC2 interrupts the motion each time that normal Gcode on/off commands appears.
Graster produce two types of files: .NGC and .gmask files. NGC files contains the X and Y movements, and gmask files contains only the laser on/off commands. One reason to separate these instructions in two different files is that LinuxCNC interrupts the motion each time that normal Gcode on/off commands appears.

Changed: 32c32
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.
Controlling the laser with the Z axis can be tricky because LinuxCNC 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.

Changed: 35c35
The HAL component stream the laser on/off and moves the X axis at constant speed.
The HAL component streams the laser on/off and moves the X axis at constant speed.

Changed: 43,45c43,45
* ImageMagick?: is a image processing software. It can read, convert and write images in a variety of formats. You can find it in the Synaptic Package Manager (Ubuntu)
* Rmagick: is a Ruby gem, used to read image files. This installarion is all a bit of a hassle. Maybe you can find it in the Synaptic Package Manager (Ubuntu)
* RubyGems?: is a package management framework for Ruby.
* [ImageMagick]: is an image processing software. It can read, convert and write images in a variety of formats. You can find it in the Synaptic Package Manager (Ubuntu)
* Rmagick: is a Ruby gem, used to read image files. This installation is all a bit of a hassle. Maybe you can find it in the Synaptic Package Manager (Ubuntu)
* RubyGems: is a package management framework for Ruby.

Changed: 56c56
Look at the references [2] to get this files.
Look at the references [2] to get these files.

Changed: 64c64
So, you need to modify the machine parameters (like max speed, acceleration, step duration, etc) for your X,Y,Z axis (X,Y,W axis in this files). You also need to rewrite the pinouts of the parallel port.
So, you need to modify the machine parameters (like max speed, acceleration, step duration, etc) for your X,Y,Z axis (X,Y,W axis in these files). You also need to rewrite the pinouts of the parallel port.

Changed: 66c66
If you run EMC2, and appears a error mesage about the buffer size, try to increase the buffer size in the emc.nml file.
If you run LinuxCNC, and an error appears with a message about the buffer size, try increasing the buffer size in the emc.nml file.

Changed: 101c101
This files also can be useful if you don't want install graster but want to try it (if you already have configured the HAL and INI files for your machine).
These files can also be useful if you don't want to install graster but want to try it (if you already have configured the HAL and INI files for your machine).

Changed: 105c105
I slumped over my keyboard, frustrated and defeated. After an untold number of attempts, I finally came to the solution to get rastering working. Some googling showed me lists of pages talking about adding modules to blacklists, downloading the latests packages and building them and compiling kernels, etc. Sometimes Linux is a pain. But thanks to the help and patience of Hacklab and EMC2 community, this guide could be finished.
I slumped over my keyboard, frustrated and defeated. After an untold number of attempts, I finally came to the solution to get rastering working. Some Googling showed me lists of pages talking about adding modules to blacklists, downloading the latest packages and building them, and compiling kernels, etc. Sometimes Linux is a pain. But thanks to the help and patience of Hacklab and the LinuxCNC community, this guide was completed.

Changed: 109c109
[1] [LaserManual From Hacklab Toronto] (a bit outdated, but may be helpful the troubleshooting section)
[1] [LaserManual From Hacklab Toronto] (a bit outdated but may be helpful, especially the troubleshooting section)

Changed: 111c111
[2] [EMC2 configuration and scripts for the hacklab.to laser]
[2] [LinuxCNC configuration and scripts for the hacklab.to laser]

Introduction

There are many applications that need to run faster than usual. Especially laser rastering and high-resolution vector movements.

But there are several factors which slow down the system, like the time that LinuxCNC takes to execute each line of G-code.

Taking into account these difficulties, this guide aims to bring rastering to users in the least painful way possible.

1. Difference between Vector and Raster Images

Raster images are rectangular grids of pixels, or points of color, as it is typically used for the representation of photographic images. They are stored in image files with varying formats (BMP, JPG, PNG, etc).

Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygons, which are all based on mathematical equations, to represent images.

upload:vector-raster.gif

LinuxCNC is usually used to engrave vector graphics, moving a drill or a laser along the edges of a shape, for example. Rastering mode means move to the next pixel and update the laser power rapidly in one axis (like X axis). This movement should be at constant speed at X axis. You can find videos on YouTube about rastering to have a clearer idea.

Actually, if you go from X0 to X100 to X200 to X300, EMC2 will stop at X100, then go to X200 and stop, then go to X300 and stop. That means the laser will burn more time at the points 0, 100, 200, 300, etc. If you're engraving a picture, then the laser will stop at each pixel. So, the normal LinuxCNC configuration is impractical for this type of application, and it is necessary to make some changes to solve this problem.

2. Available Solutions

2.1. "Graster"

From Hacklab Toronto, "Graster" is the name of a Image to Gcode converter (made in Ruby language), and it's designed to work with a particular kind of HAL component for LinuxCNC.

Graster produce two types of files: .NGC and .gmask files. NGC files contains the X and Y movements, and gmask files contains only the laser on/off commands. One reason to separate these instructions in two different files is that LinuxCNC interrupts the motion each time that normal Gcode on/off commands appears.

The laser is wired to spindle on/off (M3/M5) and is on if and only if the spindle is on and one or both of the Z axis (-0.002/+0.002) and digital out ("M62 P0"/"M63 P0") are on.

Controlling the laser with the Z axis can be tricky because LinuxCNC 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 HAL component streams the laser on/off and moves the X axis at constant speed.

2.1.1. Installation

Graster installation:

If you want to use Graster to generate the Gcode and commands, you need to meet the following requirements:

HAL scripts and INI files installation:

Files required:

Look at the references [2] to get these files.

2.1.2. Configuration

HAL scripts and INI files configuration:

This is the "hard" part. The HAL script and the INI file were purpose-built for the laser machine at Hacklab. Some work is required to adapt it to other hardware. The position of the laser is controlled by the X and Y axes, and the height of the table is the W axis. Finally, Z axis is used to on/off the laser.

So, you need to modify the machine parameters (like max speed, acceleration, step duration, etc) for your X,Y,Z axis (X,Y,W axis in these files). You also need to rewrite the pinouts of the parallel port.

If you run LinuxCNC, and an error appears with a message about the buffer size, try increasing the buffer size in the emc.nml file.

2.1.3. Usage

Run graster.rb for usage instructions. (in a terminal, run "./graster.rb")

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

2.1.4. Graster Job Output

Graster output consists of a cut G-code file (filename.cut.ngc), a raster G-code file (filename.raster.ngc) and a mask file (filename.raster.gmask).

2.1.5. Examples

PNG image and its converted files, to get an idea of what graster does when it works:

upload:graster-example.tgz

upload:lasercheck.tgz

These files can also be useful if you don't want to install graster but want to try it (if you already have configured the HAL and INI files for your machine).

3. Acknowledgements

I slumped over my keyboard, frustrated and defeated. After an untold number of attempts, I finally came to the solution to get rastering working. Some Googling showed me lists of pages talking about adding modules to blacklists, downloading the latest packages and building them, and compiling kernels, etc. Sometimes Linux is a pain. But thanks to the help and patience of Hacklab and the LinuxCNC community, this guide was completed.

4. Links and References

[1] [LaserManual From Hacklab Toronto] (a bit outdated but may be helpful, especially the troubleshooting section)

[2] [LinuxCNC configuration and scripts for the hacklab.to laser]

[3] [Graster download]


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited September 26, 2017 11:46 am by KimK (diff)
Search:
Published under a Creative Commons License