Renewable Energy Innovation

  • Increase font size
  • Default font size
  • Decrease font size

No image

Contiuing from this post about using my CNC machine to create PCBs, here is an update on the tool chain from designing circuit board to milling them on my CNC machine. This process is still not perfect, but this is just to remind me of the settings and hopefully it might be useful to other people.

The tool chain I use tries to include free and open source programs (but I rate 'ease of use' above 'open-source-ness').

The tool chain at present is:

      1. KiCAD - To design the circuit schematics and circuit boards
      2. LineGrinder - To generate the g-code from gerber files
      3. LinuxCNC (previously called EMC2)- To control the CNC machine based upon the G-code.

I have written a post on the CNC machine at re-innovation. It is a relatively small machine with a bed of 300mm x 200mm and a depth of 70mm. I have been using it to cut acrylic parts, drill holes for etched circuit boards and cut holes into boxes for some prototypes.

I have been messing around with LineGrinder which is a free and open program, but only available for Windows. I am using it on a Windows 7 machine.

No image

A useful on-line tool, the G-Code commenter can be found here. This takes G-Code and adds human-readable comments next to each line. This turned out to be very useful for decoding the output of LineGrinder. G-code is relatively human-readable, but I have not memorised all the G-code commands yet.

Here are my notes on getting the correct outputs from KiCAD and the settings within LineGrinder to mill PCBs.

No image

This is the PCB in KiCAD I was trying to mill. I set an Auxillary axis (0,0) point to the top left corner of this board (the same set-up as my CNC 0,0 point).

No image

Go to File -> Plot and you will get this list of options. I wanted the front and back copper and the PCB_edges to be produced. Check those boxes and click 'Plot'. I also need a drill file.

No image

Click on 'Generate Drill File'. I used: 'millimeters', 'keep zeros', 'Auxillary Axis' and 'Mirror y axis' and then clicked 'OK'.

No image

Open up LineGrinder and try and open the .drl file you have just created in KiCAD.

No image

I got this error message which says that the .drl file is in mm, but the settings are in inches.

No image

So click on the 'Settings' tab and change Application data to 'Millimeters'. Click on the .drl option on the left had side and you will get the various properties shown here. In these properties you can set the drill depth, drill feed rate, drill moving height and other options.

No image

Click 'Generate G-code' and hopefully it will compile correctly. Go back to the 'Plot View' tab and click on 'Drill G-code'. Mine looked like this, which is good. Save the drill g-code.

No image

You can view the generated g-code which is a good idea to check. When I first looked at this I had made some errors and needed to adjust the values explained above.

No image

The next thing to do is open the gerber file for the copper. I was making a single sided PCB and just wanted the back copper. This would be milled from the top, so I needed to reverse the file. Open your .gbl file for the back copper (the file from KiCAD is not automatically recognised, but does open correctly as a gerber file).

No image

Again there are options associated with this type of file. I chose an isolation cut, but I needed to change back to inches. I could not find a way of exporting from KiCAD in mm. Things to note include the 'Y Flip' (as I was producing a file for the bottom copper, but cutting it from the top, if you see what I mean) and the ZCutLevel which was -0.002 inches. I might need to adjust that.

No image

I created the G-code and then viewed i using the viewer. It looked as above. The text on the board is the correct way around, which means it is correct. This screen shot was done when I had a ground plane, hence it is quite complex. It was too complex for my CNC and so I needed to remove the copper fill from the KiCAD board. This made everything run much more smoothly and reliably.

Also check this with the drill output file - are holes where you think they should be?

No image

The last features were the board edge milling and board levelling. This is a great feature, but I could not get it to flip on the Y axis, so could not use this feature. Line Grinder can read in the board edges and create the board edge mill path (along with tabs to hold the board) and also perform a board levelling pass which flattens a piece of sacrificial substrate to the correct depth and exactly flat so the isolation cut will work correctly.

No image

This is the board edge mill path (along with tabs). I cannot find a way to flip this on the Y axis, hence I could not use this for my board. It would work if I were to drill and cut on one side and then flip over. I will try this another day....

No image

This is the board levelling output - it creates a box around the board edge and levels an area bigger than the board. This is good, but I alredy have a levelled board to use so I did not need it for this test.

Now we use these g-code files for LinuxCNC, which controls my CNC machine.

Problems....

