PCB tools

Here are the scripts I use to convert PC boards from Kicad to G-code.
http://www.lwill.net/downloads/boardtools-01.tar.gz
This is the README included for information.
README 03/28/20012


Tested with LinuxCNC 2.6.0~pre and KiCad (2012-01-19 BZR3256)-stable and
pcb2gcode 1.1.4

### DISCLAIMER ###
CNC MACHINES CAN BE DANGEROUS!!!
THOROUGHLY CHECK AND TEST ANY CODE BEFORE RUNNING!!!

Files included in boardtools directory:
doall.py GUI front end for pcbbatch
pcbbatch.py Batch file to run all programs using config file
boardcfgdef.py Default config file
Etch_Z_adjust.2.2.cl.py Modified command line version
gerber2emc2cl.py Modified command line version
p2gdrillopt.py For optimizing drill files
p2gpathopt.py For optimizing paths
demo Directory with sample Kicad layout, gerbers, and
sample boardcfg.py for testing

REQUIRED:
python-argparse
pcb2gcode installed on system
EMC2/LinuxCNC 2.5+
KiCad

Optional:
opti (from Etch_Z_adjust) Untested, I have not used it, not included

-Quick and dirty:
Extract.
For GUI, from boardtools directory run:

$python doall.py

You will probably need to run doall.py at least once to verify default
file paths. Save defaults to boardcfgdef.py in installed directory.

To try demo:
Click "Load boardcfg"
Open the demo directory and choose boardcfg.py
Click "Default Paths" and set to the correct locations.
Click on "Browse" under "Board back" and reselect "demo-Back.gbl"
to make sure the path is working directory is correct.
This will automatically set the other files correctly.
Click "Run boardcfg" (it will automatically ask you to save)
Check out the generated files!

To run a config file from a project directory:

$python boardcfg.py

-The idea:
Generate ready to run g-code files from KiCad for LinuxCNC using one interface.

-The method (how I do it):
Schematic and board layout with KiCad.
I use the Comment layer for text and draw board outline using actual tool
path based on the bit I will be using so I can leave gaps to keep boards
paneled together. (there is an option to use pcb2gcode for outline instead)
Generate gerbers and drill files (4). *Back.gbl, *PCB_Edges.gbr, *Comments.gbr,
and *.drl
Use pcb2gcode to generate back and drill g-code files.
* the paths are very "stair-steppy" which I did not like
Use gerber2emc2cl to generate text and outline g-code files.
Join the paths and text together in one file.
Use p2gpathopt to reduce "stair-step", smooth paths, and reduce moves.
Due crude optimizing.
Use p2gdrillopt to due crude optimizing and optionally use only one drill bit.
Use Etch_Z_adjust (*modified) to do auto-leveling.

-The Solution:
Have a config / batch script to do all this automatically.
In reality there is a script that is placed in the drawing directory
that holds the configs (boardcfg.py) and calls another script (pcbbatch)
that does all the hard work. This way boardcfg can be run in place when
a board is modified without copying main script to each drawing directory.
All needed settings needed to run are saved in the boardcfg.py file.
A GUI to select all the various setting and generate the config file and
optionally run it.
Config file default name is boardcfg.py This can be modified by hand "at own
risk" if desired, but may break compatibility with GUI. Undocumented.

-What does the work:
pcb2gcode

Etch_Z_adjust.2.2.cl.py
Modified command line version. Added ability to re-run file without
re-probing. Modified to use a separate probe instead of tool bit, and to
set tool height automatically.(Must use EMC2/LinuxCNC 2.5+!!!!!! uses G10)
gerber2emc2cl.py
Modified command line version. Added ability to mirror and offset.
p2gdrillopt.py
For optimizing drill files. Allows using only one drill and does crude
optimizing using Morton number.
p2gpathopt.py
For optimizing paths. Smooths out pcb2gcode paths by finding the midpoint
of each stair-step, eliminates redundant points creating straight lines
within a set tolerance. (difference in slope < .001 or about .057 degrees)
Adds very slight deviations from original, but gives much smoother result.
You decide.
Also optimizes based on Morton number.

-Credit where credit is due:
While thoroughly hacked and mangled, my work is based on these previous works.
Both have no copyright/left restrictions in the files.
I likewise put no restrictions other than ask for credit if you use it.
(Please visit lwill.net)

Etch_Z_adjust from michael_m at cnczone.com
http://www.cnczone.com/forums/pcb_milling/82628-cheap_simple_height-probing-11.html#post843483

gerber2emc2 from SAMMEL Lothar on the LinuxCNC wiki
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Converting_Tools

-Other software:
KiCad
http://kicad.sourceforge.net/wiki/Main_Page

LinuxCNC
http://www.linuxcnc.org

pcb2gcode
http://sourceforge.net/apps/mediawiki/pcb2gcode/index.php?title=Main_Page

