I recently bought some laser galvos from Aliexpress. What I got was the basic guts of a laser light show system. It came with everything I needed except the lasers. My goal is to control a laser to make a large interactive artistic display or game controlled by a micro controller with a DAC. I have a PSoC 5 and an ESP32 that have DACs, so I may use those.
Galvos work like speakers, old school analog meters or hard drive arms. They move proportional to a current. They can move extremely fast and precisely with the ability to move to 30,000 positions per second. The galvos came with drivers. This simplifies the control to a simple differential voltage. A differential voltage is used to increase noise immunity. The ILDA spec says the differencial voltage is 0 to 10V. This means at one end of travel you supply -5V and 5V and at the other end of travel you swap the voltages supply +5V and -5V.
My DACs are 0V to 5V (0r 3.3V). I need to convert this range to a 10V differential voltage. The easiest way for me to do this is to use some op amps. With what I have on hand it is easiest to get the 10V differencial using 0 to 10V and -10V to 0. I tested on the galvos by outputting a -10V to 10V sin wave from a function generator. It worked great.
Assuming I use the 0-5V DAC, I need to map that to a -10V to 10V range. That is a 20V span and requires a 4x gain. I then need to offset that by -10V. The op amp circuit I show below is what I made.
I used an LM324N because I had some. That has (4) op amps in a single package. The rails of the device need to be hooked up to a + and – supply that is greater than the range I will be using. Fortunately the galvos came with a power supply that outputs +15V and -15V. I used some potentiometers in the circuit to allow me to adjust the circuit.
The lower op amp provides the gain. The gain on the positive side is 1 + 30k/10k which is 4. The negative side is used for the offset and its gain is 30k/10k which is 3. I need an offset of 10V, so 10V divided by the gain of 3 is 3.33V. I need that value to come from the upper op amp. That op amp has a gain of 1 so I simply need to adjust the pot in front of that to output 3.33V.
The DAC is connected to the lower left voltage source in the schematic shown as 2.49V. The galvos would be connected to Gnd and the output of the lower op amp (green line). The schematic is interactive. Click the link below and try adjusting the input voltage between 0V and 5V.
I needed to create 1 circuit for each axis. Here is my breadboard.
Here are the signals on an oscilloscope. The yellow trace is the 0-5V input as a 5kHz sin wave. The blue trace is the output. Both traces use the center line as the 0V. The scale is 5V per division. The input has a low of 0V and a high of 5V. The output goes from -10v to 10v.
I am using the tiniest laser I could find so that I don’t have to worry about safety yet. I 3D printed a base to keep things in line.
People often ask me why the edges of their laser cuts are not square. The laser beam is being focused at an angle to a spot, so no cut can be perfectly square, but there are things that can make it worse. Note: All of the images are exaggerated to show the affects.
You first need to understand how the lens works. Laser cutters use a collimating lens. This means it takes parallel rays from the beam and focuses them to a single spot. For a couple of complicated physics reasons, it can never do this perfectly, but it should do it close enough not to be a factor in this discussion. Below is a picture of a collimating lens. A typical beam width is usually about 5mm-8mm and a typical lens is about 20mm-25mm wide.
You can see that the beam forms an hour glass shape. This can cause a little angle. With a 6mm wide lens and a 50mm focal length, this angle is typically 3-4 degrees.
To get the least affect on your part, you might want to center the focus in the middle of your material.
If you are getting a bigger angle than a few degrees, it is more likely because the beam is not in the center of the lens. The lens will still focus to that same point, but the hour glass is at quite an angle to your work piece.
This type of angle is offset in one direction, so you may see it more in certain directions of travel. If the beam is moving from right to left in the above image, you might not notice the problem at all.
Does a longer focal length help? It can, but due to the complicated physics issues I referred to earlier, a longer focal length creates a larger spot size, which reduces power density. See this calculator.
We use a lot of solder stencils where I work (during the day). We usually buy stainless steel framed stencils for about $300 each. For prototyping we usually hand paste each pad. We have an semi-automated dispenser, but it is still tedious work. I see several places like Pololu selling low cost mylar solder stencils. I wondered if my Buildlog.net 2.x home made laser cutter could do it.
I researched a few blogs and pulled some information from Pololu. Pololu sells 3mil and 4mil mylar stencils and recommended 3mil for fine pitch work. I decided to buy the 3 mil mylar. I picked it up on my way home from McMaster Carr. It was a life time supply for about $15.
I found a bunch of old small SMT PCBs that I could play with. I got the top side paste mask gerber file for it. I imported the file into a Gerber tool called ViewMate from Pentalogix. This is a great program that I have be using for years. A partially disabled version is free. I have found that it has plenty of useful features.
Most PCB layout software has layers for the solder stencil. There are industry standards (IPC) for the size of these pads, but they are generally a little smaller than the pad. Often large pads, like thermal pads under big power ICs are divided into smaller windows or dots. This prevents excess solder from causing problems. With this in mind you probably need to shrink the pads even further to deal with the kerf of the laser.
ViewMate has a nice feature that allows you to shrink the apertures. Apertures are a somewhat archaic term from when artworks were done optically on film. They basically mean the shapes. To use this feature select the Setup…D Codes menus.
Select all the shapes in the list and select the Operations…Swell menus.
Enter a negative value to shrink the shapes.
I then printed 1:1 to a PDF.
ViewMate has a lot of export options, but most of them are not available in the free version. PDF is fine for what I needed to do. I then imported the PDF into Corel. I cleaned up a few extra lines and text in Corel and moved it over near the origin.
If you were always going to make your own stencils, you could probably skip a few of these steps by defining your stencils layers with the right values. Pololu actually shrinks it differently in X than Y for even better performance. Many CAD programs could print straight to PDF or other formats then.
Corel is a front end for my DSP laser software, so I was ready to try making the stencil. The PDF has vector information so you could cut it or engrave it. Everyone seems to recommend engraving, so I gave that a try.
I was not sure what to put the mylar on. I decided to hang it in the air. I taped inside a wooden frame. I tried different power levels and speeds and looked for my best result. I onlt tried about 3 settings combinations before I ran out room. I looked closely and they all looked pretty good. I think I got the best at 200mm/s and about 60% power. The power was not too much of an issue. It seemed better to cut it with more power than it need. It tended not to heat the surrounding area. The step over was 0.15mm. That probably could have been smaller for more accuracy. There was a slight smoky haze after cutting that I rinsed off with water.
I have been using a ShuttlePro as a pendant for years on my router. A pendant is basically a hand held remote control for your CNC. It allows you to control a set of functions right at the machine. I typically use it to zero the machine on the part, tweak the feedrate, start/pause/restart the job and do an e-stop.
The router’s pendant is starting to die. It has been through hell. I have dropped it about 10 times on the concrete floor. It has also seen a lot of oil and fine dust. A couple buttons are getting intermittent. I have the functions to working buttons, but I was getting worried it would stop working completely. I could not live without it, so wanted to get a replacement on order. I found a good deal on eBay ($54) and since they had several, I decided to get one for the laser as well.
The ShuttlePro was designed for video editing. One thing you do a lot in video editing is jogging the video forward and backward. Typically you want to race forward until you get close then slow down and even go frame by frame until you get to the desired spot. Sounds like CNC doesn’t it? It has three dedicated functions for this. Full speed forward and back via buttons, variable speed via a spring loaded jog dial and a frame by frame little detented rotator wheel. It also has a lot of redefinable buttons. These buttons have clear snap on caps, so you can add labels to them. I have a Corel and PDF template at the end of the post. Someone at the Mach3 forum dicovered this product and within days there was a plugin for it.
Setting it up is easy.
Download the ShuttlePro plugin from the Mach3 downloads page. Place the ShuttlePro.m3p file you download in a convenient place like your desktop. Double click on it. That will launch a program that registers it with Mach3. Plug in the ShuttlePro into your computer. It uses the built in Human Interface Driverss (HID) so you do not need to install a driver. It comes with some software to test it, but you must uninstall it before using Mach3. Start Mach3.
Use the config Plugins menu pick to open the
Make sure the plugin is enabled with a green check. Now click on the word config to the right of the plugin name.
That will bring up the screen above. Each button can be associated with any of many functions. My config is shown above. You probably want some keys across the top to select the current axis. I like to have the two buttons to the outside of the central wheels be rapid movement buttons. It is also handy to be able to lock the pendant so accidental button pushes do not screw up a run. I used the second button from the lower right. The rest are up to you and how you use your laser.
Cut2D is 2D CAM program from Vectric. It is designed to quickly and easily import DXF plus several other vector formats and create G Code for CNC cutting. It is primarily designed for traditional mills and routers. While I would not recommend purchasing it to only use on a laser, people who have both a CNC router and a DIY laser will find this to be a very capable and inexpensive product.
I have used Vectric products for years. I started with VCarve, then upgraded to Aspire. A forum member recently asked for help using Cut2D. Vectric was gracious enough to give me free evaluation copy. This is probably due to the fact that I already own their top of the line product. They did say that they are not really interested in selling it for laser use only because the program may be confusing to them and they only want 100% satisfied customers.
The Vectric products ship with 100+ pre-made post processors. There are several flavors of Mach3 post processors that will work right out of the box for most mills and routers. It is also very easy to customize your own post processor. I created one for Aspire last year and found that it worked perfectly for Cut2D as well. I wrote a blog post about it and the file is available here. All Z movement is removed from the post processor, so the actual Z values used below are not going to affect your machine while cutting.
I am not going to explain how to use Cut2d. Vectric does a great job of that. I will just explain the differences when using a laser cutter.
Creating a Laser Tool
The first step is to setup a “tool” in the tool library for the laser beam. The beam can be thought of as an end mill. It is basically a cutting cylinder with a fixed width. The major difference is that it has an “infinite” depth of cut. In reality most lasers are not going to cut anything thicker than an inch or so due to beam divergence.
Many values you set are just default values and can be changed when you use the tool for a cut.
Tool Name
I called my tool “Laser Beam 0.003”. If you want to go crazy, you could setup dozens of tools with default values that work well with certain materials. You could name the tools “1/8 Plywood laser cut” or “6mm Acrylic laser cut”, for example. This way you do not need to remember what speeds and feeds are needed for each material.
Tool Diameter
Cut2D will use this when calculating how much to offset the cut line from the geometry when cutting inside or outside features. An easy way to determine this is to cut out a 1 inch square on the geometry lines with no offsets. Measure the actual size of the part. The amount you are less than the inch will give you the beam diameter. If you want to be as accurate as possible, you could define multiple tools based on different materials and thicknesses.
Pass Depth.
You cannot realistically use Cut2D to control the depth of a laser cut. Therefore, this value is not important. You do want to make sure this value is larger than any value that you will use when specifying tool paths so the cut is always one pass. I suggest setting this to a value of 1 inch. This default value can always be changed when you are setting up a toolpath if you actually want to play games with multiple passes.
Stepover
This does not apply for lasers, because we will not be doing pocketing. Just set it for 45% to keep Cut2D happy.
Spindle Speed
This value is also not really important at this point. You could use it to control beam power if your laser supports that. If your laser can use this for beam power then set it for the number that would yield max power, otherwise a value of 1000 should be fine.
Feed Rate
Again, this is a default number that can be changed at each tool path, so pick number that is close to t typical number you might use.
Plunge Rate
This does not apply so just put in any reasonable value.
Here is what a typical laser might look like.
Usage
I will explain one cut using the wing_spar example file that comes with Cut2D. The cut will be the inside features of the wing spar.
Select all the inside features and then click the Create Profile Toolpath icon on the toolpaths flyout menu on the right.
Cutting Depths.
These values do not matter. You just want to make sure the cut depth is less than the pass depth set for the tool. This will insure that only one pass is done. Advanced user could of course use this to setup multiple passes.
Tool
This is where you select your laser tool. Use the edit button to set the actual cutting speed you want.
Machine Vectors.
Use this to tell Cut2D what side you want the tool offset to. The direction setting (climb or conventional) is primarily for spinning tools, like end mills, but if you care which way the cut goes around the loop, you can change this.
Ramp moves
Don’t use this.
Tabs.
Tabs are primarily used to keep parts in place with spinnig tools, but you might want to take advantage of it to keep light parts from blowing around, or if you want all the parts to stay on the material after cutting.
Outputting the G Code file.
The last step is to output the file using the custom laser post processor. A copy of the file is available here.
Good luck. You might want to try a few dry runs with the laser disabled and you hand on the e stop button to make sure it works for you.
The useful power of a laser comes down to power density. The more power per unit of area (power density) you have, the more cutting power you have. The beam that comes out of a laser has a rather large diameter. It is much cheaper to increase power density by focusing the beam to a small spot than to increase the laser tube power. To do this you need a lens. “OK”, you say, “what lens should I use?”. Unfortunately the answer is not that simple. When it comes down to real world cutting, a lot of the desired qualities conflict with each other.
Cutting actual materials differs from ideal conditions because the material has a thickness and the smoke and spattering that come from cutting needs to be a reasonable distance from the lens to protect the it. Material thickness comes into play because if the beam is focused at a sharp angle, the beam quickly diverges on either side of the focal point. This is know as depth of field. Basically this means how far away from the beam focal point does it still have a useful power density. “OK, so it is best to have a long focal length?” A long focal length addresses depth of field and safe distance from the cutting affects, but it turns out that works against ideal spot size.
Virtually all CAM systems allow you to target different CNC machines through the use of a Post Processors (post). Post Processors tailor the ouptut to the target machine. While most machines can handle G-Code, each machine has it’s own requirements. Many Post Processors are so flexible that you can even get them to output HPLG, DXF, and other vector based file formats.
Post Processor formats and rules vary between manufacturers, but the general procedure of creating a custom one is basically the same. I will detail how I created a basic Mach3 E1P1 style post processor for my VectricAspire CAM program. Aspire is way overkill for a laser, but this Post Processor will work for all the Vectric products including the more affordable CUT2D which is perfect for a laser. Most CAM vendors will produce a guide for the post processor format. I got the one for Vectric from their forum.
Most programs ship with many Post Processors. Start with one that is closest to what you want. In my case I picked a Mach2/3 Arcs (inch) post. This targets Mach3, and uses arcs for curves instead of multiple line segments. You should also create a simple CAM file to test. I created one with a 1″ x 2″ rectangle and a 1″ diameter circle. Both items are offset from home. Locate the items on a simple grid so it is easy to find the items in the resulting G-Code.
Many DIY laser builders come from a CNC background. They have built a CNC mill or router and gained the confidence to try a laser build. They love Mach3 for the CNC, so they want to use it for their laser cutting. There are some inherent problems, but in most cases it will work fine for laser cutting.
The method I am going to describe here uses the E1P0/E1P1 method of laser control. This allows fast turn on/off of the beam without the delays Mach3 adds with spindle based beam control. I have tried many other methods, but this is my favorite for laser cutting. I use manual control of the beam power using a potentiometer with this method.
When Mach3 sees E1P1 in G-Code, it immediately turns output #1 on and will immediately turn it off when it sees E1P0. Therefore, you just need to have a E1P1 before your first feed move and an E1P0 after your last feed move. There is one catch. It appears there must be some actual movement after each E1Px command. If your last feed move ends at your “home”, you won’t be able to turn off the beam unless you move away from home then back. You should be able to setup a post processor for your favorite CAM software to do this. I will detail that in a later blog post.