CNC Software Toolchain for Linux

Hi! Some time ago I made a post about My Home Lab where I showed a small CNC that I built. In the same post I said that someday I would post some details on the software toolchain and that's exactly what I'm going to do in this post.

The process of using a CNC to make 3D parts follows three simple steps:
    1. Design the parts.
To design the parts I use HeeksCAD. HeeksCAD is a free, open source, CAD application written by Dan Heeks.

(Click the photo for better resolution in Picasa Photostream)

I found it some time ago and I think that there isn't any free, open source software that can be compared to it. It is really, really great and allows you to design the parts. You can:
  • Import solid models from STEP and IGES files;
  • Draw construction geometry and lines and arcs, create new primitive solids, or make solids by extruding a sketch or by making a lofted solid between sketches;
  • Modify solids using blending, or boolean operations.
  • Save IGES, STEP and STL.
  • Printer plot the 2D geometry or to HPGL.
  • Import and export dxf files;
  • Drawing lines, arcs, ellipses, splines and polylines is supported.
  • Constraint based designs are also supported!
Learning how to use it is really simple and intuitive. There are some video tutorials in youtube that will teach you how to use all the features of HeeksCAD. Check the video below to see it in action. A few more video tutorials are available on youtube.


Update (18/03/12): Recently I found out about FreeCAD which became my #1 choice in CAD software. It is very rich in features and the possibility of making constraints-oriented drawing makes it very easy and fast to work with. After drawing in FreeCAD you can export it as .dxf but to import it in HeeksCAD you first need to open the .dxf in QCad and then save it again with the same format. For some reason HeeksCAD cannot open the .dxf files exported by FreeCAD. You can also export the 3D models in a .step file and then directly import them in HeeksCAD. Quick, fast and works great!

(Click the photo for better resolution in Picasa Photostream)
The other two 3D CAD that I have ever used are Google Sketchup (free) and Alibre Design (commercial) but none of them can be used in linux. Google Sketchup was really easy to use, but missed some very useful features like the support for constraint based design. On the other hand, Alibre Design is a really good, professional, easy to use software but you have to buy it. However, I consider that HeeksCAD is a lot closer to Alibre Design than to Google Sketchup. There is also a 3d modelling software that can be used in linux, which is OpenSCAD. OpenSCAD is not an interactive modeller. Instead it is something like a 3D-compiler that reads in a script file that describes the object and renders the 3D model from this script file. It gives you full control over the modelling process and enables you to easily change any step in the modelling process or make designs that are defined by configurable parameters. However, since I was used to Alibre Design, FreeCAD became my #1 CAD (HeeksCAD being #2) software on linux. HeeksCAD also has a very good feature that, as far as I know, none of the other softwares that I referred has and will be described in the next step.
    2. Generate the G-Code from the designed parts.
To generate the G-Code from the designed parts I use the HeeksCAD plugin, HeeksCNC. HeeksCNC allows you to choose between several types of cutting operations such as pocketing or profile operations, among others. You can set the tolerances, the steps, the tools to be used, etc. The first image on this post shows the toolpaths in green. You can see another tutorial showing how to use the HeeksCNC plugin below:


Regarding the milling of PCBs I use the pcb2gcode application. You just have to place a "millproject" file inside the folder where you have the gerber files of your PCBs and run the application in the console. My "millproject" file contains the following data:
# this is an example config file for pcb2gcode.
# place this in the same directory as your gerber files to save typing# You may want to uncomment and change those in local project files
#front=mirror-Inferior.gbl
back=Sensibilizadora-Inferior.gbl
drill=Sensibilizadora.drl
#outline=contour.back.gbr
#verbose# parameters for isolation routing / engraving / etching
zwork=-0.008
zsafe=0.8
zchange=1.0
mill-feed=6
mill-speed=30000

# parameters for cutting out boards
cutter-diameter=0.059055118
zcut=-0.08
cut-feed=3
cut-speed=20000
cut-infeed=1

# drilling parameters

zdrill=-0.08
drill-feed=3
drill-speed=20000
#offset=0.006
# generate voronoi regions
offset=1.0
dpi=1000
#max-deviation=0
The first "millproject" file that I found and used as an example ever since was the one found in the RepRap Wiki. There's also some good info there. Check it out! :)

With pcb2gode you can generate a PCB with Voronoi regions. Voro.. what? I'll explain :) A PCB with Voronoi regions is a PCB where the isolation routing is optimized for the shortest path to be made by the CNC machine. Below you can see the difference between a normal PCB and a PCB with Voronoi regions:

(Click the photo for better resolution in Picasa Photostream)
(Click the photo for better resolution in Picasa Photostream)
    3. Send the G-Code commands to the machine.
To perform this final step I use the Linux EMC2. You can install it in your computer or you can run it as a live CD. I think it is a very good and simple to use software for controlling machines. Yes, I'm saying machines because you can can control various types of machines with it. It has a wizard makes it very easy to create a profile for your own custom CNC Machine where you can customize the connections and the speeds and frequencies of the signals to be applied to the motors. It also features two manual control modes: the jog mode, and the console mode. In the jog mode you can control the machine using your mouse or your keyboard. In the console mode you can send it G-Code commands.

(Click the photo for better resolution in Picasa Photostream)
And with these three steps I think you are ready to make anything with your CNC using only free, open source software ;) I hope you liked it and if you have any questions or suggestions of other software that I do not mention in this post, feel free to leave them in the comments section below! See you next time!



Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! :)

Donate

6 comments:

  1. This article is very informative. delighted you mutual it with s. Thanks!

    ReplyDelete
  2. Thanks for your comment! :) I hope to keep sharing useful stuff with everyone :)

    ReplyDelete
  3. This is the perfect webpage for everyone who wishes to understand this topic. You understand a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a fresh spin on a topic that has been written about for decades. Excellent stuff, just wonderful!

    ReplyDelete
  4. You're so interesting! I don't think I've truly read a single thing like that before. So wonderful to discover someone with genuine thoughts on this subject matter. Seriously.. thank you for starting this up. This web site is one thing that's needed on the internet, someone with a bit of originality!

    ReplyDelete
  5. Thanks a lot! :) I put it up because I had to research for some time in order to connect "all the pieces of the puzzle". I'm aware that there are other great softwares but most of them are paid. Since I'm a linux user I prefer to get everything done in linux and without spending a single cent :) Actually, I like arguing! :P I find it a very good way of learning about other softwares or other ways to do things :) Thanks for your comment! :) I'll definitely read some things on your websites because although I learned how to connect the pieces of the puzzle, I still have to learn more about using each piece o fthe puzzle. Surely I'll be able to learn a lot from your website, especially regarding CAD.Keep up with your great work on it and thanks again for your comment :)

    ReplyDelete
  6. Thanks a lot! :) I started it more as a way of organizing myself and documenting some projects. Shortly I began to realize that I could learn a lot from the comments of the readers and maybe give something back to the community :) I'm glad you liked it and found it interesting. I hope to keep posting articles with interesting subjects and projects :) Thanks for stopping by and for your comment! Getting feedback (either positive or negative) is always a great motivation :)

    ReplyDelete

top