Image2Gcode - Free Raster Image Laser Engraving Software - Modified for MPCNC

I just tried reading this post again to help out …and now I have a headache;)
Very hard to tell what software you’re using from one post to the next and then mentions of y axis issues on an image2code thread . Videos that can’t be viewed without an email address submission. … Nothing at all related to mpcnc or the diode lasers that we’re using with the mpcnc.

@Bryan- Thanks a ton for all work and assistance, you’ve done more for me in only a few post than others have done over months of posts and that was within the community in which I based my build off of. This industry is ever changing and is hard to keep up especially when one just jumps into something which he completely overestimated the task at hand lol. I am sorry to all in this forum for any misreadings, headaches, or confusions, it is very hard to explain what I need help with when I dont understand how to describe it, what to call it, or what rules to follow in regards to cnc. I still dont know what MPCNC stands for, but Bryan has answered all my questions as needed. I will anxiously await your next update.

My next mod will be the adjustable lens focus, which allows lens to simple adjust up and down manually, rather than building an acutal z-table which is automated.

I will post video to youtube, just wast to keen on letting the world see my mistakes just yet lol, also have you read some of the criticisms for those who get it wrong or worse dont know what their talking about? lol. The video I posted initially had not been made visible, I changed the settings of the link to allow all to view so I am not certain why it did not work. Were you able to see the pics posted at this link https://drive.google.com/folderview?id=0B5YapASZj2L1OGNyYVYtQ1JfN2M&usp=drive_web (contains all pics as well as video in last file and a finished image created last night pwer min10 max 35 dithered which shows the catch in laser movement)

YouTube video, never done this before so be gentle lol, very slow narration. https://youtu.be/NWSFu6H28h0

@karltinslly, thank you for all the advice. I did see and download gimp which is very much like inkscape but hopefully without all the flaws. I have had nothing but issues with inkscape, i wish my controller would work with corel draw directly instead of having to convert dxf to svg to code for laser. Also patience isnt my strong suit but will try to do better :wink:

@Leo, Sorry about the head ache. Is there a way to delete some of my posts? I would hate to think I blogged all over this making it more hurtful than helpful. The above link should house all files I needed and wanted you all to view for advice, criticism, and help.

@Andrew: Have you been able to burn an image like a photograph? Something with shades of gray ? The video was cool, that laser has some power for sure. It looks like it’s a little out of focus but hard to tell because the power levels are so high. If you can’t reduce the power then you have you have to speed up the feedrate significantly. Have you tried writing a couple of lines of simple gcode to create a series of lines at VERY low power and at gradually increasing feedrates to figure out what you’re ideal focus and federate should be? BTW: Invest in a FIRE EXTINGUISHER:)

Leo,

If you look at the images and videos posted on https://drive.google.com/open?id=0B5YapASZj2L1OGNyYVYtQ1JfN2M you would see a photo I completed after making that video. After I figured out how to set origin with Bryan’s setup (opposite corner which flips Y start position) it was a breeze. Yes I have to keep my feed-rates very high due to power generated via laser and yes I have done many tests to both focus as well as find lasers sweet spot. I have a good feel for what output power is to be per job and per material. With image2gcode program I cannot use normal 0-255 settings since mine goes 0 to 100% and the only readout I can follow is the ma gauge (not very accurate and very simple). As far as testing by writing code for simple lines to test feed/power, the answer is no. I have had so much trouble with the code side of this as well as graphics, images, shapes, lines, and text. So I don’t know how to write the code for this and the plugins used in inkskape dont always work correctly which makes a simple task difficult to complete and takes a lot of time.

I do need to clean up the firmware on the uno/ramps board, it says warning running at low memory. Do you know what can be deleted within the marlin code to free up memory? In other words I have options to comment, uncomment, and of course delete lines of code that does not pertain to the laser, unfortunately I dont know if deleting the unused info will or will not effect the functionality of the firmware. Especially since the working laser firmware was written with in the working 3dprinting code, kinda like a hack or merger of the two, again all very difficult to understand for a person who doesnt know code or how it works. Wish I did but I don’t lol.

