Gerbertogcode

Overview

flickr:4952960536

Gerbertogcode.py is a script that will take a Gerber file and convert it into a printable .gcode file for your Unicorn MK1. It has some optional configurations to set speed, line widths, etc.

See the Unicorn MK1 usage page for information on where to download gerbertogcode.py and some of the other tools/scripts.

Step 1: Create the PCB Design

Let's create an LED board that can be used as a progress bar for MakerBot. I settled on Charlieplexing 12 LED's and controlling them with 4 inputs and after quickly sketching out the schematic on paper I created a schematic in Eagle.

flickr:4968732084

There are some good PCB design programs out there. A lot of people use Kicad or Eagle but Eagle is our favorite. There are also lots of good tutorials for how to get started with these programs. Sparkfun has a great series on using Eagle.

I then switched over to the Board and started laying out my parts. I took my time here to make the layout as clean and efficient as possible. I also added some flashy text on the top copper layer.
flickr:4968731912

Some things to keep in mind when laying out your board to ensure it can be printed successfully:

  • You'll want to modify your design rules to account for the thickness of pen that you'll use
    • I've created a design rule file that works great with extra fine point sharpies: unicorn-extra-fine-sharpie.dru. Just download it, move it into your EAGLE/dru directory, and load it up in Eagle before you route your board layout.
  • Space your board out as much as possible. You want to eliminate, as much as possible, traces and pads that might accidentally touch each-other.
  • SMD boards are generally far easier and faster to make than through-hole boards because they don't require any drilling (which can definitely get tedious if you have a lot of pads).
    • pro tip: use zero-ohm resistors (or a simple jumper wire) to jump over traces instead of using vias and a bottom layer
  • Note: The script is still a work in progress. We've had great success with SMD boards but some through-hole pads are not currently supported in the script. The code is pretty well laid out and documented thanks to the amazing help of Adam Cecchetti so if you have what it takes to implement the final features, then by all means dive right in.
flickr:4971834960

Load up the unicorn-extra-fine-sharpie.dru and do a design rule check. It should pass. I used the autorouter to route my board and it did a pretty good job. In the autorouter preferences be sure to set the botom layer to N/A assuming you're doing a single sided board. I specified a grid of 10mil but you should play around with it and see what works best for your board. Check to see that all the airwires were routed by clicking the Ratsnest button (it should say "Ratsnest: Nothing to do!"). Awesome! The design should be ready to go.
flickr:4968124695

Step 2: Export the Gerber File

To create the Gerber file for our board we'll want to open the CAM processor and use Sparkfun's sfe-gerb274x.cam (other Gerber274X jobs should work but we've done most of our testing using Sparkfun's).
flickr:4968125103 flickr:4968125319 flickr:4968733270 flickr:4968733482

We now have a .GTL file (along with many others) in our board/schematic's directory. That .GTL is the file that we're going to send through gerbertogcode.py to give us some MakerBot-able G-Code. (hint: .GTL is for the top copper layer and .GBL is the bottom copper layer)

Step 3: Create our GCode

Creating your GCode is pretty easy now. We'll copy the .GTL file from our project directory into the directory where gerbertogcode.py lives. Then, it's as simple as running the script on the Gerber file. There are a few options to play with but for the most part the defaults should be pretty solid.
flickr:4971854384flickr:4968126419

#get a list of options and help
python gerbertogcode.py --help

#generate gcode with standard settings
python gerbertogcode.py test.GTL > test.gcode

#generate gcode with a feedrate
python gerbertogcode.py --xy-feedrate=1234 test.GTL > test.gcode

#generate gcode with a bunch of settings
python gerbertogcode.py --xy-feedrate=1000 --linewidth=1.0 test.GTL > test.gcode

flickr:4968126575flickr:4968734010

Step 4: Run your GCode

Now we're ready to actually make this board! Place a copper clad board on the build platform and secure it with a bit of tape. Copper clad pc board can be found at lots of places online…. Even RadioShack sells them.

Open Replicatorg 019 (or later) and copy and paste in your generated g-code
Position the pen in the lower left corner of your board with the tip at about 1mm above the surface and hit "Build."
Magic happens…
flickr:4952961076

A note about pens…
We've had best success with sharpie extra-fine-tipped permanent markers. Some other will probably work but it's a tricky balance between getting a pen that's adequately thick to resist the etchant and one that's thin enough to produce the traces you want.

Run the build multiple times. It may also be a good idea to let the ink dry before you do your next pass. To be sure that it'll resist the etchant, do three or more passes.

Step 5: Etch the board

A fellow MakerBot colleague, Charles Pax, clued me in to his super simple and awesome technique for etching boards.
You'll only need a few things: a small lock&lock box (or two), etchant, tinner (optional), wooden tweezers (or something similar).

WARNING: These chemicals are pretty nasty and will burn/stain skin. Where gloves and only do this in a very well ventilated area.

To make the etchant solution drop one piece of the solid etchant into the lock&lock box and fill it 2/3 full of warm/hot water. Close the lid and shake it until it's well mixed.
(Note: the pictures are from an earlier version of the board but the process is exactly the same)
flickr:4952368531flickr:4952961936

Next, place your copper board in the warm etchant solution, close the lid and shake, shake, shake. This step can sometimes take a little while depending on how fresh your etchant solution is and the thickness of your copper clad board.
flickr:4952369647flickr:4952962406

First the copper will loose it's sheen, then the edges will start to be etched away revealing the fiberglass interior. Eventually all of the copper will be removed, leaving just your traces. Take your board out and wash it under water.
flickr:4952962886

If there's still some sharpie left on you should remove it with acetone or terpentine. Just dab some on a paper towel and wipe it over the surface of the board. As always, do this in a well ventilated area.

The final and optional step is to dunk the board in a small amount of liquid tin. Take your board out with the wooden tweezers once the traces turn silver (it will be quite quick) and wash it. Both the etchant solution and tinner can be reused many more times and can be stored in the same lock&lock boxes that were just used.
flickr:4952963640flickr:4952963870

Step 6: Solder on your components!

You're board is done and ready to receive your electrical components.

For the Unicorn LED Board I used 4 1k ohm resistors (though 1.8K resistors would be ideal) and 12 1206 red LED's. Note: The LED's have polarity and it's important to get them facing the right direction. On the bottom of the LED there should be a little green dot. That's the negative side. (The "+" and "–" signs on the board represent the positive and negative side respectively.

Solder them up as you normally would. For surface mount stuff you can use solder paste and then just touch it with your soldering iron or you can use the hot plate method described here.

You can find some example arduino code for the Unicorn LED board here. Wire pad 1 (the leftmost pad) to arduino analog pin 0, pad 2 to analog pin 1, pad 3 to analog pin 2, and pad 4 to analog pin 3.

Huge thanks to Jimmie Rodgers for developing an awesome code base for charlieplexing LED's and for fixing the LED ghosting problem with a simple pin reassignment

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.