Shapeoko 2 + Arduino UNO R3 + grbl 9g = 8bit Laser Diode Photo Engraving

Picture of Shapeoko 2 + Arduino UNO R3 + grbl 9g = 8bit Laser Diode Photo Engraving
DSC00563.JPG
DSC00483.JPG
DSC00503.JPG
DSC00478.JPG
DSC03689.JPG

Me and my son invented/developed a new concept of “On-The Fly” 8bit Laser Diode engraving photos over two years ago. We have came a long way since those days at the beginning of our experimentation and here is the instructions to our latest build on a Shapeoko 2.

Photos can be engraved on different materials using a variable intensity controlled Laser Diode to get 8bit shading. The standard laser photo engraving process prior to our development was to TTL modulate (Pulse) the material with burnt spots/dots using a dithered black & white image to get the allusion of shades.

Commercial CO2 laser engraving machines are still are using this old school method today to engrave photos. Higher end CO2 engraving machines do use 256 separate power levels to 3D engrave, but with the excessive laser power, it’s like a bull in a china shop to be able to implement this 8bit photo engraving process successfully like we have when using a considerably lower wattage Laser Diode.

Since our development of this concept, many hobbyist, makers and businesses has followed our progression and applied this very unique process on there own machines to engrave 8bit gray-scale images using a Laser Diode. There are two presented here on Instructables, one very successful campaign on KickStarter, and many, many hobbyist throughout the world are using our software programs to Laser Diode engrave photos with our very unique 8bit engraving process. More examples of our Laser Diode engravings can be seen here using this method.

This method of varied intensity of a laser diode requires a proper “Image to Gcode” program, a computer controlled CNC machine, motor controller, modulated laser diode driver and a Laser Diode in the 1W-5W range to do the 8bit shading on the materials. We prefer a 445nm wavelength Laser Diode and the one we used in this project has a max output of 2.5W.

With the years of experimenting on different machines with ball screws, linear ways, stepper & servo motors and controller software, we decided to experiment with a stepper belt drive Shapeoko 2 run by an Arduino UNO R3 this time.

We are the second owners of this Shapeoko 2 and our very good friend John Champlain purchased it new from Inventables. This is the actual machine that he used for the development of our grbl related engraving software programs. John uses an electronic DAC circuit he designed and built for varying the modulation voltage to the laser diode driver for varied intensity Laser Diode control. John is the first to be successful using our varied Intensity controlled Laser Diode concept with grbl and an Arduino UNO. The Arduino UNO R3 that we are using on this build was purchased by John from Radio Shack and shipped to us for our testing and experimentation, so we used it on this Shapeoko 2 build.

We used the stock 3 axis v5 grbl motor shield that comes with the Shapeoko, the UNO is flashed with grbl 9g, our Image to Gcode raster engraving programPicLaser Lite, our PicEdit Lite image editing program and our PicSender program to handle streaming the large raster gcode files to the Arduino & grbl.

These three outstanding software programs were written by our very good friend,John Champlain for Arduino grbl controlled CNC raster engraving machines andPicLaser Lite has the option to generate Gcode for other CNC controllers as well.

We were really surprised of the performance and excellent results we are able to achieved with our Laser Diode photo engraving experimentation using the Shapeoko 2 controlled by an Arduino UNO.

Some modifications to the Shapeoko 2 and allot of experimenting with the settings was needed to get everything tuned in just right and here is our instructions how we were able to achieved success.

Step 1: Changes to the Shapeoko’s Table

Picture of Changes to the Shapeoko's Table
DSC00502.JPG
Shapeoko Table.jpg
DSC04455.JPG

As a machinist for 40 years now, clamping materials in machines comes natural for me. The MDF board table that comes stock was just not to my liking, so a new table was needed with a way to clamp my engraving materials in place precisely.

We found McMaster Carr sells aluminum T-slot track for a 1/4″ bolt, so I calculated how many we would need to cover the travel of the Shapeoko with 1″ spacers in-between them. Nine was what we needed with the 12″ travel of the X axis. The lengths are 24″ long and sticking out the front and back, but this was not a problem.

