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

New Home Forum Software / Firmware Development Image2Gcode – Free Raster Image Laser Engraving Software – Modified for MPCNC

This topic contains 338 replies, has 58 voices, and was last updated by  Aaryn 5 months, 2 weeks ago.

Viewing 30 posts - 211 through 240 (of 339 total)
  • Author
  • #22821

    Wyatt Earp

    some questions and ideas…

    im new to the thread.. i been looking for a image converter for a long time then i found you guys.. and thank you.. your the only one out there thats free.. 🙂

    anyway im not set up to do pwm raster printing i have a 3d printer with a laser wired to a votage regulator to my ramps 1.4 works good tested it about 5 minutes ago did “hello” question is i use jltech or what ever that program is for inksape..

    im trying to pause a print seeing how you can only have these on solid for 30 minutes..

    is there anyway in g code to pause it and resume? or something i can add?

    my other question is when im ready to print a picture
    how do i wire up this little 500mw laser to do it..?? i assume you need pwm which the fan d9 output is anyway but how do i do that?????

    its pumping 12 volts into one of those cheap 1 dollar ebay dc to dc step downs you turn down with a volt meter hooked max is 5 volts out.. it can do a range but im not sure how to do that.. just send the file to it anyway the regulator can handle that?
    or do i need one of those ttl lasers that wire in to a servo pin or something.. im lost..

    also last ? sorry i know i talk alot.. on your program theres “s” and z” when you print i use m106 amd m107.. whats the s at m106 s mean????

    i just want to be able to use my ramps board.. with what i have.. ive used it with a standard wording and standard like shapes to cut out but pictures that need pwm im lost on…

    thanks for the help..

    oh and positioning how do you position it does it just defeault to your beds home corner that green square thing?



    You shouldn’t be using a voltage regulator to drive a laser. You’ll burn it up pretty quick that way. If you want to do pwm grayscale laser engraving then you’ll need a laser driver board for your diode. You can probably find one for about $3 that will drive a 500mw diode.

    The guide in the link below details the firmware changes that are required.


    Wyatt Earp

    a voltage regulator is the same electronics as the ones they use on those cnc boards from ebay

    theone im using is this

    works just fine for me switches on and off.. has a 2 amp max load.. all im doing is either on and off not pwm at all.. so everything i do is dot or line.. when i go to the image to g code converter then ill go to a ttl output board and laser dioed i can get a 2 watt for 90 bucks

    so for now its fine.. i cut a hello out did just fine.. like i said i need to find a way to pause it to cool it down or keep my prints under 30 minutes.. i saw tha 3dburnersender v 1.1 on here i downloaded it it has a pause feature maybe i can figure out how to send it to the arduino…

    or anyone have any suggestions on how to pause a print in repiter host? or to use another program to send it to my arduino with another program?



    I still don’t see anything in that voltage regulator description that tells me it’s a suitable laser driver. It might work for a while but why do you have to stop after 30 minutes? No fan or heat sink? Too much power? Either of those conditions will kill a diode prematurely.

    We need to know what firmware you’re running before we can tell you how to pause the code. A quick google for Marlin, or Grbl gcode should give you an answer. Good luck


    Tobias Tetzlaff


    I am Toby from Germany.

    I played one year ago with Image2Gcode to make pictures with my Marlin based 3D Printer.
    I add Marlin friendly Code one year ago.

    Look here

    It is an 2.5W Bangood Laser with DTR Super X-Driver at 1.8 Amps.

    Now I have many problems to setup my Mach3 based CNC Router with the Laser.
    First I want to use Mach3 PWM Output, but no change, Mach3 give every S-Code change a little delay.

    Now I use an ATmega Controller to convert Step/Dir to PWM.
    For that I used the A Axis of Mach3 to generate the Steps/Dir Pulses.
    Its a little bit semilar to the J-Tech DAC PIC-Converter.
    That part runs not perfect, but it’s ok for this time.

    I ve made some changes to Image2Gcode,
    because I need 0.0000 value for Laser min and 0.1024 value for Laser max Power.
    At this point it don’t run well.

    There are many Bugs, so I can’t set min Laser Value higher than 0.
    The Funktion private float interpolate(float grayValue, float min, float max) makes not what I want.
    The Orgin Funktion have also a Bug if I have a decimal value of picture width or high, then I got a “,” and no “.”.

    I ll make more test to set it up.

    The only thing I found is why the will be a “,” and not the “.” at some generated G-Code lines.

    In private void generateMLine() I changed
    szStr = szChar + Convert.ToString(sz);
    szStr = szChar + string.Format(CultureInfo.InvariantCulture.NumberFormat, “{0:0.####}”, sz);

    I ll be back

    Regards Toby



    Yes, Mach3 is notoriously difficult for pwm laser engraving. I was using it for a while with a USB motion controller board and switched back to Marlin because of the laser issues. I did the same as you, a small circuit to drive a axis and convert the pulses. I never got the quality that I wanted though. I think my motion controller board just wasn’t fast enough and I didn’t want to buy more hardware.

    As far as i2gc goes, the decimal power values was added for a while but ultimately removed because Marlin only accepts integers so it was a useless feature. The software is geared toward Marlin based CNC platforms. I think the origin bug has been fixed but the GitHub isn’t active for some time now so you won’t have the latest source code. Hope you get it working, good luck.


    Tobias Tetzlaff


    today I do some tests with PicLaser.
    It’s at this moment the best Way to test out my Laser settings and my Step/Dir to PWM generator.

    After some Tests I reduce the PWM resulution from 1024 to 256.
    Now I drive my A axis from Laser off, 0.000 mm, to Laser full power, 0.0255mm.
    After some more tests I found out, my PWM is to fast for the DTR Driver.
    I use lower frequenzy and an other PWM mode on the Atmel MCU.

    At this point I can engrave pics with PicLaser Demo nearly my 3D Printer with the same Laser Module.

    Laser Tests shows my test today.

    Mach3-A127-F2000 shows the best result at this time.

    Mach3-Marlin shows the different between Mach3 and Marlin.
    In Marlin I used only 1/4 Laser Power, at Mach3 I used 1/2 of Laser power.
    Tomorrow I ll use 1/4 Laser power at Mach3.

    Now, I know my Laser and Mach3 works well, I ll do changes to I2GC.

    Regards Toby



    That’s looking pretty good. What kind of electronics are you using with Mach3? PC with parallel port breakout board, USB motion controller? If it’s a motion controller then let me know which one it is because they really vary in performance. Mine was a cheap Sainsmart board and it worked great for everything but the laser.

    I made an Arduino-based DAC to convert step pulses also but maybe my resolution was also too high( I was using 11-bit ) and the pulse rate couldn’t keep up. I had my Acceleration values ridiculously high too but it didn’t help much.

    Image2gcode has an option to “Use Z” instead of a PWM power command . That should translate your grayscale values into Z axis movements and might be easier for you to revise to work with your DAC. You’d just have to change the code to use ‘A’ axis instead, or some other letter. If you have a working solution with PicLaser then maybe you should stick with that though.


    Tobias Tetzlaff

    Hi Leo,
    Thank you. 😉

    Since 2 month I use the “XHC MK4” USB motion controller.
    Before I used a parallel port breakout.
    I think, I also get success with parallel port, but thats an other story. 😉

    I also use an Arduino Uno, but I ll make a PCB with Atmel MCU and Optocoupplers.

    For my Mach3 Acceleration values see pictures.

    Today I made some changes to I2GC to get it Mach3 friendly.
    I add “A” to “Laser Power On MCode” and “A0” “Laser Power Off MCode”.
    This was the easyes way at this time. 😉

    Then make changes by the generated GCode, I set the Power values behind the XY Codes.
    Deleted many clear lines, add some Header lines.
    Now it looks like that:

    (Generated by 3dpBurner Image2Gcode v7.0beta)
    (@Jan.12.2017 12:14:37)
    (Feedrate: 2000)
    (Pixel Resolution: 0.1)
    (Min. Laser Value: 0.0000)
    (Max. Laser Value: 0.0127)
    (Engraving Angle: Horizontal scanning)
    G0 X0 Y0
    (Header end)
    G1 A0(Laser off)
    G0 X0 Y48.6
    G1 A0
    G1 X0 Y48.5 A0.0086
    G1 X0.1 A0.0086
    G1 X0.2 A0.0085
    G1 X0.3 A0.0084
    G1 X0.4
    G1 X0.5 A0.0085
    G1 X0.6 A0.0086
    G1 X0.7 A0.0087
    G1 X0.8 A0.0088
    G1 X0.9 A0.0089
    G1 X1 A0.009
    G1 X1.1
    G1 X1.2
    G1 X1.3
    G1 X1.4 A0.0089

    G1 X0.9 A0.0063
    G1 X0.8 A0.0059
    G1 X0.7 A0.0057
    G1 X0.6 A0.0059
    G1 X0.5 A0.006
    G1 X0.4 A0.0061
    G1 X0.3 A0.0063
    G1 X0.2 A0.0064
    G1 X0.1 A0.0062
    G1 X0 A0.006
    (Edge lines)
    G1 A0
    G0 X0 Y0
    G1 A0.0127
    G1 X0 Y48.5
    G1 X72.8 Y48.5
    G1 X72.8 Y0
    G1 X0 Y0
    G1 A0(Laser off)
    G0 X0 Y0
    (Footer end)

    The first try makes some trouble.
    X forward it runs well, backwards it run only in 1/2 speed.
    I forget to make some Code changes.

    The next Try give me a good engraved picture.
    I set 1/2 (Max Power A0.0127) Laser Power, but its a little bit too much.

    The 3rd try I set 1/4 (Max Power A0.0064)Laser Power, but it’s to brightly.

    I ll change the following Code line to the older version I have.
    “if (cl.R < 0.15 * 255) { sz = 0; }”
    sz = 255 – cl.R;

    Regards Toby


    Tobias Tetzlaff

    Here is a video of the 2nd try.

    And the last pictures of “my” I2GC.

    At least there are my Mach3 X, Y and A setting.

    Regards Toby


    Tobias Tetzlaff


    now I am ready, everything runs well.

    I’ve change the lines in Source Code:
    “if (cl.R < 0.15 * 255) { sz = 0; }”
    sz = 255 – cl.R;

    And changed the Laser power to 0-0.0096mm. See picture for result.

    If I found more time, I’ll going to setup I2GC with my changes.
    At this time I had made my changes “quick and dirty”. 😉

    I’ll also test the diagonal pattern.

    Then I’ll solve some bugs I’ve found.
    When Picture dimensions have decimal values, there will be some trouble.
    If I open a picture file, the height had no decimals.
    I must to click “aspect ratio” off/on then it’s ok.
    See pictures.

    Regards Toby



    which is the latest version of the software Image2Gcode? version 1.1?


    Tobias Tetzlaff


    I have this Version from first post:

    -(v.6) Fixed CRLF inconsistencies, removed blank lines, allowed power min/max to include decimals. Other small bug fixes… – 2/20/16 -Bryan (Uthayne)
    -(v.5) S-values to 4 decimal place for increased resolution – 2/8/16 – Leo69
    -(v.4) Added origin set points and an outline at low power – 1/29/16 -Bryan (Uthayne)
    -(v.3) Added profile section for commonly used settings – 1/17/16 -Bryan (Uthayne)
    -Initial modification for MPCNC – 1/12/16 -Leo69

    Regards Toby



    Tobias can attach it please?


    Tobias Tetzlaff

    Hallo Manu,

    I read about v1.1 but only found v1.0 on github.

    Go to first page, first post.

    This is the version I used.
    I am confused about Info window,
    it shows only version 0.6 to me.
    But in source code I read v1.0

    Regards Toby



    This might be a useful test pattern for freakin’ laser beams. I don’t have a laser, so I can’t verify…



    Hello everyone, first post. I was able to get through building the 25.4mm MPCNC and the $100 laser without asking any questions so congrats to the designers but I’m having a problem with image2gcode. It’s printing inverted gray scale. If I choose the option to skip white space it skips the black space. I tried inverting the image within image2gcode and it did the same thing. Just figured I’d ask before messing with it much more in case I’m just missing something simple.


    Tobias Tetzlaff


    please tell us about your I2GC Settigs. Screenshots are usefull.

    Tell us, at wich value you laser is on, and at wich it is off.
    Maybe you exchange the min and max power values.

    Regards Toby



    Without knowing your setup (im assuming it is pretty stock as you say you followed the instructions). I would recommend following the instructions as presented by Jason here. I was having issues similar to yours prior to throwing in a few additional lines of code in the header.
    Hopefully, this will get you on the right path. Otherwise, good work man looks like the laser is working just fine (once you figure out your slight hang up).



    Sure, I haven’t started tuning things yet. These were my first burns after completing the $100 laser so everything is still mostly default.

    Edit: The only thing I see in that guide that I haven’t already done is change the acceleration but I don’t really see how that could cause the application to invert the grayscale.


    Tobias Tetzlaff


    I think you Laser values are exchanged.
    Laser 0 value set you Laser on at full power,
    Laser 255 value set your Laser power off.

    Can you test it manually? Set Laser Value manually to 0 or 255 and see what happends.

    Regards Toby



    I switched them to Min:255 Max:0 and it just printed the whole thing at max power still skipping what should be the fully black parts.

    Maybe I should reinstall.



    Wood is tricky… You will not want to run max power on wood… Try somewhere around 50% and go up or down from there… It will several attempts to get it right. And each material and sometime each image will require different settings.



    Sure, I haven’t gotten to the point where I am trying to optimize quality. It is burning inverted grayscale.

    Reinstall didn’t change anything. Am I using the correct build? From the first post in this topic ” 3dpBurner-Image2Gcode / bin / Release / 3dpBurner Image2Gcode (MPCNC).exe “



    I dont always I2GC but when I do I use V 1.1. See attached



    1.1 didn’t seem to change anything. These are burns for 1.0 and 1.1. Original, inverted colors, inverted min/max.

    edit: using Marlin: B16_32_fullG-112515, NDB7875, Wayle Power A-11. I don’t know what else could be relevant.


    Tobias Tetzlaff


    where I can find v1.1 source Code?

    Regards Toby



    No other ideas on my issue with the inverted grayscale? What baffles me is the optimized raster option is generating code that skips the areas that should be completely black. That has to mean it’s happening somehow on the software side right, but inverting the picture before generating the code doesn’t reverse the grayscale? I’m saving to a card and running from the LCD.



    Don’t use the optimized raster I don’t think it works properly. Looks like you still have too much power. What did you set you max too? You can also lighten the image as well.
    What speeds did you try?



    I haven’t played with power or speeds at all yet. It is 256 fan speed @ 3000mm/m.

    I will try diagonal scanning without optimization but others are using the feature aren’t they? I wonder what could be unique about my situation that could cause this problem.

Viewing 30 posts - 211 through 240 (of 339 total)

You must be logged in to reply to this topic.