DIY PCB Stencil Machine

by VirgileC in Circuits > Soldering

8869 Views, 104 Favorites, 0 Comments

DIY PCB Stencil Machine

IMG20210129185528.jpg
IMG20210129185600.jpg
IMG20210129185627.jpg

Hello makers!

/!\ This project does NOT require a 3D printer 😉

In this article I am presenting the way I have found to make a cost-effective machine that can make PCB stencil in a matter of minutes to mount SMDs.

The project consists in scavenging 2 one-axis stepper-motor-driven machines and mounting a laser on one to cut the PCB stencil out of tape. You might be wondering: were can I find a one-axis stepper-motor-driven machine? Easy, a scanner is!

You can use either 2 scanners or, like me because it was all I had, one scanner + one multifunction printer. I will try to describe the best I can all the steps in the process of building the machine from material gathering to the mounting of an actual PCB.

I have built this machine with a lot of parts I had lying around my house and you might have similar parts available to you whether you already have them, or you can find them for very little online.

As mentioned above, the cost of the machine is variable depending on what parts you might already have so please, please, please, do not get discourage by the apparent length of the list of material below 😊

The project consists of 3 steps: Mechanical preparation, electrical preparation, and programming (do not worry, the programming only consists of uploading some code to the Arduino, but more on that later😉)

Caution!!

In this project we will work with lasers which are NOT TOYS! You should never point the laser at any humans or animals when the laser is plugged (EVEN IF THE LASER IS OFF!). You must always wear appropriate eye protection during the operation of the laser. Do not try to replicate this project if you do not know how to handle lasers.

You cannot never hear/read/say it enough: SAFETY FIRST!!!

Supplies

· 2 scanners or 1 scanner+1 multifunction printer

· CNC shield for Arduino

· Arduino Uno (or clone)

· 12V, >20W power supply (most ATX power supply, which can be found in a lot of desktop computers, are perfectly suitable, see here how to convert an ATX power supply into a desktop power supply )

· IRF540N NMOS transistor

· 10Ohm resistor

· Electrical tape or shrinking tube

· Soldering iron & solder

· .5W laser, mine was found on banggood.

· DRV8825 Stepper motor drivers x2

· Screw drivers to dismount your printer/scanners.

· Soldering paste (for reflow soldering)

· Hot air source or reflow oven (mine is DIY and resembles this one).

· Multimeter

· Dupont Wires

· Tape (to cut the stencils out of)

· 5mm long M3 screw x 2 (my laser needs M3 mounting screws, check if it is the case for your laser)

Mechanical Part - 1st Axis

1.jpg
3.jpg
2.jpg
6.PNG
5.PNG
4.jpg
7.PNG
10.PNG
8.PNG
9.PNG
11.PNG
12.PNG
13.PNG

Let’s get started!

I need to prepare the first axis, I have chosen to start with the multifunction printer.

I remove the lid of the scanner.

I remove the control panel (the part with all the buttons) which allows me to then remove the glass part giving access to the axis and allows me to locate the stepper motor.

I can now remove the motor and gear-reduction-plate to see in what direction the wires of the motor are going.

I open the side panel behind which the “brain” of the printer is located (it is most likely the panel with the USB port)

I unplug the motor cable from the mainboard of the printer, and I feed it back toward the motor and I get the motor cable at the top of the machine

Now, I need to prepare the cutting bed. You can see on the pictures, the way the tray of the scanner is guided in its motion, there are spring loaded wheels pressing on the glass and the tray is pressed down on the metal rod. For our purpose however, we need to remove the glass plate…

The solution I have chosen is to remove the glass but to keep the tray from wobbling, I have taped quite rigid cardboard in place of the glass but only on the path of the wheels giving me some space to work with for the movement of the cutting bed. This works just fine but a best way to proceed is probably to get either strip of glass or wood of same thickness as the original glass.

The cutting bed itself is a piece of cardboard which is not ideal but I have to keep the bed light. Just keep in mind that the bed is a sacrificial bed

And with that, the first axis is done!

Mechanical Part - 2nd Axis

