By plotting using one RepRap 3D printer like Mendel, one can draw designs on a flat material like paper or copper printed circuit boards (PCB). By plotting on copper, RepRap empower us to make our own PCBs. Plotting onto copper-clad boards is perhaps the most promising way of Automated Circuitry Making.
What is needed
- draw the electronic schematic and then the PCB using a Useful Software Packages such as KiCad. Export the Gerber files;
- use a software to convert the Gerber files to GCode files that RepRap understands (see next topics), in this case for plotting;
- install one pen on RepRap pen holder (see next topics) and start plotting.
Using the RepRap Host Software
This facility is experimental, but it has already made a fully-working set of electronics for RepRap itself.
Two PCBs for the RepRap Pololu Electronics made using the RepRap host software. The one on the left still has the etch-resist red ink on and has just been rinsed after being etched. The one on the right has been drilled and soldered, and has all its components on.
Note the solder that has been run along all the tracks of the board on the right. See Hints and Tips below.
Generating the Gerber files from your PCB design
The RepRap host software needs two Gerber files for each PCB you want to make: the track layout and the drill file. So if you have a double-sided board (courageous...) you will need four files: two for each side.
There is a job definition file for Eagle to generate these automatically. It is in the file electronics/reprap-gerb274x.cam in the RepRap distribution. It should be straightforward to get other electronics CAD packages like Kicad to output the same Gerber files that Eagle creates.
Start by loading up the board you want to make and select the CAM Processor option from Eagle's dropdown File menu.
In the CAM Processor's File menu select File->Open->Job.... Navigate to the RepRap CAM job file electronics/reprap-gerb274x.cam and load it.
You will see that it has four tabs: Top Copper, Bottom Copper, Top Drill File and Bottom Drill File. These are the four files for the two sides of the board you are going to make. If you just have a single sided board, you can ignore the irrelevant pair.
Hit the Process Job button, and Eagle will write the four files into the same directory as the PCB design is stored. (If you want them somewhere else, use the File button in each of the four tabs to say where to put the output before you process the job.) If your PCB is my_pcb.brd, the four files will be:
- my_pcb.top (Top Copper)
- my_pcb.bot (Bottom Copper)
- my_pcb.tdr (Top Drill File)
- my_pcb.bdr (Bottom Drill File)
The RepRap host software expects to see these extensions.
You may wonder how the drill files differ. Holes are holes, after all. One is the mirror image of the other.
Creating G-Codes from the Gerber files to drive RepRap
You will need to have an extruder in your RepRap called PCB-pen for this to work. This is done by changing the "Extruder_InFillMaterialType(name)=" preference for one of your extruders to "Extruder_InFillMaterialType(name)=PCB-pen". Of all the many extruder parameters that a standard RepRap extruder has, only two are important here:
The first is the width of the pen's drawn line. You may want to make this slightly smaller than the true width, so that there will be a small amount of overlap when adjacent lines are drawn. The second is how high from Z=0 to lift the RepRap X carriage to separate the pen from the PCB so it can move without leaving a mark.
Run the RepRap Host software.
If you select the host software's Display Paths radio button before you do anything else, it will show you plots of the PCB design and the corresponding pen paths.
The software reads the Gerber file and creates an internal representation of the corresponding PCB from it that is exactly the same as its normal representation of a slice through an object to be reprapped. It then uses the drill file to dot small circular blank holes onto that pattern:
It then uses the code that generates outlines from slices to run round the outside of the pattern. Then it repeatedly erodes away the pen's thickness from the pattern and runs round the outside of the result until there is nothing left. It then joins up all the resulting paths to reduce in-air movements of the pen. This uses a heuristic (an optimal result would require a full traveling salesman solution...):
Select the PCB button from the Print tab. It will ask you for the Gerber file you generated (either the Top Copper or the Bottom Copper file). It will load the corresponding drill file automatically. It will then ask you for a G-Code file for output in the usual way.
It will then tell you the X and Y dimensions of your PCB and ask you to supply an offset. This is the point on the RepRap build base relative to (0, 0) where the bottom left corner of the PCB will go. This is particularly useful if you want to draw several PCBs on one large sheet of copper-clad board. You can run the program twice and position them beside each other so they are distinct. You then just replay the two G-Code files one after the other. Each G-Code file's final command shuts RepRap down, so you will have to press the reset button in between.
The drill file is used to mark the centres of drill holes. Thus the drill diameters in it are not used. A standard small hole is plotted that the etchant will remove, making subsequent drilling much easier as the drill won't skid about over the copper surface.
Here is a video of part of one of the PCBs above being plotted in RepRap:
First one must convert the SVG file to STL, one can do it easily at http://svg2stl.com/, extrude the image with 1 mm or less.
For the Reprap be able to plot, the printer must lift some milimeter when passing between segments. It is easy to accomplish this in Slic3r.
- First one should activate the "Expert Mode". In "File->Preferences..." select "Expert" in the "Mode" drop down menu. Restart Slic3r and you will be in "Expert Mode".
- In "Expert Mode" many new options will show up. In the tab "Printer Settings", we need to set the option "Lift Z" in the "Extruder 1". You should select the amount of milimeter for your particular case, this is the distance the z-axi will lift between segments, 2-5 mm should suffice. Also set the "Nozzle Diameter" to the diameter of your pen.
- Go to the tab "Plater" add your STL and export as G-CODE.
- Now one can print the generated G-CODE, but one must deactivate the extruder, this can be easily done in Repetier-Host, just print in "Dry run" mode and the extruder will not be activate.
Skeinforge don't open Gerber files, but open the 3D STL files. If we create a 3D object from the Gerber files and export to STL file, we will be able to use Skeinforge.
To create a 3D object from Gerber file, we need the following Free Software tools (all of them are available to Linux Ubuntu where the following steps were done/tested):
- Gerbv - to view Gerber file and export as PNG file
- Inkscape - to import PNG file, create paths and export as SVG file.
Note if you have a skeinforge after version 10.09, you can import inkscape svg directly and skip the Blender step below. Also Note: Markus had an issue with inkscape svg's not being scaled properly. here is his solution:
Ok, I just solved the issue. I was not aware that Skeinforge has now a scale plugin. With that this is easy. Inkscape always assumes 90 pixels per inch, we use 600 dpi instead of 90 when creating the PNG file. Skeinforge things the size is always in mm. Hence the scale factor is s = 90 / 600 / 2.54 = 0.059.
- Blender - to import SVG file, create 3D mesh and export STL file
- Skeinforge - to open the STL file, generate the plot paths, simulate the plotting and export GCode file
- EMC2 (optional) - to open the GCode file and simulate the plotting
- RepRap host, RepSnapper, etc - programs to open the GCode file and controlling your RepRap, doing the plotting.
Next are the steps needed to use generate plotting paths from Gerber files.
- Gerber to SVG -- Export the gerber file as SVG using Gerbv:
- SVG to PNG -- Import the SVG file using Inkscape, finally export to PNG file with 600DPI.
- PNG to SVG paths -- Import the PNG file with Inkscape. Select the image and hit "SHIFT + ALT + B" to execute the Trace bitmap. De-select Smooth box and click on update button and finally on ok:
Delete the PNG you imported before and leave just the paths. Select all the paths with paths tool (F2). Hit (CTRL + '+') for union all the paths. Finally export as SVG:
- SVG paths to 3D mesh STL -- Import the SVG file with Blender. Zoom to see what was imported, should be small. Hit "ALT + C" to convert curves to mesh:
Hit "TAB" to enter edit mode. Hit "A" to select all vertices. Hit "W" and select "remove doubles" from the menu:
Now let's extrude on Z axis by one unit. Hit "A" until all vertices are selected. Hit "E" to start extruding and "Z" to constrain on Z axis, finally hit "1" to extrude by one unit:
Now you should have a non-manifold mesh! You can verify by hiting "A" until all vertices are un-selected, then go to Select menu and choose Non-manifold - Blender will highlight any non-manifold vertice.
Now hit "N" and verify that the measures of X and Y are incorrect. We need to change them to the correct values. I verified on KiCad the X and Y values and just apply them on Transform properties menu:
Hit "TAB" to leave edit mode and now you have a correct size 3D object that should be almost equal from your initial gerber file:
Now export to STL file.
- STL to GCode -- With Skeinforge open the STL file and start the convertion to GCode. You can use some extruding profile and tweak it to get the best results.
- Simulation using EMC2 (optional) -- Although Skeinforge also do simulation, EMC2 can help you see in real time the plotting path. It's important to simulate at least until you get a correct tweaked profile for plotting.
EMC2 can be builded on recent Linux Ubuntu versions on simulator mode - see this page.
When you load the GCode, EMC2 may give errors because of custom M codes from RepRap, just make a copy of the GCode file, remove with a text editor the M codes and open again the file. Here the simulation happening:
An alternative tool path generation option cad.py is at http://www.cadsoftusa.com/
- Export traces from Eagle or other circuit board software as an .png image @ 600dpi (Layers - Pads, Vias, Bottom, and Drill Aid). You will probably have to mirror the image with some image software (paint) to plot the bottom layer
- Create tool paths with cad.py
- First chose the png file by clicking the "Input File" button
- Set "in. per unit": 4.06
- Render the image again at this point
- Click "Cam" button
- Click "Output Format" and select file type: ".g(G Codes)"
- Set the following values:
- maximum vector: 0.75
- tool diameter: 0.1666
- tool overlap: 0.309
- contours: -1
- Click "contour" and wait for the paths to be generated. By default the file will be output to the input directory when you click the "save" button
- Run the Mendelize tool http://github.com/metrixcreate/mendelize and the file should be ready for consumption:
mendelize.py -t 1.0 -z 60 -f 1800 ramps1.0mirror.g > ramps1.0mirror.gcode
Permanent ink pens
Fine-Tip Red Color Staedtler Lumocolor Permanent Marker 318-2
The Fine-Tip Red Color Staedtler Lumocolor Permanent Marker 318-2 is the best for this purpose.
One pen that works well on most etchants is the staedtler lumocolor permanent marker. The red color is best (the ink is also used in the marker for chemical lab glassware).
It only resists strong etchants without fail if the pen is fairly fresh, so it may be best to get the refill station so you always have a "new" pen at low cost. - via Homebrew_PCBs
Pigment ink pens
- Staedtler pigment liner of 0.05mm, 0.1mm, 0.2mm, etc can be bought on shops like Staples.
This pigment ink should resist to the etchant just like the people that are printing PCBs with Epson printers which have his DureBrite pigment ink that resists to etch acid.
other etch-resistant pens
- Sharpie marker
- nail polish
- Google search: "etch-resistant+pen"
Hints and Tips
These are what I (Adrian) did to get the Staedtler Lumocolor pen above to work. But most of them are generally applicable.
- Design with fat tracks and pads. I use 1.27mm tracks and 2.5 mm diameter pads on a 2.54 mm grid. You can globally change the size of the tracks and pads in an existing Eagle PCB design using the Design Rules Check (DRC) menu tabs.
- Don't use glass-fiber copper-clad board - it will blunt your drills and saw. Use copper-clad resin bonded paper.
- You need more than one layer of ink to resist the etchant. I went over the PCBs three times. A heated bed in your RepRap helps to speed things up here. The sequence is:
- Plot the PCB with the pen
- Take the pen out and put the cap on it.
- Set the bed temperature to 50oC.
- Leave it at that temperature for one hour.
- Let the bed cool.
- Re-plot the PCB over the now-dry ink.
- Repeat twice more.
- Check and correct the PCB ink pattern by hand using a magnifying glass, a scalpel, and the pen. Fill in any mistaken small holes with a generous blob of ink. Remove ink with the scalpel where it bridges between pads or other features that shouldn't be connected.
- Leave the PCB overnight to dry fully before etching it.
- Use freshly-made-up etchant. I use ferric chloride. Dissolve it in distilled water to give a saturated solution (i.e. until no more will dissolve). You can get distilled water by scraping the frozen condensation off the inside of a freezer.
- Etchant is not that dangerous, but treat it with respect. It will indelibly stain anything it touches bright orange. Don't get it on your skin, your clothes, your hamster, or anything else that you value. Don't drink it.
- Agitate the etchant while it is working (see the video below).
- As soon as the last bit of unwanted copper has gone, take your PCB out using plastic tweezers and rinse it. Don't leave it in the etchant any longer than needed.
- Don't take the ink off until you are ready to solder the PCB. It will stop the copper from oxidizing.
- Remove the ink with methanol or acetone (i.e. methylated spirit or nail-varnish remover) soaked into a soft cloth or tissue.
- Drill the PCBs holes using a pillar drill or a Dremel on a stand. Put a small piece of flat wood under the PCB to support it.
- Don't just solder the components in, run solder along all the tracks too (see the picture of the PCB at the start of this section). This achieves three things:
- It gives a fat path for any high-current parts of the circuit.
- It fills in any small holes that the etchant may have made because the ink pattern was not perfect.
- It prevents the copper from oxidizing. (You can also achieve this by spraying the board with varnish after it has been made and tested.)
Here is a video showing an automatic etchant-agitating system (All right. An old ice cream tub and an electric motor) that I made years ago. It would be very easy to reprap one of these.You want the agitation to be vigorous enough that you have an almost-breaking wave running from one end of the tank to the other. The shallower the etchant, the more vigorous the agitation. The deeper the etchant, the more molecules of ferric chloride you will have to remove the copper...
If you are looking on information to know and understand about RS274X (Gerber) files, see this page.
Here is a sample design rule file for Eagle that likes 7mm traces, 7mm clearance(except pads & vias), restrings pads large enough for fat pens, etc. File:SampleEagleDR7mm.zip. It is by no means the limits to printing ability, but may give an idea how to set your design rules to fit your printer.