3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

CNC G-Code Interpreter using Processing

CNC G-Code Interpreter using Processing
Hi guys, for years I'm trying to make my own CNC router so I can make PCB easier.

What I'm trying to make is a G code interpreter who can sends signals to an arduino board. So the arduino board can control a simple CNC router to draw a circuit over a PCB.

I hope this project inspirer some peoples to support, improve, and make this things gonna real.

Any suggestions, comments, bug, improvement, please send to me.


 
Remove these adsRemove these ads by Signing Up
 

Step 1The Processing code.

The code is real simple. I generate an G file in Eagle Layout editor. Read this file in processing. And I move, or Draw, the lines.

On the next step I will shoe how to generate the G file, and use my code to draw the PCB on screen.

The file named as 12.txt is a G file to use as example.

The file named as "motor shield" is a example already routed on the eagle. You just need to generate the G-file.

The file named as "teste" is simple example already routed on the eagle. You just need to generate the G-file too.
« Previous StepDownload PDFView All StepsNext Step »
20 comments
Mar 17, 2012. 1:53 PMBANAELECTRONICO says:
Hello!! greatproyect!!, i´m tryimg to download the cnc.pde file but it only downloads a temp file, can anybody helpme? my email is aliasthesmileyboybana@hotmail.com i´m tryin to do a 3d printer and router :)
Mar 18, 2012. 10:10 AMBANAELECTRONICO says:
Hello Hello i make some variatios to the Code, and now ir works well, i got some trobles with the original one, there is my version, thank you Octaviusp :)


void setup()
{
size(1000,1000);
background(0);


}
int ESCALA = 2;
int offsetx=0,offsety=0;

void draw()
{
String lines[] = loadStrings("12.txt");
for(int i=3;i String[] strx = split(lines[i], 'X');
int[] x=int (split(strx[1],'Y'));
strx = split(strx[1],'Y');
int[] y=int (split(strx[1],'D'));
strx = split(strx[1],'D');
int[] d= int (split(strx[1],'*'));
println(x[0]);
println(y[0]);
println(d[0]);
if(d[0]==2) move((x[0]/100*ESCALA),(y[0]/100*ESCALA));
if(d[0]==1) anda(x[0]/100*ESCALA,y[0]/100*ESCALA);

}
}

void move(int x1,int y1){
println("move");
strokeWeight(5);
stroke(255);
point(x1,y1,0);
offsetx=x1;
offsety=y1;
println(x1);
println(y1);
println("fin move");
}

void anda(int x,int y){
int countx=offsetx,county=offsety;

smooth();
strokeWeight(2.0);
strokeCap(ROUND);
line(countx,county,x,y);
offsetx=x;
offsety=y;
}
Oct 3, 2011. 11:11 AMhondaman900 says:
Can you post your Processing code? The .PDE file is an Arduino sketch, and not the Processing code. Thanks, or please e-mail to hondaman900@gmail.com.
Oct 3, 2011. 2:59 PMhondaman900 says:
But the cnc.pde uses non-Processing Arduino statements, and wants to include Stepper.h, which is an Arduino include. Also, #include is an Arduino-only statement. Processing uses "import". So I'm pretty sure it's not a Processing sketch and would love to see the Processing code.

Also, did you make further progress with this project since you built the Instructable?

Thanks in advance
Mar 24, 2011. 4:17 PMArduino Guy says:
I am currently building a CNC machine and this is really helpful, but when will the arduino sketch be done? and has anyone done something similar? Thanks.
Nov 17, 2010. 8:34 AMoshondrom says:
can you send me those files at oshondrom@gmail.com
i love your project!
Oct 29, 2010. 7:12 PMivansg says:
Cool project!
Bom ver que é do brasil!
Quando terminar minha CNC, irei testar...
Abraço
Jul 14, 2010. 3:45 AMGrumpy Mike says:
The CNC.pde code is no such thing it is just the standard Arduino example of follow a pot with a stepping motor code.
Mar 28, 2010. 8:33 PMmarcos1971 says:
Ola parabéns pelo teu trabalho, mas download dos arquivos não funciona, se puderes por favor enviar para meu email. marcossilvabrasil@hotmail.com

abraço e obrigado
Nov 29, 2009. 8:46 AMBadWolf Corp says:
file download ain't working
can you send me those files at
jordan2_delta@hotmail.com please
thanks
Sep 17, 2009. 1:17 PMjeff-o says:
So, is the goal to draw the circuit using an etch-resist pen on the board, or to run a mill that carves out everything BUT the traces? Just wondering. Someday I'll have a CNC machine of my own, too...
Sep 17, 2009. 2:12 PMjeff-o says:
Ah, ok. I'd definitely push for the cnc mill solution in that case...
Sep 17, 2009. 10:54 AMsammyBoy says:
I've also been toying with CNC for a while and I was thinking of using my *duino as a control board. I'm going to have a play with your code over the week-end. Looks good, nice instructable.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
31
Followers
5
Author:otaviousp