14.PNG
15.PNG
16.PNG

The steps are similar but easier on the standalone scanners (and I forgot to take pictures of the dismounting of my scanner, sorry) The scanner and the printer will be stacked with an (eyeballed) 90° angle. To mount the laser, I have drilled mounting holes on the side of the scanner tray as for the laser to be located in the middle of the tray and pointing down. Before actually mounting the laser on the tray, we need to cut a slot on the bottom panel of the scanner for the laser beam to reach the cutting bed below. I have drilled 2*10mm holes and then finished the slot with a Dremel equipped with a general-purpose cutting wheel. You can also use a manual saw instead of a Dremel. I then mount the Laser on the tray making sure that the laser is aligned with the slot on the bottom plate of the scanner.

And that is it! We have now finished the mechanical step of the project! Go get a celebratory hot chocolate and let’s move on to the electrical side of the project!

Electrical Part - Laser Control

17.PNG

In this step, we will assemble the electronics of the project which really consist of just a little bit of soldering but mostly plug and play. Please use electrical tape or shrinking tube to insulate all the connexion.

To drive the machine I use a CNC shield for Arduino Uno, this shield is really optional as you can wire everything onto a breadboard but it is quite a bit tidier to use the shield and it helps prevent a lot of miswiring for quite cheap.

First and foremost, I screw in the 12VDC power supply of the motors in the connector with the screws making sure that I respect the polarity. I am using an ATX 12V 30W power supply, you can scavenge this part in a used desktop computer or buy a power supply of same voltage and similar power supplies on ebay, aliexpress, etc.

Let’s move on to the laser connection.

The laser comes with its own 12V power supply, but I need to be able to turn the laser on and off from the CNC shield. To do so, I use an IRF540N NMOS transistor that, here, works as an Arduino-controlled switch. To achieve that, I have followed the schematic you can find in the pictures.

As I said earlier, I need to control the laser from the Arduino so let’s plug the 10Ohnm resistor (from the laser control schematic above) to the pin labeled “CoolEn” on the CNC shield via a Dupont connector. I also need to connect all the ground together, meaning the ground of the CNC shield to the “Source” pin from the schematic and the ground of the Laser power supply to the ground of the shield.

Electrical Part - Wiring the Motors

18.PNG
19.PNG

Saying that there is a lot of documentation online on how to connect the CNC shield to the stepper motor drivers (DRV8825) and to the motors is quite the understatement, but I will sum it up here.

First, I locate the “enable” (EN) pin on the driver and on the CNC shield and I plug the driver so that the “EN” of the driver is connected to the “EN” of the shield. For this project, we only need 2 motors, so we only need to plug 2 stepper motor drivers on the ports labeled “X” and “Y”.

Next, I need to connect the motors to the CNC shield. Here, I feel I must give you an explanation on what stepper motor look like on the inside. It is a set of 2 independent coils (hence the 4 wire connector on the motor) and you cannot plug the wire of the motor at random on the CNC shield (but it might work :D). First, for each motor, you need to identify the 2 ports of each coils with a multimeter in conduction mode and then follow the photo below to see were to plug each coils of each motor. To get the maximum precision, we also need to place jumpers on the pins on the CNC shield under the stepper drivers, the jumpers are coming with the DRV8825 drivers.

To connect the motors to the CNC shield, I drill a 10mm hole on the side of the multifunction printer and then I use male/female Dupont wire. The connector of the stepper motors I have are not originally meant to accept Dupont connector, but it fits, I just have to force it a bit.

Final Assembly of the Machine

20.PNG
23.PNG

Electronics is done! Here is what it should look like (the schematic needs the 2 DRV8825 stepper motor driver).

Let’s move on to the programing!

Programming the Arduino

The Arduino is the brain of the machine, it will translate the stencil cut orders into motion of motors and control of the laser. To do so, I will use the extremely popular GRBL motion control software as it is compatible with the file format of the stencil to cut.

This video will explain way better than me how to download the Arduino development environment and upload GRBL to the Arduino. Do not worry, it is literally a matter of minutes!

