As part of the CNC drilling machine challenge, one of the things we have to be able to do is parse NC drill files. The idea being that using an industry standard file format makes the machine compatible with a much wider range of PCB layout software.
One of the problems we have is that Eagle sucks.
Yes, that's quite an inflammatory comment but, compared to ExpressPCB, we've seen loads of people have trouble with Eagle-drawn circuit boards.
The first thing is those stupid lozenge shaped pads. And the default hole size seems to be too small. And the pads are ridiculously small. And when you've finally etched your board and drilled it, it's all too easy to ruin a pad because your 1mm drill bit has ripped up all but the tiniest thread of copper left around the pad (right-most-pad, below). One slight wobble with the drill or mis-aligned pad and the whole board can be ruined!
Over at Nerd Towers, we defy convention and refuse to get drawn in to the everyone-uses-Eagle-so-we-must argument. Although it's less of an ideological standpoint and more to do with the fact that it's just so complicated to use when no-one has ever shown you how!
Our tool of choice is ExpressPCB. It's not only free but it's simple to use.
For the hardcore gerber-loving geek crowd, the very things we laud it for may well be it's Achilles Heel too - but it is very simple to use and you can get a PCB thrown together very quickly, all with 2mm pads with 1mm holes (ok, the default is 0.89mm but what's a tenth of a millimetre between friends?). No worring about mirroring, or not mirroring, or which-do-I-mirror before printing for toner transfer - just draw on the top (red) layer and print it out!
To produce PCBs for etching, we usually print to a virtual printer, such as CutePDF and make a PDF file for editing in Inkscape but one thing we recently discovered was the "export to DXF" option
This is quite exciting, as it allows us to generate a file which can be parsed and turned into a drill file. The export to dxf option in ExpressPCB can send just the pad data to a single drawing. Simply loop through the text-based dxf file, find all instances of CIRCLE and write the co-ordinates out to a NC Drill compatible file format!
After a cursory glance at the generated dxf file we can see all our pad data quite easily:
Every pad is a circle entity so we fiddled with a few values and loaded the resulting dxf into Inkscape until we found which entries corresponded to the X and Y co-ordinates. Ultimately it is these values that we'll be interested in to create our own NC drill file.
(comments in the above image were added one we'd identified which values did what, they were not present in the original, generated dxf)
To try out our idea, we picked a circle and set the X/Y to zero and the radius to 4
Interestingly, Inkscape does not position circles from their centrepoint, but from the bottom left corner of the shape. So we expected to see our shape at -4,-4
Inkscape seems to include the stroke (shape outline) width in the X/Y co-ordinates for each shape. So we reduced the stroke width and indeed the X/Y co-ordinates updated accordingly.
We can only assume that with a stroke width of zero, the shape would indeed line up to -4,-4 and thus prove that the values we changed in our dxf file were indeed the correct x,y and radius values.
With this in mind, we're off to write a simple script to convert metric x/y value pairs into an NC Drill file.....
Showing posts with label expresspcb. Show all posts
Showing posts with label expresspcb. Show all posts
Sunday, August 12, 2012
Saturday, August 6, 2011
DIPTrace to replace ExpressPCB?
To date, our preferred PCB layout software of choice has been ExpressPCB.
It's a brilliant bit of kit, easy to use, simple to build your own components, and best of all - FREE! For through-hole work it's really easy to use - draw everything you want on the top (red) layer and print straight onto your press-n-peel. Admittedly getting a usable output for SMT is a bit fiddly at first (install CutePDF then print your boards to a PDF file, load into Inkscape, mirror/flip horizontall and THEN print) but it's nothing that takes more than a minute or two to sort out.
Since we discovered Quick-Teck we've had to give serious consideration to gerber files. Until now, we've never bothered with them - and as a result had no need to learn how to use the, frankly, clunky Eagle interface. But after getting a quote from quick-teck.co.uk for PCB manufacture, and a second one for sourcing the components and assembling the board, we're seriously considering getting our boards supplied ready-assembled.
The problem with this approach is that while PDF schematics and layouts are fine for making your own boards via toner-transfer, and for using to get a quote for a job, they're not really acceptable for making the circuit boards from. Most PCB manufacturers prefer gerber files and Quick-Teck are no different. Which means we're probably going to have to get friendly with Eagle.....
... or does it?
In our recent trials of different PCB software, we gave RS Component's DesignSpark (PCB design and layout software) a go. Like many companies keen to get in on the maker scene (think Farnell/element14, AutoDesk etc) RS are giving away free software to lower the barriers to get the community involved. The problem we found with DesignSpark is that it was too much like Eagle - complicated and clunky. One thing we did like, however, was that when drawing a schematic, clicking between two sets of pins drew a nice connecting line, with 90 degree bends automatically drawn in the appropriate places: drawing schematics like this is quite nice.
With an inherent dislike of Eagle, and having dismissed DesignSpark, we went looking for alternative software and stumbled upon DipTrace.
DipTrace is a really nice, simple, intuitive PCB design and layout application. It does the nice "semi-auto-complete" drawing on schematics- and then extends this to the PCB layout application too. It has full component auto-place AND trace auto-routing (we haven't used either of these for our projects, but it's nice to know it's there) AND includes helpful auto-drawing when placing traces by hand.
In short, we think DipTrace is an excellent bit of kit.
It's as simple to understand as ExpressPCB, making your own components and layout patterns is a doddle and it has all the fancy export options you'd expect to find (including dxf and gerber). Hobby users haven't been forgotten either - from the print preview screen you can mirror the output (for toner transfer/press-n-peel users) and it even has a "outline the traces for CNC output" option for anyone who wants to rout the traces out from copper clad board on a CNC routing machine.
It took us just a few hours of playing about tonight to not only create a library of our most commonly used components (amended to include big fat pads for easy soldering) but also to draw an intermediate-level schematic and layout the PCB for it. In less than three hours we had a board printed and ready for etching. After three hours with Eagle we were still trying to work out how to move more than two components without screwing up the entire design!
Look out for future posts detailing how to use DipTrace.
We'll be using it a lot in future and hope to convert a lot of our earlier projects using it - starting with our current miniature guitar project.
With a free non-commercial licence (2-sided board, up to 500 pins) you'd have to be a pretty hardcore user to need to upgrade - by which time you shouldn't mind paying the relatively modest licence fee for the full package!
It's a brilliant bit of kit, easy to use, simple to build your own components, and best of all - FREE! For through-hole work it's really easy to use - draw everything you want on the top (red) layer and print straight onto your press-n-peel. Admittedly getting a usable output for SMT is a bit fiddly at first (install CutePDF then print your boards to a PDF file, load into Inkscape, mirror/flip horizontall and THEN print) but it's nothing that takes more than a minute or two to sort out.
Since we discovered Quick-Teck we've had to give serious consideration to gerber files. Until now, we've never bothered with them - and as a result had no need to learn how to use the, frankly, clunky Eagle interface. But after getting a quote from quick-teck.co.uk for PCB manufacture, and a second one for sourcing the components and assembling the board, we're seriously considering getting our boards supplied ready-assembled.
The problem with this approach is that while PDF schematics and layouts are fine for making your own boards via toner-transfer, and for using to get a quote for a job, they're not really acceptable for making the circuit boards from. Most PCB manufacturers prefer gerber files and Quick-Teck are no different. Which means we're probably going to have to get friendly with Eagle.....
... or does it?
In our recent trials of different PCB software, we gave RS Component's DesignSpark (PCB design and layout software) a go. Like many companies keen to get in on the maker scene (think Farnell/element14, AutoDesk etc) RS are giving away free software to lower the barriers to get the community involved. The problem we found with DesignSpark is that it was too much like Eagle - complicated and clunky. One thing we did like, however, was that when drawing a schematic, clicking between two sets of pins drew a nice connecting line, with 90 degree bends automatically drawn in the appropriate places: drawing schematics like this is quite nice.
With an inherent dislike of Eagle, and having dismissed DesignSpark, we went looking for alternative software and stumbled upon DipTrace.
DipTrace is a really nice, simple, intuitive PCB design and layout application. It does the nice "semi-auto-complete" drawing on schematics- and then extends this to the PCB layout application too. It has full component auto-place AND trace auto-routing (we haven't used either of these for our projects, but it's nice to know it's there) AND includes helpful auto-drawing when placing traces by hand.In short, we think DipTrace is an excellent bit of kit.
It's as simple to understand as ExpressPCB, making your own components and layout patterns is a doddle and it has all the fancy export options you'd expect to find (including dxf and gerber). Hobby users haven't been forgotten either - from the print preview screen you can mirror the output (for toner transfer/press-n-peel users) and it even has a "outline the traces for CNC output" option for anyone who wants to rout the traces out from copper clad board on a CNC routing machine.
It took us just a few hours of playing about tonight to not only create a library of our most commonly used components (amended to include big fat pads for easy soldering) but also to draw an intermediate-level schematic and layout the PCB for it. In less than three hours we had a board printed and ready for etching. After three hours with Eagle we were still trying to work out how to move more than two components without screwing up the entire design!
Look out for future posts detailing how to use DipTrace.
We'll be using it a lot in future and hope to convert a lot of our earlier projects using it - starting with our current miniature guitar project.
With a free non-commercial licence (2-sided board, up to 500 pins) you'd have to be a pretty hardcore user to need to upgrade - by which time you shouldn't mind paying the relatively modest licence fee for the full package!
Sunday, June 19, 2011
Calibrating the XAML to Drill application
We've added a calibration PDF to the xaml2drill files posted earlier. We used this to work out what our "scaling" value should be, when converting xaml into g-code.
It turns out it's pretty simple (and obvious) but here's what we did anyway:
In ExpressPCB we placed a number of pads in a small square

Print top copper layer to a PDF and open in Inkscape, then save as .xaml
Load the .xaml into our VB app and set the scaling to one
(so we can see the exact output from the .xaml before it is modified)
The resulting g-code:
G0 Z0
G0 X0 Y0
G0 Z2
G0 Z0
G0 X0 Y60
G0 Z2
G0 Z0
G0 X0 Y120
G0 Z2
G0 Z0
G0 X0 Y180
G0 Z2
G0 Z0
G0 X180 Y180
G0 Z2
G0 Z0
G0 X120 Y120
G0 Z2
G0 Z0
G0 X60 Y60
G0 Z2
G0 Z0
G0 X60 Y0
G0 Z2
G0 Z0
Just by looking at these values, we can see that in our conversion, a value of 60 is the same as 2.54mm. Or, more simply, 0.1". This means that to convert our .xaml into g-code that uses inches as units, we need to set the scaling to 600 (60 divided by 600 = 0.1)
This suddenly seems quite obvious. If our images are drawn at 600dpi, it makes sense that we should set the scaling to 600 to get from screen pixels to inches!
From this simple test we concluded:
To convert the .xaml to g-code in inches, scaling = 600
Since 1 inch = 2.54mm, to convert inches to mm we should multiply by 2.54
So to convert .xaml to g-code in mm, scaling = (600/2.54) = 236.2204724409449
How accurate you want to be when scaling is a matter of how accurate your CNC machine cuts. As far as we're concerned, deviation of up to 0.3mm per hole is still quite tolerable, so we use scaling 236.22 for millimetres and 600 if we want the g-code in inches.
It turns out it's pretty simple (and obvious) but here's what we did anyway:
In ExpressPCB we placed a number of pads in a small square

Print top copper layer to a PDF and open in Inkscape, then save as .xaml
Load the .xaml into our VB app and set the scaling to one
(so we can see the exact output from the .xaml before it is modified)
The resulting g-code:
G0 Z0
G0 X0 Y0
G0 Z2
G0 Z0
G0 X0 Y60
G0 Z2
G0 Z0
G0 X0 Y120
G0 Z2
G0 Z0
G0 X0 Y180
G0 Z2
G0 Z0
G0 X180 Y180
G0 Z2
G0 Z0
G0 X120 Y120
G0 Z2
G0 Z0
G0 X60 Y60
G0 Z2
G0 Z0
G0 X60 Y0
G0 Z2
G0 Z0
Just by looking at these values, we can see that in our conversion, a value of 60 is the same as 2.54mm. Or, more simply, 0.1". This means that to convert our .xaml into g-code that uses inches as units, we need to set the scaling to 600 (60 divided by 600 = 0.1)
This suddenly seems quite obvious. If our images are drawn at 600dpi, it makes sense that we should set the scaling to 600 to get from screen pixels to inches!
From this simple test we concluded:
To convert the .xaml to g-code in inches, scaling = 600
Since 1 inch = 2.54mm, to convert inches to mm we should multiply by 2.54
So to convert .xaml to g-code in mm, scaling = (600/2.54) = 236.2204724409449
How accurate you want to be when scaling is a matter of how accurate your CNC machine cuts. As far as we're concerned, deviation of up to 0.3mm per hole is still quite tolerable, so we use scaling 236.22 for millimetres and 600 if we want the g-code in inches.
Why use ExpressPCB?
If you're an Eagle aficionado, you'll probably find ExpressPCB a little simple for what you need - but that's exactly why we love it; there are no complicated rules and sub-menus to wade through: simply fire up the software and start drawing!
ExpressPCB is brilliant for making PCB layouts ready for home-etching (with the toner-transfer method). Some Eagle users still have problems with mirrored layouts and transferred images coming out the wrong way - we've never yet had such a problem with ExpressPCB!
Simply draw all your PCB layout components and traces on the top (red) layer. Draw them as you would expect to see them on the final board - as if you were looking down on the assembled PCB. Don't worry about pin alignment, mirroring and all that other stuff that seems to blight Eagle users so often. So long as pin1 on any microchip is in the top left-hand corner, and your drawing is in red, there should be no problems!
For home etching, we like to use big fat 0.5mm traces. Although we use a laminator for our projects, which does allow smaller/thinner traces to be used (we've successfully gone down to 0.2mm before now) we appreciate that not everyone has access to such hardware, and may be using more crude methods of transferring toner to copper (e.g. a household iron). Because of this, we found 0.5mm traces give the best results for anyone wanting to follow our board layout designs.

Because we do a lot of hand-drilling and sometimes even use a Dremel with bendy-attachment, we need quite chunky pads too (to allow a little bit of leeway if the drill is not perfectly centred). We've found that a 2.03mm pad with 0.89mm hole is ideal for us (and most other people) when using a standard 1mm drill bit

One last thing - ExpressPCB doesn't have an auto-route option.
Some people find this a problem - we've never bothered with it anyway (when we used autoroute in Eagle, we found we had to amend the final layout that it generated to make best use of the board space, so figured we'd be as well doing the board layout by hand). For home etching, we try to cram all our components together as tightly as possible - some people like to space things out: it's all about personal preference!
Here are a few common tricks you can use to help with board layout;

If you need to connect two sets of pads, keeping the numbering the same, but without regard for orientation (which way up the pads go) you can use simple "C-shaped" traces - each trace passes around the outside of the previous one. The pad numbering keeps the original order, but the final set of pads are "upside-down".
If you need to keep all pads in the correct sequence AND the right-way-up, use "S-shaped" traces. This connects, for example, the right-hand side of one pad to the left-hand side of another, but ensures that the resulting pads are laid out in exactly the same way as the originals.
Before printing your PCB layout, create a filled plane to fill in the gaps between traces. If you just print out your copper traces, your Ferric Chloride will have a lot of work to do, removing all the material between traces. This means etching takes ages and also saturates the FeCl much more quickly than is necessary (once Ferric Chloride has etched a lot of copper away, it becomes weaker and weaker, taking more time to etch each subsequent board)
Note anything on the silkscreen/yellow layer will not get printed in the final design - so overlapping things on different layers is quite acceptable
Select the filled plane tool and draw a rectangle over the entire PCB layout.
Right-click to stop drawing the plane and your board should appear something like the image above.
Change the board properties (menu Layout -> Board properties) and set the clearance around holes to 0.5mm to match the size of your traces.

The final printed design will have nice clear traces and big fat chunky pads which are easier to solder onto. Even if you're using a household iron to transfer the toner from the press-n-peel onto the copper board, the relatively thick traces and spacing between them should allow you to get away with a little movement during ironing (always a problem, and can cause smudged and broken traces when thinner lines are used).
When you transfer the image onto the copper board, it will, naturally be reversed. For example, pin1 on all your microchips is suddenly on the top-right hand corner, not the top-left. Don't panic - this isn't a mistake! That's exactly what you want, because the PCB image is on the bottom of your board. If you turn it over and place the components on the top (non-copper) side of the board, you should find that all the pads line up with the components perfectly (pin1 on the top side of the board is on the top-left, but turn the board over and it magically appears on the top-right side of a set of pins - because you're looking at the bottom of the chip, not the top).
Why use ExpressPCB?
It's free.
It's easy.
You can create drill files from it!
ExpressPCB is brilliant for making PCB layouts ready for home-etching (with the toner-transfer method). Some Eagle users still have problems with mirrored layouts and transferred images coming out the wrong way - we've never yet had such a problem with ExpressPCB!
Simply draw all your PCB layout components and traces on the top (red) layer. Draw them as you would expect to see them on the final board - as if you were looking down on the assembled PCB. Don't worry about pin alignment, mirroring and all that other stuff that seems to blight Eagle users so often. So long as pin1 on any microchip is in the top left-hand corner, and your drawing is in red, there should be no problems!
For home etching, we like to use big fat 0.5mm traces. Although we use a laminator for our projects, which does allow smaller/thinner traces to be used (we've successfully gone down to 0.2mm before now) we appreciate that not everyone has access to such hardware, and may be using more crude methods of transferring toner to copper (e.g. a household iron). Because of this, we found 0.5mm traces give the best results for anyone wanting to follow our board layout designs.

Because we do a lot of hand-drilling and sometimes even use a Dremel with bendy-attachment, we need quite chunky pads too (to allow a little bit of leeway if the drill is not perfectly centred). We've found that a 2.03mm pad with 0.89mm hole is ideal for us (and most other people) when using a standard 1mm drill bit

One last thing - ExpressPCB doesn't have an auto-route option.
Some people find this a problem - we've never bothered with it anyway (when we used autoroute in Eagle, we found we had to amend the final layout that it generated to make best use of the board space, so figured we'd be as well doing the board layout by hand). For home etching, we try to cram all our components together as tightly as possible - some people like to space things out: it's all about personal preference!
Here are a few common tricks you can use to help with board layout;

If you need to connect two sets of pads, keeping the numbering the same, but without regard for orientation (which way up the pads go) you can use simple "C-shaped" traces - each trace passes around the outside of the previous one. The pad numbering keeps the original order, but the final set of pads are "upside-down".
If you need to keep all pads in the correct sequence AND the right-way-up, use "S-shaped" traces. This connects, for example, the right-hand side of one pad to the left-hand side of another, but ensures that the resulting pads are laid out in exactly the same way as the originals.
Before printing your PCB layout, create a filled plane to fill in the gaps between traces. If you just print out your copper traces, your Ferric Chloride will have a lot of work to do, removing all the material between traces. This means etching takes ages and also saturates the FeCl much more quickly than is necessary (once Ferric Chloride has etched a lot of copper away, it becomes weaker and weaker, taking more time to etch each subsequent board)
Note anything on the silkscreen/yellow layer will not get printed in the final design - so overlapping things on different layers is quite acceptableSelect the filled plane tool and draw a rectangle over the entire PCB layout.
Right-click to stop drawing the plane and your board should appear something like the image above.
Change the board properties (menu Layout -> Board properties) and set the clearance around holes to 0.5mm to match the size of your traces.

The final printed design will have nice clear traces and big fat chunky pads which are easier to solder onto. Even if you're using a household iron to transfer the toner from the press-n-peel onto the copper board, the relatively thick traces and spacing between them should allow you to get away with a little movement during ironing (always a problem, and can cause smudged and broken traces when thinner lines are used).
When you transfer the image onto the copper board, it will, naturally be reversed. For example, pin1 on all your microchips is suddenly on the top-right hand corner, not the top-left. Don't panic - this isn't a mistake! That's exactly what you want, because the PCB image is on the bottom of your board. If you turn it over and place the components on the top (non-copper) side of the board, you should find that all the pads line up with the components perfectly (pin1 on the top side of the board is on the top-left, but turn the board over and it magically appears on the top-right side of a set of pins - because you're looking at the bottom of the chip, not the top).
Why use ExpressPCB?
It's free.
It's easy.
You can create drill files from it!
Creating drill files from ExpressPCB
Here's a simple VB app that will parse an xaml file generated from an ExpressPCB PDF and plot the points for drilling in a separate file, and a g-code.
That's sound like more than it is, so let's look at what's involved:
Firstly, create your schematic and PCB layout in ExpressPCB. When placing pads, use pads with 2.03mm size and 0.89mm hole:

Print the top copper layer to a PDF file using CutePDF

Open the PDF file in Inkscape and save as .xaml
The .xaml file should open with later versions of Internet Explorer (amongst others) so you can check the conversion worked properly. Open the file in Notepad to see all the complex XML shape descriptions.

Now start up the VB app and provide it with the path to the .xaml file

There are a few parameters to mess about with here. The main one is the code that describes a circle. If you've used 2.03mm pads with 0.89mm holes, this should be c -7 0 -12 -5 -12 -11 0 -7 5 -12 12 -12 6 0 11 5 11 12 0 6 -5 11 -11 11. You should see this set of commands repeated throughout the .xaml file, each time preceeded by [mX Y] type commands. If you've used different pad sizes, look for something similar - a repeating set of draw commands at different positions, with a fill colour of #FFFFFFFF (the [mX Y] commands are movement commands, the fill colour is white: basically we're looking for the repeating white circles that make up the centre of all the pads).
At the minute, we're not sure what units the .xaml file uses compared to our CNC machine - it will take a bit of messing about to get this right, so there's a scale multiplier parameter. As the app finds all the drill holes, it applies this multiplier, to convert from screen units/co-ordinates to whatever units the CNC machine uses. The final parameters to set at the Z-axis movement axis. The app will create some G-Code which can be loaded straight into the CNC controller software (we use Mach3 but may change once the demo version runs out!). Depending on whether the machine is set up to use inches, mm, or some other unit, this value may need to be changed - it defines the start (retracted) and end (plunged) position of the Dremel for drilling.
Pressing the "create files" button generates two files - one an amended .xaml file, so you can see a preview of the drill pattern generated. Load this into Internet Explorer (or some other software that lets you view .xaml) so see the final output.
The original and amended .xaml files showing drill hole positioning
The VB app also creates a CNC-ready G-Code file with the points plotted, complete with "move-to" commands and "extend/retract drill head" commands.

Load the G-Code into the CNC controlling software and let it go!
Download the VB app here
That's sound like more than it is, so let's look at what's involved:
Firstly, create your schematic and PCB layout in ExpressPCB. When placing pads, use pads with 2.03mm size and 0.89mm hole:

Print the top copper layer to a PDF file using CutePDF

Open the PDF file in Inkscape and save as .xaml
The .xaml file should open with later versions of Internet Explorer (amongst others) so you can check the conversion worked properly. Open the file in Notepad to see all the complex XML shape descriptions.

Now start up the VB app and provide it with the path to the .xaml file

There are a few parameters to mess about with here. The main one is the code that describes a circle. If you've used 2.03mm pads with 0.89mm holes, this should be c -7 0 -12 -5 -12 -11 0 -7 5 -12 12 -12 6 0 11 5 11 12 0 6 -5 11 -11 11. You should see this set of commands repeated throughout the .xaml file, each time preceeded by [mX Y] type commands. If you've used different pad sizes, look for something similar - a repeating set of draw commands at different positions, with a fill colour of #FFFFFFFF (the [mX Y] commands are movement commands, the fill colour is white: basically we're looking for the repeating white circles that make up the centre of all the pads).
At the minute, we're not sure what units the .xaml file uses compared to our CNC machine - it will take a bit of messing about to get this right, so there's a scale multiplier parameter. As the app finds all the drill holes, it applies this multiplier, to convert from screen units/co-ordinates to whatever units the CNC machine uses. The final parameters to set at the Z-axis movement axis. The app will create some G-Code which can be loaded straight into the CNC controller software (we use Mach3 but may change once the demo version runs out!). Depending on whether the machine is set up to use inches, mm, or some other unit, this value may need to be changed - it defines the start (retracted) and end (plunged) position of the Dremel for drilling.
Pressing the "create files" button generates two files - one an amended .xaml file, so you can see a preview of the drill pattern generated. Load this into Internet Explorer (or some other software that lets you view .xaml) so see the final output.
The original and amended .xaml files showing drill hole positioningThe VB app also creates a CNC-ready G-Code file with the points plotted, complete with "move-to" commands and "extend/retract drill head" commands.

Load the G-Code into the CNC controlling software and let it go!
Download the VB app here
Friday, June 17, 2011
Building a drilling milling machine
With the arrival of our CNC machine, all kinds of ideas starting springing to mind. But the idea behind getting a machine like this was to help speed up the production of PCBs - to easily create kits of components for workshops, like those run by BuildBrighton, or even to produce products for an online shop or to sell on eBay.
So that's where we're starting - to get the CNC machine to drill a series of holes that match up with a PCB circuit/design.
Following Tom's excellent research into g-code files, we're pretty confident that we can get the CNC to move to specific points above a sheet of copper-clad board, and activate the z-axis (up-and-down axis) to get it to thrust a Dremmel drill into the board. The most challenging part is to create the g-code to begin with!
So far, we've resisted all attempts to learn Eagle for designing and producing PCBs. But it looked like this was on the cards, since it already includes export options for drilling and milling PCBs. The only trouble with Eagle is, well, it's just not very nice. The software we use for schematic design and PCB layout is the excellent (and free) ExpressPCB.

It's just easier and all round nicer to work with - no confusing menus, sub-menus, things hidden inside other windows and so on. It has a really neat library of existing components, and if you can't find what you're looking for, creating your own is a doddle. Because we do a lot of home-etching, you can make big fat pads and traces really easily, and the final boards produced are easy to solder and work with. Eagle, on the other hand, was just confusing and produced boards with nasty lozenge-shaped pads and thin traces that were easily broken during etching.
The problem with ExpressPCB is that although the software is free, it's provided by a fab-shop who want you to send your designs to them for manufacture. As a result, there are no export options supported.
To date, we've always printed a PCB layout either straight to the printer (where the press-n-peel is already loaded and ready to do) or - using CutePDF - to a PDF file for editing.
Inkscape is a great program for editing graphics-heavy PDF files. So naturally we loaded our PCB into Inkscape and choose the "ungroup" command to break the board up into lots of lines and circles.
Then we selected the (black) centre circles found at the centre of each pad and copied them all to the clipboard. By creating a new image and pasting the copied shapes into the top-left hand corner, suddenly we had the basis for our drill file:

From within Inkscape we saved this new image as an .xaml file

This created an XML document, filled with plot and curve commands.
The curve/shape commands are of little consequence to us, but the plotting commands are just what we're after:
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg5395" Width="744" Height="1052"><Canvas.Resources/><Canvas Name="layer1"><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4253" Fill="#FF000000" Data="m 44.142826 61.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4255" Fill="#FF000000" Data="m 44.142826 70.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4257" Fill="#FF000000" Data="m 44.142826 79.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4259" Fill="#FF000000" Data="m 44.142826 88.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/>
As you can see, every hole drawn in the .xaml file begins the Data tag with "m" followed by two digits. This is the "move" command. The digits that follow are the curve commands to draw a filled circle. We're not bothered about that - but what is of interest is the co-ordinates of the m command (i.e. where the hole is placed).
In fact, because every single hole on the board is drawn by the same filled circle shape, it should be possible to simplify this process in future. If we save the original PCB as .xaml (without first selecting all the hole points and copying them to a new image file) we should be able to pick out the drill holes, even from a complex PCB image.
As you can see from the .xaml example above, every hole has a move command, co-ordinates to place it, then exactly the same sequence of drawing commands - "c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"
So in theory we should be able to parse the original PCB image file, even with all the traces and filled plane backgrounds and everything else, and just look for any shapes that include "c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65" in the Data tag. Any shape with this data in it we can say is a black filled circle (a 1mm hole that needs drilling) so our parser can strip out the co-ordinates from the "m" command. All other shapes can be ignored.
Results of a test app will be posted here soon.
If all goes to plan, maybe we won't have to shell out on an Eagle licence that we didn't really want in the first place.....
So that's where we're starting - to get the CNC machine to drill a series of holes that match up with a PCB circuit/design.
Following Tom's excellent research into g-code files, we're pretty confident that we can get the CNC to move to specific points above a sheet of copper-clad board, and activate the z-axis (up-and-down axis) to get it to thrust a Dremmel drill into the board. The most challenging part is to create the g-code to begin with!
So far, we've resisted all attempts to learn Eagle for designing and producing PCBs. But it looked like this was on the cards, since it already includes export options for drilling and milling PCBs. The only trouble with Eagle is, well, it's just not very nice. The software we use for schematic design and PCB layout is the excellent (and free) ExpressPCB.

It's just easier and all round nicer to work with - no confusing menus, sub-menus, things hidden inside other windows and so on. It has a really neat library of existing components, and if you can't find what you're looking for, creating your own is a doddle. Because we do a lot of home-etching, you can make big fat pads and traces really easily, and the final boards produced are easy to solder and work with. Eagle, on the other hand, was just confusing and produced boards with nasty lozenge-shaped pads and thin traces that were easily broken during etching.
The problem with ExpressPCB is that although the software is free, it's provided by a fab-shop who want you to send your designs to them for manufacture. As a result, there are no export options supported.
To date, we've always printed a PCB layout either straight to the printer (where the press-n-peel is already loaded and ready to do) or - using CutePDF - to a PDF file for editing.
Inkscape is a great program for editing graphics-heavy PDF files. So naturally we loaded our PCB into Inkscape and choose the "ungroup" command to break the board up into lots of lines and circles.
Then we selected the (black) centre circles found at the centre of each pad and copied them all to the clipboard. By creating a new image and pasting the copied shapes into the top-left hand corner, suddenly we had the basis for our drill file:

From within Inkscape we saved this new image as an .xaml file

This created an XML document, filled with plot and curve commands.
The curve/shape commands are of little consequence to us, but the plotting commands are just what we're after:
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg5395" Width="744" Height="1052"><Canvas.Resources/><Canvas Name="layer1"><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4253" Fill="#FF000000" Data="m 44.142826 61.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4255" Fill="#FF000000" Data="m 44.142826 70.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4257" Fill="#FF000000" Data="m 44.142826 79.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4259" Fill="#FF000000" Data="m 44.142826 88.717113 c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"/>
As you can see, every hole drawn in the .xaml file begins the Data tag with "m" followed by two digits. This is the "move" command. The digits that follow are the curve commands to draw a filled circle. We're not bothered about that - but what is of interest is the co-ordinates of the m command (i.e. where the hole is placed).
In fact, because every single hole on the board is drawn by the same filled circle shape, it should be possible to simplify this process in future. If we save the original PCB as .xaml (without first selecting all the hole points and copying them to a new image file) we should be able to pick out the drill holes, even from a complex PCB image.
As you can see from the .xaml example above, every hole has a move command, co-ordinates to place it, then exactly the same sequence of drawing commands - "c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65"
So in theory we should be able to parse the original PCB image file, even with all the traces and filled plane backgrounds and everything else, and just look for any shapes that include "c 0 -1.05 -0.75 -1.8 -1.65 -1.8 -1.05 0 -1.8 0.75 -1.8 1.8 0 0.9 0.75 1.65 1.8 1.65 0.9 0 1.65 -0.75 1.65 -1.65" in the Data tag. Any shape with this data in it we can say is a black filled circle (a 1mm hole that needs drilling) so our parser can strip out the co-ordinates from the "m" command. All other shapes can be ignored.
Results of a test app will be posted here soon.
If all goes to plan, maybe we won't have to shell out on an Eagle licence that we didn't really want in the first place.....
Subscribe to:
Posts (Atom)