The 20mm square aluminum extrusion framing on the Shapeoko 2 for the original MDF bed had slots on all four sides. I needed only 2 slots 180 degrees from each other and the other two sides without slots to screw the T-Slot track down to. McMaster Carr also sells this 20mm framing just as I needed. So we could attach these on the end plates for the Y axis MakerSlide supports and to tie the center of the table together. We ordered 3 of them 24″ long. Again, these being longer then the original ones, sticking out the sides further did not effect anything. No cutting to a shorter length was necessary. The MMC part number for the T-Slot track is 1850A14 and the 20mm square framing is 5537T117.

The spacers we used in-between the T-Slot track is 1/2″ square aluminum tubing and we used two between each T-Slot track. We had that in stock here at our shop leftover from a previous job and just cut them to the same 24″ length.

To tie all these table parts together, it took some calculating and drilling holes in the T-Slot track & 20mm framing for #8 Pan head sheet metal screws. I included a drawing with these general dimensions. The Shapeoko’s dimensions between end plates may vary slightly, so some adjustments may be required.

We ran all the screws in loosely, then used a bar clamp to tighten all the T-Slot track and spacers up tight and made sure everything was square and flush then tightened up all the #8 screws.

As shown in the picture, two pieces of aluminum stock was added for the material starting reference place and to insure the material would be square in the Shapeoko. We added a Shop Fox Cam Clamp to hold the material in place and it’s placement is adjustable in the T-Slot Tracks.

Safety is number one priority for everyone here including our pets, so we added aLaser light shield to the Shapeoko 2 and mounted them with L brackets from our local hardware store.

Step 2: Adding a MA3 Magnetic Shaft Encoder to the Z axis

Picture of Adding a MA3 Magnetic Shaft Encoder to the Z axis
DSC00514.JPG
DSC00517.JPG
Shapeoko encoder bracket.jpg

When John was doing his experimenting with this Shapeoko, he used an electronic DAC to control the modulation from the Z axis step and direction pins on the Arduino. We prefer a more mechanical/electrical option and used this successfully though all our builds since concept. The MA3 has 10bit (1024) resolution for the analog output voltage. MA3 Shaft Encoder

The MA3 outputs a 0-5v analog voltage based on rotations, so to be able to vary this output voltage from Z axis depths in the code, we needed to timing belt the MA3 to the Z axis stepper motor. This gives us a way to move the Z axis and Laser Diode up and down to adjust for material height to maintain proper focal distance.

We found that since the Stepper motor on the Shapeoko is direct drive to the Z axis screw, a 1-4 ratio worked the best. We found a 40 tooth MXL timing belt pulley on eBay with the required 5mm bore to fit the nema 17 stepper motor.

The stepper motor sticks up to far in our opinion, so we lowered it by 13mm by replacing the three 50mm standoffs with 37mm standoffs instead. The flex coupling was not modified in any way to lower the stepper motor down. It just took some readjusting on the stepper and Z axis screw shafts. The MMC part number for these standoffs is 92080A445.

The MA3-A10-125-B part number we used has a .125″ diameter shaft and MMCpart number 1375K11 MXL timing belt pulley has 10 teeth that will fit the encoders shaft. It’s also to be used with a .125″ wide timing belt which is plenty strong enough for this use. The MMC 1/8″ wide timing belt is Kevlar reinforced and the part number is 1679K87. The trade size is a 100MXL.

An aluminum bracket had to be made to mount the encoder and stepper cooling fan. We just used a piece of .125″ thick aluminum angle 2.500″ wide and cut one side 1.625″ long and the other side 4.00″ long. Since the MA3 is a magnetic type encoder, we needed to maintain a center to center shaft distance of 3.00″ to avoid any magnetic interference from the stepper motor.

The fan we mounted to cool the stepper is also lower to avoid this magnetic interference also, but we bent the aluminum slightly to aim the blowing air at the stepper motor. Since we are pushing this stepper motor pretty hard with increased amps, higher accelerations and it’s changing directions so quickly, we had to add heat sinks to all four sides. We found some heat sinks on Amazon that fit perfectly to the nema 17 stepper. With some thermal transfer paste applied to the stepper motor’s, stainless safety wire was able to tighten up all four of them up around all four sides of the stepper motor. A cutout on one heat sink was needed to clear the stepper motors wires.

