Plotting

From RepRap
Jump to: navigation, search
Crystal Clear action run.png
Plotting

Release status: Experimental

Plotting-emc2.png
Description
Plotting drawings on flat surfaces with RepRap, like plotting on paper or printed circuit boards.
License
unknown
Author
Contributors
Based-on
Categories
CAD Models
External Link


Introduction

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.

Software tools

There are a few approaches (1, 2, Builders/Replath 3, hpgl->gcode 4) but the standard RepRap host software and Skeinforge are RepRap's internal tools to make PCBs.

Using the RepRap Host Software

This facility is experimental, but it has already made a fully-working set of electronics for RepRap itself.

Reprapped-pcbs.jpg

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:

  1. my_pcb.top (Top Copper)
  2. my_pcb.bot (Bottom Copper)
  3. my_pcb.tdr (Top Drill File)
  4. 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:

  1. Extruder3_ExtrusionSize(mm)=0.3
  2. Extruder3_Lift(mm)=1.0

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:

Pcb-in-reprap.png

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...):

Pcb-paths-from-reprap.png

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:

Using Slic3r

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.

Using Skeinforge

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:

Plotting-gerbv.png

  • 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:

Plotting-inkscape trace bitmap.png

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:

Plotting-exporting paths svg.png

  • 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:

Plotting-curves to mesh.png

Hit "TAB" to enter edit mode. Hit "A" to select all vertices. Hit "W" and select "remove doubles" from the menu:

Plotting-remove doubles.png

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:

Plotting-extrude 01.png

Plotting-extrude 02.png

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:

Plotting-scale x y.png

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:

Plotting-blender.png

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.

Plotting-skeinforge.png

  • 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:

Plotting-emc2.png

If you are happy with the final GCode file, then you may go ahead and load it with your RepRap software of choice like RepRap host, RepSnapper, etc.

Using cad.py

Plotting-cadpy.jpg

An alternative tool path generation option cad.py is at http://www.cadsoftusa.com/

  1. 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
  2. Create tool paths with cad.py
    1. First chose the png file by clicking the "Input File" button
    2. Set "in. per unit": 4.06
    3. Render the image again at this point
    4. Click "Cam" button
    5. Click "Output Format" and select file type: ".g(G Codes)"
    6. Set the following values:
      1. maximum vector: 0.75
      2. tool diameter: 0.1666
      3. tool overlap: 0.309
      4. contours: -1
    7. 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
  3. 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

Pen

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.

Fine-Tip Red Color Staedtler Lumocolor Permanent Marker 318-2.

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

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

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.

  1. 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.
  2. Don't use glass-fiber copper-clad board - it will blunt your drills and saw. Use copper-clad resin bonded paper.
  3. 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:
    1. Plot the PCB with the pen
    2. Take the pen out and put the cap on it.
    3. Set the bed temperature to 50oC.
    4. Leave it at that temperature for one hour.
    5. Let the bed cool.
    6. Re-plot the PCB over the now-dry ink.
    7. Repeat twice more.
  4. 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.
  5. Leave the PCB overnight to dry fully before etching it.
  6. 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.
  7. 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.
  8. Agitate the etchant while it is working (see the video below).
  9. 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.
  10. Don't take the ink off until you are ready to solder the PCB. It will stop the copper from oxidizing.
  11. Remove the ink with methanol or acetone (i.e. methylated spirit or nail-varnish remover) soaked into a soft cloth or tissue.
  12. 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.
  13. 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:
    1. It gives a fat path for any high-current parts of the circuit.
    2. It fills in any small holes that the etchant may have made because the ink pattern was not perfect.
    3. 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...

Pen holder

In thingiverse there are many nice pen holders to be coupled on different extruder models: 1, 2, 3, 4.

See Category:Toolheads. In particular, Category:PenHolderToolheads.

For developers

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.