-Why my settings / method seems weird:
I actually use a coated board and a drag bit to scribe the coating, then drill
it without removing it from the machine, then etch in FeCl. The scribe
only needs to be offset .001. The scribe and probe mount off to the side
of my spindle, that is the reason for the offsets. I also use
Etch_Z_adjust for engraving other things using a normal engraving bit and
separate probe which was the original reason for modifying it.
I used the Morton number optimizing method because it was fast and simple and
better than nothing. I may rewrite the optimizing method later.
This is my first major attempt at Python programming, so it is ugly. It
started simple, and 1100+ lines of code later.... So don't ask why I did
something the way I did, the answer you will likely get is
"Because it worked!"
More info on this and other stuff at lwill.net/blog
All comments are welcome, but I reserve the right to ignore them!

I can be contacted though lwill.net


Screen shot of GUI:


Posted on 23 Mar 2012, 12:21 (Edited 23 Mar 2012, 13:16) - Category: PC Boards
No comments - Edit - Delete


PC Boards, My Way

I have found a new way of making PC boards.
I start with a bare board.
Place a thin layer of "secret" resistant coating on it.(on a spin coater)
Use my CNC router to "engrave" it with a drag scribe.
With out moving it, drill it and route outline.
Last etch it in ferric chloride.

Now this may seem odd at first. Why not just route the board with the CNC?
Let me try to explain. I have always used the photo resist method with laser transparencies and pre-sensitized boards, etched then drilled. When all goes well, the results are great. The biggest problem has always been getting a good 1 to 1 print from the laser printer. Next problem is lining the board up to drill it, which gets worse if the print was not square or to scale to begin with.
Now, my main reason is I am sorta cheep. I have never bought the right bits to do direct PCB routing. My router does pretty good, but I am just not sure how it would do, and hate to spend money just to break bits. I like the photo method, but bare boards are cheaper. There is also the fact I already have a bubble tank of etchant.
When I first started experimenting with my method I used an old photo board I had. It was a bit old, so I just tossed it in developer with out exposing it to fix the resist first. This worked, but still expensive board and the coating is very fragile and gets scratched during drilling. More on the coating later.
Next I made a drag engraving point out of an old carbide bit. I tried various angles and about 90 deg. works well. I mounted the point in a solid tool holder off to the side of my spindle, which is just a Rotozip, and while still fairly tight, does have a bit of play. Since I would be dragging and not spinning the bit I saw no reason to put the strain on the bearings or risk unnecessary flexing error. The bit holder is also longer than the spindle so I can leave my drill bit in and install and remove the holder between steps. (I have the offset set in EMC2)
I mount the board on a piece of "foam core" sign board with double face tape like used on window film. It is very thin and very sticky. This is then stuck to my table. This gives me a well supported board with the foam core having just a bit of give and acts as a waste board underneath for drilling.
I then run my code for the trace outlines. I use Kicad with pcb2gcode, but have came up with some scripts I will get into in another post* for generating my files and getting good results. I also incorporate a modified version of Etch_Z_Adjust to keep my depth consistent. I replace my scribe with a touch probe made from a micro switch and probe the surface first. I then replace the scribe and use a depth of .0015" which scores though my coating and leaves a fine line in the copper.
Now I remove the scribe and reset for drilling. Since nothing has been moved, everything is already lined up.
Last I do any cutout routing I want for the board shape.
Once finished on the CNC it is into the ferric chloride . Here one of the complaints often heard about FeCl is actually put to use. The scribe lines are very fine, but since I lightly scored the copper, a small amount of undercutting occurs, widening the lines slightly.
Does it save me any time? Well, I have ran 1.5" X 6" boards with 162 holes that take less than 10 minutes to engrave at 20 in/min. Compare with 8~12 min. exposure time and then developing, that is not bad when I do not have to realign for drilling. Etching is also quicker since I am not removing as much copper. Doing multiple boards takes longer of course, but if I make a mistake, only one gets screwed up and not a whole panel. I can also run different boards at the same time without having to make new films.

