Reply To: Image2Gcode – Free Raster Image Laser Engraving Software – Modified for MPCNC

New Home Forum Software Development Image2Gcode – Free Raster Image Laser Engraving Software – Modified for MPCNC Reply To: Image2Gcode – Free Raster Image Laser Engraving Software – Modified for MPCNC



How can say no if the guys who did such great work and helped me so much want to see something 😉
The firmware is here on Github.
It is based on the official Kimbra release and the Turnkey Tyranny additions ported by Nextime.
Some improvement for the raster direction change was made by HakanBastedt who also works on a different approach to regulate the power mapping.
I changed the original Turnkey code to allow for full 8bit engravings and increased the standard input power selection from 0-100 to 0-10000 to allow for the required 8bit mapping within a fixed power level.
The interesting stuff happens in planner.cpp from line 877 to 894, I commented the out the original code for reference so that people can better understand what is actually happening.
To allow for these mods to work the base64 library needed some minor changes as well.
I used the modified Turnkey Tyranny plugin, which is included, to create the code for the below image as it was too big for Image2Gcode.
With base64 encoding the gcode file is still over 6mb big LOL
But for smaller sizes I can do the same with Image2Gcode and for my needs I only modified how the power commands work, e.g. integrating them into the movement string and removing some unwanted gcode that I don’t need on my machine.
Bigger jobs are limited for me using Image2Gcode as so far I had no time to integrate the G7 command and base64 encoding.
Anyway the image was encoded in 254DPI as this and 508DPI are next to perfect resolutions for machines that use pulse settings per mm and not inches.
Image size is 240x175mm, same for the engraving.
Power levels used: Minimum power as set in the firmware: 750
Max power for total black: 1080
Speed: 7200mm/min
Engraving time: 62minutes ,which equals to a real life speed (including the turns) of 7027mm/min based on the line lengths and engravng time.
The power levels correspond to 7.5% for min and 10.8% for max if the original controller would have been used, so you see I basically just increased the resolution here.
The mapping of the 256 power levels happens in the firmware during runtime instead of being integrated in the Gcode, which saves a lot of time and processing.
The high speeds are mainly possible due to a good alignment of the acceleration values to the max speed but only possible in 1/8 stepping at 1/16 stepping I can only reach speeds of around 4200mm/min before running into processing troubles due to the slow CPU and no support for a mathematical co-processor – I need a 32bit board!! LOL
But at 1/8 I still have a calculated accuracy of 0.1mm which should be more than enough for normal jobs, if I need more I can always change the stepping and go slower.
Billy engraved big
Engraved just on copy paper, so it buckled a littled bit and did not like to stay flat so I can take a proper pic.

GRBL does the laser stuff different to Marlin but people using Marlin might want to try the 254DPI and 508DPI for their engraving jobs.
For me it was the biggest improvement in speed ever.
If you think about it makes actual sense:
254DPI equals 0.1mm pulses, 508DPI 0.05mm pulses – this is far easier in calculations for a 8bit CPU than pixel values of 0.09644 or so.
And since the laser pulses must be timed with the movements, which are also calculated in mm we suddenly get pretty nice looking numbers for movements instead of crap with 4 or 6 digits behind the comma 😉
If there is a way to get around complex flot operation than write the extra code was one of the favourite statements my computer teacher used back in the 90’s LOL
The smudge on her dress was done by the idiot taking not enough care when handling it, so please ingore this imperfection if you can.