Mylar Solder Stencils With a CNC Machine
by mattwach in Circuits > Soldering
1378 Views, 21 Favorites, 0 Comments
Mylar Solder Stencils With a CNC Machine
SMD soldering can be significantly easier if you have a stencil available to apply the correct amount of solder in the correct places. This guide shows you how to make solder stencils cheaply and easily using Mylar (plastic sheets also known as BoPET) and a cheap CNC machine (which usually start around $150).
The guide also points out alternate methods as some of these methods may be a better fit for your situation.
Supplies
Solder Stencil Creation
- Mylar sheets. I paid $7 for a 10 pack of 12x12" sheets which will be enough to last me a long time.
- A CNC machine. If you want a low cost start, look for a 3018 CNC machine from your preferred retailer. Prices currently start around $140. I'm using this model
Soldering
Soldering is a slightly different topic but I'll include some lower-priced suggestions here for someone who is just getting started.
- Hot plate OR Hot Air Rework Tool OR Oven
- The hotplate I recommend is the TKDMR Hot plate for only $14.
- Optional: If you want to go with an air rework tool, an 858D is an entry-level unit that gets the job done for around $50
- Solder Paste: Solder paste is sold in syringes and small buckets. I prefer the later. Here is a $13 example from Amazon.
- Soldering Iron: Best value-for-money in my opinion is the TS101 for around $60. There are many valid alternatives.
Software
- KiCAD. Any "EDA" software that can produce Gerber output will work. KiCAD is popular, high-quality and free.
- Flatcam. This software coverts Gerber output into Gcode output which is the language a CNC machine understands. Flatcam is free. I recommend also checking out Cambam as a paid alternative.
- Candle. This is the free software I'm using to send the Gcode to the CNC machine. It works with machines that use the GRBL communication mechanism. That said, whatever software that came with your machine should work fine.
[optional] Understanding Alternative Methods
There are multiple alternatives to creating solder stencils that you probably should be aware of. Here I list some major ones.
Professionally made
If you order PCBs made, they usually have the option to add a solder stencil for around $20-$25. Shipping will likely be more expensive as well. If you make very few designs each year or plan to use a particular stencil many times, this can be a good option to go with.
3D Printed
If you have a 3D printer, it is possible to 3D print stencils. I tried this and had some moderate success but ultimately found the the paste was laid on too thickly and the precision of the stencil was insufficient for smaller parts (see the photo above). I was using a 0.4mm nozzle (which is the usual default size) and think there could be improvements with a 0.25mm nozzle instead; but I have not tried it.
To execute, you can follow this guide until you have a Gerber file, then use the website below (instead of Flatcam) to create an STL model file:
Copper etched
You can use a chemical process to etch a thin copper sheet with the needed pattern. Instead of a CNC machine, you'll need a laser printer, laminator and etching chemicals. I have not tried this method but you can learn more here:
https://rayshobby.net/wordpress/learning-to-make-solder-paste-stencils/
Vinyl Cutter
For this method, a vinyl cutter is used instead of a CNC machine to cut the Mylar. This method may not work as the machine may not be able to resolve sufficient detail. If you already have a vinyl cutter and lack a CNC machine, it could be worth experimenting and please leave a comment if you try!
Preparing the Gerber File
To start, you'll need a PCB layout. I'm using the free KiCAD software to produce my PCB designs but there are many free and paid alternatives.
A PCB layout is set of shapes that fall under different classes called "layers". The layer we are primarily interested is the "F. Paste" layer which represents solder paste regions for SMD (not through hole) components. See the first image.
You may also be interested in the "Edge Cuts" layer which represents the edge of the board. Using this layer will allow you to make the solder stencil the same size as the PCB. Whether you want to do this depends on your mask clamping technique. I personally prefer the solder stencil be the same size.
You produce the needed Gerber file(s) by "plotting" them as shown in the second image.
Load the Gerber Files Into Flatcam
CNC machines do not directly understand Gerber files (Gerber files lack CNC-specific information, such as how fast and deep to make cuts). You will thus need to use software to convert Gerber to GCode.
As usual, there are many options. Here I will use Flatcam because it is free and can also generate Gcode for etching PCBs (that are not overly complex). I explain how to do this in a separate guide.
As the images show, for Flatcam, you first load your Gerber files in, either just the "F Paste" layer or the "Edge Cuts" later as well if you want a cutout.
[Optional] Resize the Gerber Shapes
Here is an optional step you can consider.
Flatcam can not seem to generate cuts inside the "F Paste" traces. If you allow it to produce cuts outside the traces, then the final holes will account for the CNC's bit size in the incorrect way, leading to larger-than-needed holes in the mylar. We are talking around 0.3 to 0.4 mm too large. This might not be a big deal but, if you are like me, you'll still be motivated to correct for the error. Here is a way:
- First enter the "Gerber Editor" for the "F Paste" layer and select everything.
- Next, click the small "Transformations" icon in the toolbar.
- Enter the size of the bit you are using as a negative offset and choose "Buffer B". I go with -0.2mm and it is working well.
- Click back on the "Editor" tab at the top, then click "Exit Editor" at the bottom of the tab pane.
Now you'll have a new layer which is a shrunk version of the original. The new layer has the same name as the original with an "_edit" suffix added. The original, untouched layer still exists. In the final image above, the original layer is drawn in light green and the new layer is drawn in blue.
You may opt to delete the original layer from the Flatcam project to avoid accidentally using it.
Gerber to Geometry
Flatcam uses two middle formats between Gerber and the final GCode called "Geometry" and "CNCJob". In this step, we are going to create the geometry.
To do this, select the "F Paste" layer on the side bar (choose the _edit version if you followed step 4), click the "Properties" tab, and select the "Isolation Routing" option.
The second image above shows the properties I chose.
I'm using the 20 degree V bits that are bundled with most 3018 CNC machines. The UI above has a V-bit calculator that you can use if you want to but, in my view, it's built on the illusionary foundation of excellent precision and tolerances. I always just choose "C1" as a bit and 0.2 as a cutting width and this has been working well.
Geometry to GCODE
We are now going to take the geometry object created in step 5 and create a CNCJob object. This is done by selecting the geometry object, then clicking the "properties" tab. Now we should have a form similar to the first image.
Filling in the form:
- Cut depth should be around -0.2mm. Cutting too shallow means that you might not get a clean cut across the design but this is easily mitigated as I will explain later.
- You can cut relatively quickly. I went with a feedrate of 300mm per minute but I would not be surprised if higher settings work well.
- Make sure you set the spindle speed appropriately to avoid breaking a bit! For a cheap 3018, the machine has no RPM feedback mechanism. Instead, anything over 1000 sends the maximum available voltage to the motor, which will typically result in a spindle speed around 7500 RPM. Cutting mylar is quite forgiving for settings so I just use 10000 as a setting.
Exporting GCode
The only thing to do here is visually look over the routing paths, then click "Save CNC Code".
Optional: I personally run a custom checking tool on the produced Gcode which asserts that I didn't accidentally put a bad number in somewhere (example, accidentally choosing a cut depth of -2mm instead of -0.2mm) Learn more here.
[Optional] GCODE for Edge Cuts
If you want to cutout the stencil to be exactly the same size as your PCB, follow these steps. Note that many guides suggest making the mask larger. Using the same size works well for me.
- First, select the edge cuts layer and choose "Cutout Tool".
- The tool diameter is 0.2mm and the cut depth is -0.2mm.
- Bridges is a personal choice. I don't use them because I secure my mylar with double sided tape. If you are clamping down your stock, then bridges will likely be needed.
- The CNC settings are essentially a copy of the F Paste layer.
and as with the F Paste layer, you can run a post checker on your GCode for a little extra piece-of-mind.
Making the Cut
For making a cut on my 3018, I use double sided tape to secure the mylar to the CNC machine (actually, it's two pieces of painters tape that are glued together with superglue as I describe here). You'll need a spoilboard for this method (any piece of scrap wood will do). One advantage of the method is there is no chance for the mylar to warp or slide around during the cut but it's clearly not the only way.
As for the cut itself, it's easy relative to most CNC tasks but still likely a bit intimidating if you are new to CNC. The general steps are:
- Choose a software program. I use the free Candle which is popular with 3018 machines (using GRBL protocol). More expensive machines might use other protocols, such as Mach 3.
- Zero the machine in the program so that (x=0, y=0, z=0) has the bit just touching the mylar. If you have never done a cut before, you might do a dry run by having z=0 10-15mm above the material and no bit inserted just to see how the head moves and confirm the motor is spinning when it should, etc.
- Do the cut
- Check to see if the cut made it through the mylar everywhere. If not, use the control software to move the bit to z = -0.2mm and click the "zero z" button to make the lower position the "new zero". Then run the same cut again.
After the cut, some cleanup work with 400 grit sandpaper and a detail utility knife will help improve the quality of the paste application.
Applying the Paste
Gathering components
At this point, I like to generate a bill of materials (KiCAD has a tool that can save a BOM as a csv file), then load it into a spreadsheet and remove all of the non-SMD parts. This then becomes a "parts" list that I gather together before applying any paste. The goal is to have everything prepared so you are not part-hunting after applying paste.
Applying the paste
This is straight-forward. You'll need to somehow secure the mylar stencil to the PCB (clamps, tape down, etc). Next I spread the paste into the holes with a small plastic spatula. Using some magnification can help ensure that the gaps are filled. Finally, I carefully lift away the stencil.
Placing and Soldering SMD Components
Placement
For placement, I use a pair of tweezers and a head magnifier. The magnifier is also quite useful when soldering. I find 2X magnification to be about right.
I like having a large printout of the board for easy reference of which component values belong in which places.
Soldering
This section is a bit disconnected from the rest of the document. Just like cutting a stencil there are several ways to solder SMD components placed on paste. A quick overview includes:
- Hot air rework: This will work fine but is a bit more laborious than hot plate and oven methods.
- Oven: This is the more professional approach. It's also the most expensive.
- Hot plate: This is a cheaper alternative to an oven which I think gives good results. A downside is that, if you are soldering components on both sides of the board, you will only be able to use the hotplate for one of those sides (possibly going with the hot air rework as a second step for the less-populated side). This is the method I'm going to talk more about below.
The hotplate I bought from Amazon was only $14 and is delightfully simple. It has no electronics, just a resistive element that gets to 250C and stabilizes at that temperature. I simply plug it in and wait a few minutes for the components to look appropriately soldered, then slide the PCB off the plate.
Final Results
Here is the final result after hand-soldering the through-hole components and adding an acrylic cover (another thing the CNC machine can assist with!)