Step 3: Changing belts and pulleys on the X & Y axis

Picture of Changing belts and pulleys on the X & Y axis
DSC00532.JPG

The resolution of the X&Y axis movement and stretching of the timing belts on the stock Shapeoko gave some image reproduction quality issues, so we did some changes.

Since the stock pulley on the stepper motors are 20 teeth, we wanted to change them to the least tooth count as possible, so we could increase the steps in the grbl settings for finer incremental moves. We found a 15 tooth MXL pulley at MMC so we could increase the steps, but still travel the same distance. MMC also sells 1/4″ wide MXL Kevlar reinforced timing belts to minimize the stretching. These belts can be found on page 1076 in there online catalog.

The MMC part number 1375K34 15T timing belt pulley has a 3/16″ bore, so we had to use a 5mm reamer to open up the bore to fit the nema 17 stepper motor shaft.

Since the pulley ratios & belts were changed on the X&Y axis, we used a dial indicator to set up the steps/mm for those axis’s. Belt tension plays a part in this, so we did it this way instead of calculating what it should be. The travel was tested at 1.00″ movement back and forth and it worked out to a 52.850 step/mm for both the X&Y axis with the jumper set at 8X on the grbl shield. This has been confirmed by the engraving size matching the PicLaser Lite settings we used.

Step 4: Adding a Laser Diode to the Shapeoko

Picture of Adding a Laser Diode to the Shapeoko
DSC00501.JPG
DSC00539.JPG

The Shapeoko 2 already comes with a spindle mount, so adding a Laser Diode is fairly easy by bolting it the spindle clamp tapped screw holes. The pictures are self explanatory, but others may want to do this different based on the diode they are going to use, or materials that they have access to. We had a piece of 1/2″ thick aluminum plate and a CPU heat sink that we bored the laser Diode’s 12mm module’s diameter size in-between them at a depth of the module’s length. This way It’s sandwiched between the two parts to hold it in place. A through hole was needed for the wires to exit also. Some thermal paste between the Laser Diode’s module and heat sink/aluminum plate is recommended.

A fan to blow smoke away, cool the heat sink and diode and to keep contaminates away from the lens is needed. We also screwed the Flexmod P3 laser driver’s power MosFET down to the 1/2″ aluminum plate with thermal paste between them to act as a heat sink instead of the one that was supplied with it. The upper spindle clamp screw holes made a nice place to attach a junction wiring board to. We also used these tapped holes for mounting the volt meter also.

The key dimensions here are to have the Laser Diodes lens approximately 2.75″ to 3.00″ from the table when the Z axis is all they way down and bottomed out. We made a 1/4″ aluminum plate that screws to the bottom of the Z axis MakerSlide that bottoms out on the Spindle Mounting Plate. This is for a reference when setting placement of the Laser Diode from the table surface, focusing the lens based on the table surface and moving the Laser Diode up from there for the material height.

Step 5: Wiring the Components Together and Laser Diode Amp Settings

Picture of Wiring the Components Together and Laser Diode Amp Settings
DSC00483.JPG
DSC00517.JPG
DSC00487.JPG
DSC00491.JPG

Since we are using a Flexmod P3 to control the lasers intensity, here is the manual that explains how to set it up properly. Flexmod P3 Manual

It’s rating of input voltage is between 5vdc-24vdc. We use a 12vdc power supply with 12.5a max output on this build. Since we are powering the heat sink cooling fan and grbl shield/Arduino cooling fan also with this power supply, we like to have extra amps so the fans do not slow down when the laser power goes up and draws more amps.

The settings we used on the Flexmod P3 is 150ma threshold and 1.4a at full 5v modulation voltage. This was for the NDB7875 9mm Nichia diode that we used. This diode is capable of higher wattage output, but we lowered the max amps to make it more dependable and for the power range we needed for this particular build.

On this setup we are getting approximately 2W output max using a AR coated 3 element glass lens. The 150ma threshold gives us a nice laser pointer to line up on the material for our starting engraving point.

We also recommend using a Lasorb for ESD protection. These diodes are expensive and we learned our lesson not using one in our years of experience using them. When they get static shocked, they turn into very expensive LED’s

😦