So if you are willing to perhaps provide me with some simple lines of code that end in .g that I could feed into my laser then that is awesome, otherwise I will attempt it in another way as I get time. I had considered switching to a mach3 controller or grbl v5 but not sure I want to if what I have works? As far as the extinguisher goes, I had one in the kitchen under sink just in case, but that has been moved now to my mad science cave lol, maybe I need to get a couple more eh?

Thanks again for all the guidance

Back to the cave…

I’m curious about the firmware error. Wondering why the marlin had to be modified so much to run your laser.can you post on your Google drive?

This folder has been shared on the same link via google drive https://drive.google.com/open?id=0B5YapASZj2L1OGNyYVYtQ1JfN2M Were you able to see the photo I completed and posted on google drive? Also what is your specialty? are you all about code? Lasers? 3dprint? lathe?wood whittler? lol I really want a 3dprinter and about to spend 700 and change for a deluxe model which includes a roll of material, wonder if I should hold off. Got laser up and running but now dont know what to make with it lol. Would love to make simple engravings into acrylic which I could then apply arduino and WS2812b led lighting to and then sell online, what do you think is the best way to do that? My main hobby is RC, I am totally crazed by all this electronic stuff.

Back to cave…

@Andrew: Can you give us more details about your laser driver? Are you sure that the input control signal is 5V TTL and not 12V or 3.3V? Also, I’m wondering why Piclaser didn’t work for you and img2gcode did. I looked back through the posts and both are producing basically the same gcode with the M03 and M05 commands driving the laser power. I personally don’t see much difference between one or the other but in your case PicLaser may be the better choice because the M03 “S” values are decimals while img2gcode uses whole numbers. Since your usable power range is so small (10min to 35max per your posts),you may benefit from the extra resolution that those decimal values will get you.

I haven’t had time to look at your firmware. I’m pretty busy with other projects and I’m sorry to say that yours is low priority as a solution wouldn’t benefit this community very much. As a wise, long-eared Vulcan would say, “The needs of the many outweigh the needs of the few, or the one.” :slight_smile: I’ll take a look at it when, if ever, I get some free time.

I just made some changes so I guess were up to v5. The laser power ‘S’ values will now go out to 4 decimal places for better grayscale resolution on high powered lasers. This is equal to what the PicLaser software does and should help people like our friend Andrew who’s laser maxes out at 30

@Bryan: I’m tired so I’ll post source on GitHub tomorrow.

@Andrew: Please don’t post any further messages on this thread unless they’re about img2gcode. If you have a problem related to your hardware then please start a new thread. This one is getting cluttered with off-topic posts.

thanks

3dpBurner-Image2Gcode-MPCNCV.5.zip (175 KB)

Sample of gcode from rev 5:

M03 S20.9804

G1 X92.34

M03 S20.7843

G1 X92.16

M03 S21.1765

G1 X91.98

M03 S21.5686

G1 X91.8

M03 S21.3726

G1 X91.62

M03 S21.7647

G1 X91.44

G1 X91.26

M03 S22.1569

G1 X91.08

M03 S22.7451

G1 X90.9

M03 S22.9412

G1 X90.72

G1 X90.54

M03 S23.3333

G1 X90.36

M03 S23.7255

G1 X90.18

@LEO,

I am not sure why piclaser would not work for me and as I told bryan in an earlier post, I spent tons of time with jeff at piclaser trying to figure it out. It did ultimately come down to the way my current firmware was forked in the marlin code. I am not sure why image2gcode works but I am not complaining. I have been at this for almost half a year with not producing a single item via laser lol. Alot of that has to do with my lack of understanding in all this stuff. I am so very grateful for the time you all have given me already and I wouldnt dream of pushing you to fix my problems. I respect this community and wish I could delete a few of my posts since I blogged all over yours not realizing that each post had its own reply button. Right now I am very happy where I am with the laser and this software here, while I still intend to learn/educate myself in inkscape.