Once I was able to get good results, I wanted to stop using pre-sensitized boards and started looking for a coating that would work. I also needed a way to apply it consistently. I tried spray paint. Worked, but not consistent and had to be removed at the end. Tried various clear coats, polyurethane, stains, and wax with mixed results. One big problem was even coating without bubbles or dust. (like most people, I don't work in a "clean" room!)

The "secret" coating I found: Future vinyl floor finish! (now sold under the Pledge with Future name)
Apparently, model builders have been using it for years to coat windshields and protect decals. It is tough! Dries FAST. Nontoxic. And last, CHEEP! I add a little food coloring to make it easier to see, and a bit of alcohol to thin it just a bit. Oh, and you can easily clean it up with an ammonia based window cleaner!
Now to get it on the board. I built a spin coater. A motor and a spinning disk. My first small attempts I used a muffin fan with a pot to control the speed and got good results. I up sized and can now handle a 6" X 9" board inside a bucket to contain the mess. I control the speed using EMC2 and a spare high current output on my CNC's BOB. I came up with some custom M codes and a HAL file that let me control it like a spindle using PCM and can set the acceleration. I can now write a program to start slow while I apply the coating, spin up gently to throw off the excess, slow down to let it level and start to set, then spin the hell out of it and hit it with a heat gun to dry. The process is very quick and in less that 5 minutes I have a dry board ready to go, hardly enough time for dust to even settle on it if it could.
Added benefit, when the board is done, the coating is so thin it can be soldered though without removing it first and it protects the rest of the traces from corrosion.

*I will be doing another post on the scripts I use once I clean them up a bit.
*I will also be adding pictures the next time I run boards. I wanted to get this written up while I had a chance.

Posted on 5 Mar 2012, 2:07 - Category: PC Boards
No comments - Edit - Delete


Updates, updates, todo

Now that I got the last post off my chest, I will finally give some updates on what I have been doing.
I will touch on a bunch of stuff here, and give more detailed posts on some later, mostly so I can use this to assemble my thoughts. I will try and be as chronological as I can remember.
-Added a page on the controller used in the rain barrel. (CRAP!!! I just found out it is missing!!! Glitch in PPLOG.* Thank goodness for Google cache.)
-Started designing guitar effects pedals with another guy and going to start selling them. http://www.tonalinsanity.com
-Did a bunch of updates to my CNC machine. Updated LinuxCNC (formerly EMC2) and added a camera.
-Repaired an OMIS II digital comparer. Sorta cool.
-Replaced CV joint and u-joints on my Explorer drive shafts and rebuilt transfer case. Still have a vibration.
-Came up with a new way to make PC boards using the CNC.
-Made a simple (CNC controlled!) spin coater. (for making the PC boards)
-Using the CNC and some neat scripts to do engraving on the effect pedal cases and PC boards.
-Found an Apple Studio Display LCD in the trash and got it working with a DIY adapter.
-Been playing with CentOS and Scientific Linux as alternatives to Fedora. Mainly for MythTV.
-Got a few used computers and did some transplanting and need to update my list of computers.
-Re-wrote the scripts I use for PCB's. Will probably get their own page soon.
-Tons of little things while trying to keep Zoe (now 2!) out of trouble all day! Part of the reason the blog is not updated very often.

Major projects I plan on doing:
-Fix wife's Saturn (broken timing chain) or her folks van (broken band in trans) she WAS driving while waiting on the Saturn.
-Restart work on the Rain Barrel before spring gets here. Want to have something complete to offer others (sell?) this year.
-Get more serious about the effect pedals.
-Improving my solar pool heater this summer.
-Keeping Zoe out of trouble!!
-*Look for a new blog program. I like PPLOG, it is simple and different, but I think I am trying to make it do to many things and starting to extend it to far and break it. (added BBcodes, CAPCHA, and other tweeks) Been so long since I messed with it I hate to dig into it again. Perl is not my first language and don't feel like relearning all over again. We'll see.

Now to see how many more post I can do and if any of the projects get done!

Posted on 27 Feb 2012, 15:51 (Edited 23 Mar 2012, 13:21) - Category: General
No comments - Edit - Delete


In Memory

I have been putting this off for way too long, and the longer I wait, the harder it gets.
A lot of things have happened since the last entry. At the top of the list are some family issues that I have had a hard time dealing with and just not wanted to write about, but need to, to move forward.
In September my sister passed away. Two weeks latter, my mother suddenly passed away as well.
My sister had been fighting cancer for several years and was passed the point of making another come back. While there is nothing good about any of this, we had all tried to prepared for the eventual out come.
My mother as very unexpected. She had Parkinson's and other age related issues, but was still very active, not much could slow her down for long. She would take an occasional fall as I noted in an earlier post about my wedding, but most were relatively minor with some bad bruises. In fact just before my sisters funeral, she had taken a tumble and banged up her elbow pretty bad. Rather than waiting for someone else, she was trying to carry a play pen upstairs for us to use when we came home. She was then on blood thinners to prevent blood clots from the bruising. About a week and a half latter she got a bad nose bleed that would not stop, so she was taken to the hospital. They got it stopped and took her off the blood thinners while they kept her in the hospital for observation. All seemed fine when she suddenly passed away at night, officially from a heart attach, while still in the hospital. She had everything already planned, for when the day came, she wanted everything donated, then cremated, and simple memorial at the church, no flowers - but donations to cancer or Parkinson's research, or the church. Apparently, they used everything they could for transplant, even skin. Of course this has to happen quickly, and with living 300 miles away I did not have a chance to see her one last time. When we went home, my other sisters were already dealing with the few necessary arrangements that were left, so I ended up throwing myself into going through decades of photos to put together something to display at the memorial service. Being the youngest of 4, there were a lot of old pictures I had never seen, that showed me my mother as young person I never knew. It was hard, but in ways it seemed like someone else, probably the only thing that kept me from going bat shit and curling up in the corner a blubbering mess. We all were a bit worried about my dad for a while, but he seems to be doing OK, in fact he and my brother-in-law have gotten much closer supporting each other.
I am so glad Mom got to know Zoe for at least a short while, and while she may not remember her Grandma, at least Zoe will have pictures with her to look back at one day and see the joy in her face.
Since then we made it though Christmas and all trying to keep moving forward. With spring coming things all start anew and since Mom loved her flowers and garden, I will be putting more effort into finishing the rain barrel system in her memory.

Posted on 27 Feb 2012, 12:59 - Category: Family
No comments - Edit - Delete


Pages: [1] [2] [3] [4] [5] ...