There were some issues with opening the g-code with LinuxCNC - mainly due to an error from the G02 and G03 commands, which draw an arc. I solved this error by removing the copper fill (this would not be needed, as this will happen automatically with isolation routing). The issue had been the tiny cuts around the holes connected to the copper fill plane (this was connected to ground in my case).

The next issue was due to the drill file and isolation file not fitting on top of each other. I had created the drill file using 'Mirror Y axis' option in KiCAD. The isolation path is created using the 'Flip Y' function. This meant that the drill file had positive X and Y values, while the isolation path g-code had positive X values, but negative Y values. They would match up but only with adjustment of the origin. This was a hassle. You cannot flip the drill file using LineGrinder (maybe a feature for next time?).

I have come up with a workaround, which gets me where I need to be, but is not very automated and is a bit of a hassle.

The isolation path generated also creates some code to do small 'pecks' at the points where the drill holes are meant to be. This is to aid hand-drilling of the PCB. I decided to go into the G-Code and adjust these points to make them the actual drill holes. To do this I needed to find that section of code (which is luckily called 'Pad Touchdown'):

No image

Where the line (... pad touchdown start ...) is, I added a move in the Z axis (G01 Z1.000) (This was in inches), so I have room to change the bit from the isolation cutter to the drill bit. I then a generic 'change tools' command (T01). This will cause the code to stop and ask for the new tool bit.

No image

The second time I ran this code, it did not ask for the tool to be changed (and ruined an isolation bit as it plunged into the substrate!). The reason is that once the machine thinks it has the correct tool, it will not ask again. So I needed to change the tool to a different tool right at the beginning so that it will always ask to change tools. This meant adding code as shown here:

No image

I was now ready to try this all out...

No image

The CNC machine has a milled flat bed. This ensures a level substrate so we get even isolation paths.

No image

I used some scrap single sided copper clad board.

No image

This was stuck to the milled flat bed using double sided carpet tape. This worked OK, but the copper clad board had a slight warp and the tape was not strong enough to hold it totally flat. I should have kept the copper clad board with a weight on it to keep it flat. It did not make a huge difference on this relatively simple circuit board.

No image

Above is a 45 degree isolation routing bit. This has a very sharp tip to cut away the copper.

No image

This is the PCB after both isolation routing and drilling. An attempt where the drill did not hit the isolation path can be seen on another bit of the copper clad board.

No image

This is the final board after I had cut it out.

No image

The prototype board with components.

No image

The underside of the PCB. It was a 2 sided design, hence there are some jumper wires on this board. I had actually made no mistakes with the circuit design of this board, which is unusual for me.a

No image

The board was a 'shield' for an Arduino clone, to run and RGB  LED unit. Here it is plugged in and working.

Things to improve:

  • Strength of sticking down substrate (the copper board still had a warp, which meant uneven isolation traces).
  • How to produce drill files correctly or include different sized drill holes.

Links:

I'll put up relevant links here:


Shop - Buy it here!

USB reprogramming lead
Lots of the kits sold here require a programming cable to program the ATMEGA328 micrcontroller. These kits use a bare microcontroller and do not... Read More...
6 Digit LED Display
This is an all-in-one six digit 7-segment led display unit with an ATmega328 programmed with the Arduino bootloader. The displays can be used to... Read More...
Serial LCD Display
This LCD display unit displays any data sent to it via a serial connection. It is based upon the ATmega328 and the Arduino Uno bootloader. This unit... Read More...
Thermocouple Amplifier
This is a K-type thermocouple amplifier which can be used to amplify the tiny voltage from a thermocouple to a higher voltage, readable by a... Read More...
Bat Detector
Welcome to fascinating world of bats! This bat detector device converts ultrasonic sounds created by bats and convert them down to a lower frequency... Read More...

If any of the information on this site has been useful, please consider buying us a cup of coffee...

Amount: 

Sign up to our newsletter

I sell on Tindie

Login

Login
Register




Twitter Feed

re_innov @ed_davies maybe try this: http://t.co/DacHChqdxq for signing up?
re_innov Just back from running off-grid PV workshops @SmallisFestival. Interesting, thought-provoking and fun as always.
re_innov Interested in off-grid? Check out a friends 1 day course in London: http://t.co/IKqFRtQIP7. Sat Oct 25th
re_innov RT @1d6Workshops: @fowkc @re_innov @mousefad, seems the Guardian have the logical next step for your projects: connect them together! http:…
re_innov RT @SmallisFestival: Get weekend or day tickets NOW for @SmallisFestival 13/14 Sept at beautiful @stgeorgesbris! International music, talks…