Thank you again for all the help and sorry for all the headache. Before I go, could you tell me what MPCNC is? I am getting ready in the next few days to purchases a very nice 3dprinter and will need a community for that, is this the right place for support? Also if I ever get around to it I would like to add a rotary attachment to one or the other machines I will have to run code like I do with laser, is this the place I can find support for this? I want to do it all which will take some doing and a whole lot of learning, however if I am in the wrong place I do need to know this, dont like wasting others time.

Take care and thank you again for all the help, dont worry with the firmware look-over I will figure it out sooner or later, I just got a excited when you offered or wanted to look into it lol. Right now I am happy that I have finally got something that works with my setup and will check back in from time to time for updates.

ttyl

First off I have to say that Leo69’s last version is the best tool for 8bit engraving on a china CO2 laser!
I tried a lot, messed around a lot but nothing ever worked in a similar way as with these low power laser diodes.
I love the approach of finally allowing the S values to be changed in tiny increments rather than full S values.
Still waiting a few hours for my first (hopefully) good engraving to finnish, will upload a pic when done.
So I though I could spend the time waiting by giving a little review and by being a little pain in the b… with some suggestion to make the program even better.

Hardware: K40 clone from china, CO2 power: 40W (claimed anyway)
Firmware: Turnkey Tyranny Marlin release with some slight mods to make it work properly on my machine
Running on an Arduino Mega2560 with full graphics display, SD support and encoder
Usual cutting and bitmap engraving: Turnkey Tyranny Inkscape plugin

General problems with CO2 lasers when you want to do 8-bit engravings (from my personal point of view):
The laser is very powerful and the wavelenght extrem efficient on all organic material.
This means a slight increase in power can totally change the outcome of any engraving.
Some of this can be compensated by good hardware and a fast processing of the g-code commands.
GRBL is quite good in this field but at least for my a pain to set on with a Mega on Ramps.

The V5 version of the program generates code that for the first time produces usable results on my machine.
Although I realise it not designed for my personal setup I noticed some things in the gcode could be improved on.
I use the gray scale 8 bit mode and M03 S / M05 for the power settings.
But the resulting code always contains M106 commands for the power level at the beginning - not sure if it is intentional but for me it is at least confusing.
Also the move to start the image seems to be calculated wrong as there is no dot.
Here is a code example:
Code example

  1. the CR and LF linefeeds are inconsistant, not really a problem unless you need to use some scripts to modify the code (like me :wink: )
  2. Line 11 and 12 show the problem with the wrong calculations from above.
  3. Line 14 and 22 have M106 commands although the M03 S was specified for this.
  4. Line 15 to 20 make no real sense to me - could you explain this part a bit please?
  5. Between every command is an empty line generated, this blows the file up and slows processing - would it be possible to remove those empty lines?

Some more general questions:
If I assume correctly then unless a change in speed or power is applied, or it is changed from G1 to G0, power and speed stay the same.
If on top of that there is no change in Y or Z direction, it would mean that every G1 move does the same thing too, only a bit more to the left or right.
So I have to wonder: Wouldn’t it be possible to combine all these tiny G1 moves with no other changes into one single move until the next speed, power or Y axis change?
Together with the removal of empty lines this would shrink the file drastically and speed up processing as well.
(If I understand the logic behind the program correctly than these tiny moves are the result of addressing the single pixels in an image?)

With most firmwares it is possible to compbe the S command with the movement, if possible here it would also shrink the file further.
Is you way of the implementation specific to the MPCNC project or could you allow for the S command to be added to the movement?

Since Co2 is powerful it would be great to be able to use some decimal digits for the power settings in the laser profile.
Currently there comes a warning and no . or , is allowed.
Is it a big problem to change this?

Due to my setup I have to flip every image - that is no issue, but the placement often is.
It would be great to allow for an offset for the start of the engraving so you can engrave in the center of something bigger like a name plate.
Is it possible to add a box for a X and Y value offset from the origin?

Ok, I know I’m a pain but I could not resist as this program is really great and I would love to see it taking on Picengrave as a freeware replacement :slight_smile:

Sorry, but my internet is playing up for days, deleted a double posting here.

@Noname007 : Thanks for using the tool! It’s come along way since the beginning and the more people that use it, the more it will improve.

