From RepRap
Revision as of 14:32, 11 September 2010 by Casainho (talk | contribs) (Warning about this solution being just for proprietary and commercial Eagle software :-()
Jump to: navigation, search
Crystal Clear action run.png

Release status: Experimental

Plotting drawings on flat surfaces with RepRap, like plotting on paper or printed circuit boards.
CAD Models
External Link


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.

<videoflash type="vimeo">13521005|640|480</videoflash>

What is needed

  • draw the electronic schematic and after the PCB on any program like 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, 3) but the standard RepRap host software and Skeinforge are RepRap's internal tools to make PCBs.

Using the RepRap Host Software

WARNING: This feature just works with the proprietary and commercial Eagle software.

This facility is experimental, but it has already made a [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/ in the RepRap distribution.

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/ 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. (Top Copper)
  2. (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. 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:


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:

<videoflash type="vimeo">14869949|640|480</videoflash>

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

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:


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:


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.



An alternative tool path generation option is at

  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
    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 and the file should be ready for consumption: -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.

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.

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. Don't use glass-fiber copper-clad board - it will blunt your drills and saw. Use copper-clad resin bonded paper.
  2. 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.
  3. 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.
  4. Leave the PCB overnight to dry fully before etching it.
  5. 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.
  6. 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.
  7. Agitate the etchant while it is working (see the video below).
  8. 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.
  9. Don't take the ink off until you are ready to solder the PCB. It will stop the copper from oxidizing.
  10. Remove the ink with methanol or acetone (i.e. methylated spirit or nail-varnish remover) soaked into a soft cloth or tissue.
  11. 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.
  12. 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.

<videoflash type="vimeo">14880050|640|480</videoflash>

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

See Category:Toolheads.

For developers

If you are looking on information to know and understand about RS274X (Gerber) files, see this page.