Step 6: Setting up grbl 9g, grbl Shield & Focusing the Lens

Picture of Setting up grbl 9g, grbl Shield & Focusing the Lens
DSC00544.JPG

First I need to explain how the Laser Diode will get focused properly. As explained in Step 4, the laser Diode’s lens needs to be properly positioned off the table.

I will explain how to focus the lens further on, but will jump to the grbl settings first because this effects this process. In the PicSet screenshot shows all of our settings on our Shapeoko 2 for Varied Intensity controlled laser engraving.

The Z axis jumper is set for 4X on the grbl shield and with the 1.25mm pitch screw, the steps should be 640, but with that step setting, the Z axis stepper will loose steps with the higher accels and very fast movement changes. We divided that number by three and set it at 213.333 steps/mm.

With the 1-4 ratio to the MA3 encoder, it gives us .037 gcode movement through the whole range of the MA3 encoder’s 0-5v output to the modulation for the Laser Diode driver. Since we use a Minimum depth of Z.0000″ and Maximum depth of Z-.0255 in the PicLaser Lite settings for 8bit shading, the extra distance allows us to start at higher starting burning power for different materials where we zero the Z axis. It also gives us a safety at the higher end, so the encoder does not jump back to 0v again.

With the steps/mm set at 1/3, the Z axis only moves .0085″ total with the full .0255″ movement in the gcode and will not effect the focal distance on the material.

We have the direction reversed in our grbl setting because of how the encoder is driven from the stepper. Up jog moves down and down jog moves up. I know this part may be confusing, but it would have been more difficult to mount the MA3 flipped 180 degrees to work the other way.

To focus the laser diode the Z axis needs to move all the way down until the Z axis bottoms out on the 1/4″ aluminum plate and the stepper slips. Zero the Z axis inPicSender there. We use a .375″ thick piece of black anodized piece of aluminum to shoot the laser beam on for focusing. Since the steps are at 1/3 of what it should be, we jog up a total of 1.125″. The voltage to the modulation will be between 0-5v, but we jog slightly up or down, what ever direction is closes to get 1v on the voltmeter. A little power coming from the diode is needed to see the focal spot for adjustment.

Before turning on the laser with the On(M03) in PicSender, the proper laser safety glasses are absolutely necessary. Make sure no one else or any pets are anywhere near by when this or any other lasering operation is performed.

When your sure you and everyone else is safe, turn on the laser and make sure the beam projects onto the black anodized aluminum. Without burning your fingers by blocking the beam coming out of the lens, carefully rotate the lens one way or the other until it is the focal point is the smallest size possible. We are getting a .005″ diameter on our setup and that is the optimum size for engraving photos. We use a little hot melt glue on three or four sides of the lens thread to the laser diode module to insure it will not move and change the focus.

Attached is two Gcodes for testing the burn line width and one for use with varied intensity Laser Diode control and the other for TTL control.

The Gcode burns 6 line pairs and steps over .001″ each time. The first pair steps over .01″ and the last .005″. Looking real close at them with an eye loop or magnifying glass, when you see the two burn lines meet, that is the burn line width for your Pixel Size setting in PicEdit Lite of your engraving and the Pixel Resolution setting in PicLaser Lite to generate the Gcode. It should be the last pair of lines that meet with the .005″ step over to achieve the best results for Laser Diode engraving image reproduction.

Step 7: Our Software Settings for Varied Intensity Laser Engraved Photos

Picture of Our Software Settings for Varied Intensity Laser Engraved Photos
Wagner1.JPG
Wagner3.JPG
PLL3.JPG
PLL2.JPG

This will walk through the settings we use in our programs to Laser engrave photos. These instruction will explain how to engrave with “Varied Intensity” We will explain “TTL” (pulsing) in a later step. Our programs will generate Gcode for both processes.

First finding or taking a photo worth taking the time to laser engrave, is a challenge sometimes. We looked around here in our shop and seen our little friend and helper Wagner setting in his LazyBoy Captain’s chair just wagging his little tail a mile a minute trying to tell us something. It just had to be, he wanted us to Laser engrave him for this instructables. Since he was a pup, he has always been a happy little guy, wagging his tail and that’s why we called him Wagner.