“But the resulting code always contains M106 commands for the power level at the beginning – not sure if it is intentional but for me it is at least confusing.”
-That’s a mistake; when I wrote that part I had tunnel vision and forgot about the other possibilities. I will get that fixed.

“Also the move to start the image seems to be calculated wrong as there is no dot.”/“2. Line 11 and 12 show the problem with the wrong calculations from above.”
-The program takes your origin setting (3x3 grid of radio buttons on the first tab), and then moves to the top left corner of the image and starts a boundary box at low power from there. I am a little confused as to why line 11 and 12 are missing decimals. I will look into that as well.

“1. the CR and LF linefeeds are inconsistant, not really a problem unless you need to use some scripts to modify the code (like me ? )”

  • I will fix the inconsistencies with the next release

“4. Line 15 to 20 make no real sense to me – could you explain this part a bit please?”
-Line 11 moves the head to the top left corner, Line 12 sets the origin there with respect to the bottom left corner (G92 X0 Y[max]). Line 14 turns the laser on low power (need to fix MXXX), and lines 15-19 draw out a rectangle around where your image is going.

“5. Between every command is an empty line generated, this blows the file up and slows processing – would it be possible to remove those empty lines?”
-Understood, and Leo69 will have to provide insight to this as he did the original conversion. I will poke around and see if the extra blank lines can be removed.

“If I assume correctly then unless a change in speed or power is applied, or it is changed from G1 to G0, power and speed stay the same.”
-Correct. That’s why the feedrate is set once at line 9

“If on top of that there is no change in Y or Z direction, it would mean that every G1 move does the same thing too, only a bit more to the left or right.
So I have to wonder: Wouldn’t it be possible to combine all these tiny G1 moves with no other changes into one single move until the next speed, power or Y axis change?
Together with the removal of empty lines this would shrink the file drastically and speed up processing as well.
(If I understand the logic behind the program correctly than these tiny moves are the result of addressing the single pixels in an image?)”
-Spot on, and that is something that I’ve been wanting to tackle for a while. I run jobs through Octoprint and it can really studder with all the extra unnecessary commands.

“With most firmwares it is possible to compbe the S command with the movement, if possible here it would also shrink the file further.
Is you way of the implementation specific to the MPCNC project or could you allow for the S command to be added to the movement?”
-Leo69 has told me that it needs to be on its own line. Placing it on the same line as the move command was tested and it was not cooperating.

“Since Co2 is powerful it would be great to be able to use some decimal digits for the power settings in the laser profile.
Currently there comes a warning and no . or , is allowed.
Is it a big problem to change this?”
-Ok, not a problem. I can add that to the list.

“Due to my setup I have to flip every image – that is no issue, but the placement often is.”
-Can you just flip your stepper plug around?

“It would be great to allow for an offset for the start of the engraving so you can engrave in the center of something bigger like a name plate.
Is it possible to add a box for a X and Y value offset from the origin?”
-I’m not sure I entirely understand what you’re saying. Can you not use the origin setting and pick the middle?

“I would love to see it taking on Picengrave as a freeware replacement :)”
-That was my goal too :smiley:

Thanks again for all the comments. I should be able to knock most of these out very easily.

-Bryan

I got error when generating g-code.
Any idé ?

Information om att aktivera JIT-felsökning i stället för den
här dialogrutan finns i slutet av det här meddelandet.

************** Undantagstext **************
System.FormatException: Indatasträngen hade ett felaktigt format.
vid System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
vid System.Single.Parse(String s)
vid _3dpBurnerImage2Gcode.Form1.modelOrigin()
vid _3dpBurnerImage2Gcode.Form1.btnGenerate_Click(Object sender, EventArgs e)
vid System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
vid System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
vid System.Windows.Forms.Control.WndProc(Message& m)
vid System.Windows.Forms.ButtonBase.WndProc(Message& m)
vid System.Windows.Forms.Button.WndProc(Message& m)
vid System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Inlästa sammansättningar **************
mscorlib
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

