Author Topic: Laser Engraving for Greyscale Images  (Read 16146 times)

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 269
    • View Profile
Laser Engraving for Greyscale Images
« on: October 11, 2020, 06:09:47 am »
I have started this new topic as a follow on from the Laser Project (https://cambamcnc.com/forum/index.php?topic=8372.0) where there has been a long discussion on how to setup a laser on a CNC router and undertake laser engraving to represent greyscale images.  That topic has provided much of the background for this new topic in the Plugins section, so I won’t be repeating here what has been previously discussed.

The purpose here is an attempt to pull some of these prior discussions together into an operational procedure to attempt these laser engraving tasks.  My interest was triggered after I purchased a 15W (notional) diode laser of Chinese origin, then went through the process of connecting it up to my Mach3-based controller to see what was possible.

Setting up the laser depends on being able to control it, turning it ON/OFF and vary its power output using the PWM signal available in the controller board.  In CamBam this is facilitated by way of a special purpose post-processor that inserts the required G-Code commands, into the G-Code output file, to turn the laser ON/OFF as required.  You may need to tailor this post-processor to suit your particular hardware setup.

With that done, simple engraving and cutting is a matter of setting the required power, feed rates and number of pass parameters in the MOP and using the required post-processor to produce the G-Code file.  To produce a greyscale image, it is a little more complex.  The CamBam models are typically formed by scanning a greyscale image using a height map generator or something similar. Essentially there are two approaches:  one is to vary the output power depending on the Z-values, the other is to vary the feed rate depending on the Z-values to achieve a similar effect.

In the preceding topic, the first of these approaches was facilitated by way of a post-processor post build command application that performed this mapping task automatically from the post-processor.  I have attempted here to provide an easy-to-use option that is provided as a CamBam plugin.  After producing the required G-Gode output file using the laser post-processor, the plugin can be used to select either of the above strategies and to set various parameters for the grey-scale mapping.  I have found it more convenient to use the plugin option as it allows for the easy testing of the options available. 

I also have a postprocessor command line application version, and this option can be set up to run automatically, but any parameter settings must be done in the post-processor specification.  It may be possible pass these parameter values from a MOP specification as Post Build Command Args (perhaps using macros), but I haven’t yet figured out how to do that.  Any help would be appreciated.  If this could be achieved, then this more automated option may better suit some.

I am attaching V1.0.0 for evaluation, comments and feedback.   A sample engraved image (on MDF board) is also provided.

Version 1.0.1 now attached.

New version 1.0.2 now attached, see later discussion for details
« Last Edit: February 05, 2021, 02:16:01 am by GeoffreyGRoy »

Offline EddyCurrent

  • CNC Jedi
  • *****
  • Posts: 5253
  • Made in England
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #1 on: October 11, 2020, 10:08:17 am »
Geoff,

Now this is very interesting.
As it happens I recently purchased a gas laser commonly know as a "K40" and have been experimenting along those lines. Due to the control board in it I opted for a dithered approach ; https://cambamcnc.com/forum/index.php?topic=8455.msg67064#msg67064
Feed rate does have a huge effect on the burn density so that would be good to try out.

It might give you some further ideas if you have a look at these applications, source code available for both too.

https://scorchworks.com/K40whisperer/k40whisperer.html
https://github.com/meerk40t/meerk40t/blob/master/README.md
Filmed in Supermarionation

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #2 on: October 11, 2020, 13:01:44 pm »
Hi Geoff,

Thank you. I'm very much interested in your effort and will test your plugin once I catch up with Christmas projects (yes, this time of the year) ;D

My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #3 on: October 11, 2020, 13:22:28 pm »
Hi Geoff,
Just finished reading your manual (pdf file) where you mentioned..
 " This controller does not seem to support M10 & M11
commands, so some other strategy was required to minimise the effects of start-up delays.
After some experimentation, the following strategies have been adopted to tune the post-processor.
• The M8/M9 (flood coolant ON/OFF) commands were used to turn the laser ON/OFF
• The M3 (Spindle ON (CW)) is used to turn on the PWM signal (with spindle power OFF).
• The PWM signal is used to control the laser power from 0 to 100% by setting the Snnn
values."

Because my setup use MP10 & MP11 (laser on/off) commands, I was wondering if there be an option in the plugin to adopt to particular machine. In my case, M8/M9 control vacuum and air assist. Thanks.   
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 269
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #4 on: October 12, 2020, 09:23:45 am »
Dear Bubba

The plugin does not set or modify the laser ON/OFF G-code commands, these are set in your post-processor.  You simply produce your G-Code file using the post-processor that suits your setup, then run the plugin.  Your post-processor should most probably not include any Post-build command.

Geoff

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #5 on: October 12, 2020, 11:30:21 am »
Hi Geoff,

Sorry for my senior moment :-[ :-[. Of course, the post processor does this. I guess what confused me, was the operating manual where you mentioned of using M8/M9 as laser on/off switch. 
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7378
    • View Profile
    • Cambam V1.0 French Doc
Re: Laser Engraving for Greyscale Images
« Reply #6 on: October 12, 2020, 21:30:04 pm »
Hello

Thanks for this plugin  ;D

++
David

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #7 on: October 13, 2020, 11:28:53 am »
Hi Geoff,

In my first attempt to use your plugin lasering the grayscale test I'm not getting clearly defined rectangular shapes and text as you have. Pretty much I'm getting lines across, not like seen is your test sample where shaded rectangulars are clearly defined.  Would you like to share what settings did you use in the Heightmap Generator, it seems that is my problem. BTW, I really like the result you are getting as seen in the manual. 
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline GeoffreyGRoy

  • Wookie
  • ****
  • Posts: 269
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #8 on: October 13, 2020, 23:30:03 pm »
Dear Bubba

Specifically:
(1) I loaded the image into using the CamBam HeightMap Generator plugin
(2) Set the X and Y size to 200 mm
(3) set the X & Y steps to 0.5 mm, Zmax to 0 and Zmin in to -10mm
(4) created the G-Code file using my laser post-processor
(5)then with my plugin using S-mode with Zmin mapped to 100% laser power (i.e. S = 1000 in my setup)  and z=0 mapped to 0% with a feed rate of 800 mm/min
(6) using MDF board

I will attach the original image (in case there is a problem there).
Geoff

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #9 on: October 13, 2020, 23:59:01 pm »
Hi,
Thank you Geoff, I will try this tomorrow and post results back.
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #10 on: October 14, 2020, 23:41:20 pm »
Hi Geoff,
Here it is,  the sample piece is done using your Heightmap settings and Laser conversion plugin. All numbers were exactly what you had except they were converted to inch units. I'm happy how it turns out as always some tweaks are needed, change the scanline resolution and possibly increase feedrate a bit. Over all I'm getting an understanding how to setup the Heightmap along with the Laser convert plugins. Gonna try picture next.

Bubba
ps. this sample was lasered on softwood plywood.
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1812
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #11 on: October 15, 2020, 12:26:34 pm »
Bubba
I'm not going to Hi-jack Geoff's thread and won't post here anymore,but you need to know this.
The PP you are using is the linking lines version which is not recommended for
rastering photos but rather cartoons, it's also an older version and puts a darker dot
at the start and end of lines, just use the standard pwm raster version.
Here are few shots of the differences.
Dave

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #12 on: October 15, 2020, 13:29:33 pm »
I'm not going to Hi-jack Geoff's thread and won't post here anymore
**********************
Dave,

Why not. I always value your opinion. As far as I'm concerned you are welcomed to post here any time you want. ;D
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1812
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #13 on: October 16, 2020, 05:27:03 am »
HI Bubba

I just feel that this thread is Goeff's thread about a plugin that he has made and don't want to
have it wander off topic.
I will try to write down some thought's on the subject of lazing Images with a cnc machine and post it
at the end of your last Laser thread.

Dave

Offline Bubba

  • CNC Jedi
  • *****
  • Posts: 3353
    • View Profile
Re: Laser Engraving for Greyscale Images
« Reply #14 on: October 16, 2020, 10:50:20 am »
That's very thoughtful of you. Thank you.
My 2¢

Win11, CB(1.0)rc 1(64 bit) Mach3, ESS, G540, 4th Axis, Endurance Laser.