Controlling the Machine

21.PNG

The Arduino is now running GRBL, but the Arduino cannot do anything by itself, it needs to receive commands (motion and Laser control) from a computer. If you know every single G-code command by heart you can do it manually, but fortunately, there is a far more simple way to go: download a free software that can send commands for both “manual” motion control like “moving on the X axis by 10cm” but can also run entire G-code files like our stencil.

I chose to use Universal G-code sender (you can download it from here) for its simplicity, interface modularity and clarity. You can download it here. During the installation of GRBL on the Arduino you should have identified the port on which the Arduino is connected, you need to enter it at the top of the windows, fill the rest as I did.

You can now click on the button to connect to the arduino and you can now move around the laser with the buttons on the “jog controller” tab of the interface. To actually turn the laser “ON”, you have to manually send the command “M8” on the line in the bottom right corner and “M9” to turn it off but do not worry, these commands will be automatically included in the G-code file of the stencil we want to make.

Preparing the File to Cut

22.PNG
24.PNG
25.PNG

Files out
of Eagle or Kicad are not directly processable by GRBL, they need to be transformed into G-code commands.

However, you can easily export SVG or DXF file from Eage and Kicad. Here is the process in Kicad:

In the PCB window, go to files->export->SVG. Then select only the layer “F.Paste” (if you want to make a stencil of the top side of the PCB) and click “export”.

To create my G-code, I use the free software Inkscape with the free plugin “J Tech Photonics Laser Tool”. Inscape is capable of opening SVG and DXF files and the plugin can convert it into G-Code. Instructions on how to install Inkscape and the plugin are very well explained on this video . However, during the process of transforming your SVG file in G-code file, just before generating the G-code, you should enter the options "Laser ON Command: M8" and "Laser OFF Command: M9" (see pictures above)

This include the commands M8 and M9 in the G-code making the Arduino able to turn on and off the laser when necessary. Finally click “Apply” and that is it, you now have a G-Code file and a CNC laser cutter capable of interpreting it!

Calibrating the Machine

There is only one step remaining, as you might have fear, the Arduino does not know how many step/rotation the stepper motor has, in addition, there are different sets of gear ratios for each machine which means that universal Gcode sender will have the wrong idea of what the position of the laser is. This means that you have to calibrate your machine to match the distance of what the computer thinks have moved to the actual motion.

This is quite easy. First, generate a G-code for 100x100mm square (using inkscape and this instructional video). To calibrate the Y and X axis motor, add at the beginning of your G-Code the lines:

$100=100 ;$100 is the identifier of the X motor

$101=100 ;$101 is the identifier of the Y motor

Then cut the square and measure the dimension of the square. If you get for example 150mm instead of 100mm along the X axis, then you need to add at the beginning of all your G-code files:

$100=66.67 ; because 100/150=2/3 and 2/3*100=66.67

If the Y dimension is for example 50mm instead of 100mm, you need to put at the benning of all your G-Code files:

$101=200 ; because 100/50=2 and 2*100=200

Results

27.PNG
IMG20210129185627.jpg
IMG20210129185528.jpg
IMG20210129185600.jpg

Sorry for the quality of the picture here :(

The results are not perfect but still quite good! Concerning the mask, some footprint are not completely removed from the tape but it is a matter of second to remove the part that are almost cut from the mask. Concerning the soldering, some components have shifted during the reflow and this requires some additional work.

In a word, this method does works! But as is, it will be an interesting timesaver only for big PCB with a lot of component or if you are making a lot of board. That being said, there are a lot of improvement that can be made especially regarding the squareness of the axis, the flatness of the bed, the rigidity of the entire structure, etc.

Notes

This project might make you think of 2 axis machines build out of CD/DVD trays and this project is extremely similar. One might even say that it is the same on a bigger scale to be able to work with acceptable sized PCB thanks to longer axis. The control of the stepper motors is strictly the same.

If you do have a 3D printer, you can simply print a part to mount the laser on the 3D printer and cut the mask out of tape directly make sure first that it will not damage your print bed! This project is really about making the machine from scavenged parts.