With our 16mp Sony Cyber-Shot, I proceeded to take pictures of Wagner. Selected the best one and brought it into PicEdit Lite for re-sizing. If you notice in the picture, Wagner’s tail is blurred, but that’s alright, it will engrave the image just like it is. We recommend high quality and high resolution photos to use in this Laser engraving process.

First is to adjust Pixel size based on the size of material we are engraving on. The 1/4′ thick Poplar we are using is 5.500″ wide, so we cut it 7.500″ long. We found sanding the Poplar with 180g sandpaper, or any other type of wood we are laser engraving, helps bring out the detail when engraving. We try to use wood that does not have allot of grains that effects the image reproduction. We found select boards of Poplar can be used for our use.

The second picture shows the default PicEdit Lite settings and pixel size just as the photo was taken. With our focal spot and burn line size from the 9mm Nichia LD being a .005″ size, we will calculate the pixel size for .006″ Pixel Resolution for that setting in PicLaser Lite for engraving at a 45 degree angle.

Pixel resolution is how the gcode will be generated for the step over and step ahead incremental moves in our program. If we use a Horizontal or Vertical engraving angle with a .006″ Pixel Resolution and a .005″ laser burn line, this will cause lines showing up in the engraving. By using 45 degree angle in the settings, the .005″ laser burn line will overlap slightly and no lines will show up in the laser engraving.

To calculate the engraving size based on our material size, a simple multiplication is required. Our Poplar is 5.500″ wide and we want the image to be 5.25′ tall, so just multiply 5.25 X 1.666=8.7465. Since PicLaser Lite calculates at 100 steps per inch, multiply 8.7465 X 100 = 874.65. Close enough to 875, so that is what I will use in the ‘Height” Pixel setting. Typed in 875 and then clicked in the “Width” box and it change the width pixel size by automatically maintaining the Aspect Ratio. The width pixel size is 1167, so divide that by 100=11.67 then divide that by 1.666= 7.000″. The engraving size will be 7″X5.25″. This will be confirmed in PicLaser Lite.

Adjusting the image’s Sharpness, Contrast, Brightness and Gamma takes some trial and error, These settings will be based on the original image and burning power range of your laser diode.

The third picture shows the image adjustments we used based on Wagner’s picture and for our Laser Diode’s power range on the Shapeoko 2. In PicEdit Lite there is a “Preview Gray Scale” selection to get a good idea how your engraving will come out.

In the forth picture shows the settings we used in PicLaser Lite to 8bit Laser Engrave Wagner. Notice in picture five, with the Pixel Resolution set at .006″, the image will engrave at 7.002″X5.25″. This confirms our calculations for the pixel sizes.

Step 8: Setting up the Shapeoko for Laser Engraving

Picture of Setting up the Shapeoko for Laser Engraving
PS2.JPG
DSC00512.JPG
DSC00504.JPG

First we need to clamp our 7.5″X5.5″X.25″ piece of Poplar and set all axis’s starting point. PicLaser Lite generates the gcode based on the lower left corner of the image to be engraved as the X&Y starting Zero point. Our stops are setup for this as shown in the first picture.

Next is jogging the Z axis down to start the setting for the correct focal point for the material. The Z axis is reversed in motion, so we use the Z+ jog button in PicSenderto jog down. Set the Z axis to incremental moves and jog until it bottoms out on the 1/4″ aluminum plate and you hear the stepper motor slip, then Zero the Z axis. Since the $102=213.333 (z, steps/mm) 1/3 of what it normally would be, we need to jog up .750″ instead of .250″ for the material thickness so the focal point is correct.

When we do this, the voltage from the MA3 shaft will fall in-between 0-5v. We then jog the Z axis in the direction closest to 0v. If it’s above 3v, jogging past 5v will cause it to jump back to 0v again. Our starting point for the Poplar is Z-.002 from 0v which is 300mv on the meter. This is the power level where the laser beam just starts to burn the lightest shades in the image onto the wood. We jog the Z axis there and then zero it.

Since our machine is not near the computers keyboard, we use a USB mini number keypad to do the jogging. We need to positioning the laser beam on the lower left corner of the material. Since or Z starting burning point is 400mv, we jog back close to 0v on the meter to use the laser beam as an alignment pointer. We jog at large increments to get close to the corner of our piece of Poplar, then set the X&Y jog increment to .0100.