3dpBurner Image2Gcode (MPCNC)
Sammansättningsversion: 1.0.0.0
Win32-version: 1.0.0.0
CodeBase: file:///C:/Users/Peter.STAT/Desktop/3dpBurner-Image2Gcode-MPCNCV.5/3dpBurner%20Image2Gcode%20(MPCNC).exe

System.Windows.Forms
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34251 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System.Drawing
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34270 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34238 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Configuration
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Xml
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34234 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

IconOverlayClient
Sammansättningsversion: 1.0.3.0
Win32-version: 1.0.3.0
CodeBase: file:///C:/Program%20Files/Box/Box%20Sync/IconOverlayClient.DLL

SharpShell
Sammansättningsversion: 2.0.0.0
Win32-version: 2.0.0.0
CodeBase: file:///C:/Program%20Files/Box/Box%20Sync/SharpShell.DLL

log4net
Sammansättningsversion: 1.2.13.0
Win32-version: 1.2.13.0
CodeBase: file:///C:/Program%20Files/Box/Box%20Sync/log4net.DLL

System.Core
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.ServiceModel
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34234 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel/v4.0_4.0.0.0__b77a5c561934e089/System.ServiceModel.dll

System.Runtime.Serialization
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34234 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll

mscorlib.resources
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_sv_b77a5c561934e089/mscorlib.resources.dll

System.Windows.Forms.resources
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_sv_b77a5c561934e089/System.Windows.Forms.resources.dll

Accessibility
Sammansättningsversion: 4.0.0.0
Win32-version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

************** JIT-felsökning **************
För att aktivera JIT-felsökning (just-in-time ) måste .config-filen för det här
tillämpningsprogrammet eller datorn (machine.config) ha
jitDebugging-värdet angivet i avsnittet system.windows.forms.
Tillämpningsprogrammet måste också vara kompilerat med felsökning
aktiverat.

Till exempel:

<configuration>
<system.windows.forms jitDebugging=“true” />
</configuration>

När JIT-felsökning är aktiverad kommer alla undantag som inte hanteras
att skickas till JIT-felsökaren som är registrerad på datorn
snarare än att hanteras av den här dialogrutan.

So you got this Bryan? As far as the extra CR/LF goes you can get rid of it. Didn’t realize there were so many of them:) However, the G moves and the Laser On/off/power codes do have to be on different lines. This is for Marlin compatibility, GRBL will tolerate the lack of whitespace but Marlin won’t. If the file size is a problem then maybe a toggle button to include/exclude the extra CR? I think the extra bloat is coming from the 4-place decimal values. Removing a line feed will only shrink the file size by 1 byte per line right? The optimized moves would be awesome but would definitely take some thought, even the commercial software doesn’t do this as far as I know.

@Noname007: You remind me of an old friend of the forum named Andrew;) Welcome!

Yes, I’ll post a new release to GitHub within a day or so

I know you mentioned being in Sweden right? What do you use as a decimal separator there? A comma perhaps? I think this may be the source of the error you’re getting and I’ll look into it for you. The number formatting I’m using may not work in your case so I’ll find an alternative, unless Bryan beats me to it.

For now, you can try running a version PRIOR to the last release (Rev 5). If the error doesn’t occur then that will confirm for me. thanks

@Peter- try the attached test version. If this works then I’ll go ahead and implement the changes on GitHub or just pass the info to Bryan so he can roll it into his coming update.

3dpBurner-Image2Gcode-MPCNC-Peter-Test-Version.zip (175 KB)

Hi here as well :wink:

Thanks for the test version, and Yes it seems to working good.
Sometimes I was able to get the original v5 version to work but i think as you mention it have something with comma to do.
If i change the ratio on the picture or something.

Yes, I´m in Sweden and we use comma as decimal separator.

https://github.com/Uthayne/3dpBurner-Image2Gcode : Use the .exe in the bin/Release folder

Version 6 is up on GitHub! It includes most of the suggestions from @Noname007 .
-Bug fixes as well as removing blank lines.
-Incorporated @Leo69 's fix into this release as well.

Still to come: More efficient process to remove unnecessary commands