Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Diagonal motion by stepper motor in cnc machine

Status
Not open for further replies.

maham ahmed

Newbie level 4
Joined
Dec 16, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
44
hi every1! i am designing 2d cnc machine....we have to do linear motion for which we are using G01 and G00 code
like G00 x07y04

like in above example our both motors (x and y)will move simultaneously and the tool will move in diagonal line ..... the speed of both motors will decide the angle of diagonal line like in above example the speed motor x will be greater as compare to motor y(as the angle of diagonal line would be less than 45 degree).

but the problem is if we are using G01 command so it consist the feedrate for eg G01 x07y04F200 ...and our spindle speed should be according to this feedrate ...and our spindle speed depends on the speed of both x and y motors...so how could we change the speed of our both motors..because if we set the speed of our motors according to this feedrate then the angle of diagonal line will be changed and then we wont be able to achieve the target coordinate.

another thing is we have only 1 feedrate value means our bith x and y motors will have same speed corresponding to that feedrate so in that case the angle of diagonal line will always be 45 degree and we wont be able to achieve the target coordinate.

kindly help us ...how could we sort out this problem????how could we relate that feedrate with the speed of x and y motors??? and how can we achieve 2 different speed of both motors by the same feedrate??
 

The feed rate is the rate at which the cutting head should move relative to the work, you need to work back from that to the required speed of the two motors (It takes a little bit of nearly trivial trig).

Consider a movement of say 3 cm in X by 4 cm in Y (Chosen to make the trig easy) at a feed rate of 100cm/min.
The total distance to be moved is sqrt (3^2 + 4^2) = 5cm, and if the feed rate is 100cm/min then the movement should take 5/100 * 60 = 3 seconds (Ignoring things like acceleration ramps on either end), thus the X axis needs to move 3cm in 3 seconds (A rate of 1cm/s) and the Y axis needs to move 4cm in 3 seconds, a rate of 1.333 cm/s).

It is possibly better to define the X & Y motions parametrically against some variable (call it K which ramps between two fixed limits (say 0 -> 1), then by making K have acceleration and such you can get smooth tool moves.
Make K ramp at a rate dependent on the specified feed rate (And on the trig).

Code:
dx = 3, dy = 4 // Length of moves

len = sqrt (dx * dx + dy * dy) // total move length
dx = dx * feedrate / len 
dy = dy * feedrate / len
dx,dy are now your motor speeds, in the simple minded version, doing something more sane is left as an excersize for the student, but it is simple 2D geometry, 3D tool paths can get hairy to calculate.

Regards, Dan.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top