Time to put the Laser safety glasses on again. Turn On(M03) and start jogging to the corner. When the laser beam projects on the corner, zero the X&Y axis there and Off(M03) the laser. Now the Z axis can be jogged back to zero with 300mv on the meter.

Since our Wagner engraving size is 7.002″X5.25″, we need to jog X&Y to the starting zero point. For centering on our piece of Poplar, X needs to be jogged .249″ positive and Y needs to be .125″ positive. Zero the X&Y axis again there.

Step 9: Laser Engraving 8bit Shades with Varied Intesity

We generated the Wagner Laser engraving Gcode in PicLaser Lite, but we are going to add some enhancements to this engraving that our full Image to Gcode software program PicEngrave Pro 4 has as an option when generating the Gcode. This option is called FRC (Feed Rate Change).

Our best friend, John Champlain developed/invented this very unique Gcode process for engraving photos with laser intensity control and it has really made our “On-The-Fly” laser engravings stand out! A special thanks from us goes out to you John!

We wrote a stand alone software program that does the same thing by taking the gcode already generated and adds a varied feedrate to the end of each line in the Gcode file based on the Z axis min & max depths. It has a percentage setting to change the feedrate for the minimum and maximum depth range. It slows the feedrate down in darker areas when the laser power increases and speeds it up in lighter areas when the laser power decreases which allows us to expand the lighter and darker shade range. It really helps us to fine tune our varied intensity Laser engraving process.

On the Wagner Gcode we used a 60IPM feedrate with a 30% reduction at full depth. White shades will run at 60IPM and black shades will run at 42IPM. All shades in-between will vary in that 60-42 inches per minute range based on the Z axis Gcode depths that controls the intensity of the laser diode.

Step 10: 1bit TTL (pulsing) Laser Engraving

Here I will explain how to Laser Diode engrave using a Dithered Black & White image using the standard TTL (pulsing) method. We will use the same Wagner image, but we will dither it first. PicEdit Lite has 11 different Algorithms to choose from, but we will use the “Atkinson” option and leave the default setting at .125 for this engraving.

Editing for size, sharpening, contrast, brightness and gamma must be all done first and then saved. Then reopen the image file again, select Atkinson and then select the “Dither” button. You will notice after it’s dithered, the image will consist of allot of dot patterns to give the allusion of shades. More dots are condensed in darker areas an less condensed in lighter areas. This is the type of images commercial CO2 Laser engraving machines require and use.

We brought this image into PicLaser Lite to generate the code, but this requires a little different minimum and maximum depth setting for the Z axis. We only want the laser to come “ON” in the black spot areas and “OFF” in the white areas, so a Z-.0015″ max is used this time. The MA3 magnetic shaft encoder goes from 0v to 5v and then back to 0v. Reversing rotation direction changes this, so a different grbl settings is needed for TTL so it will go from 0v at the Z.0000 in the Gcode for white and then the Z-.0015 will go full power with 5v for black. As the code is running it pulses the laser “ON” and “OFF” to engrave the image this way.

PicSet allows us to to save different profile grbl settings, so we need to load the ones for TTL engraving. I went through the same routine of setting the focal point based on material height, except jogging direction is reversed this time and we needed to set the Z zero starting point a little different this time.

We jogged Z until the volt meter jumped to 5v, then jogged back in the other direction .0001″ incremental moves until the volt meter jumped back to 0v again. From there, we jogged .0005″ more in the same direction and then zeroed the Z axis.

For TTL modulation (not varied) laser diode drivers, the Z axis direction Pin #7 can be used to pulse the Laser Diode with Z-up and Z-down moves in the the Gcode, that’s If $3= in 9g grbl is set properly. The Z negative direction in the Gcode will make Pin 7 go high (5v) turn Laser Diode “ON” and Z positive direction will make Pin 7 go low (0v) and turn the Laser Diode “OFF”. This will pulse the laser “ON” and “OFF” creating the Black and White shade allusion with the Gcode generated from the Dithered image.

Be Careful, Be Safe, and Have Fun!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s