Hello Guest it is July 19, 2019, 05:25:37 PM

Author Topic: Program a stepper motor for a sinusoidal movement  (Read 1982 times)

0 Members and 1 Guest are viewing this topic.

Program a stepper motor for a sinusoidal movement
« on: March 27, 2012, 07:48:30 AM »
Hi everybody,

I am a newbie about Mach 3.
I would like to move a stepper motor forward and backward in order to oscillate a plane with a kind of sinusoidal motion.
The idea is to do it trough a program, in automatic but I don't know how.
Is it necessary to write a G code program? If yes, can someone tell me where to find instructions about the G code?

Thanks in advance for your help.
 :)
matomato

Offline Hood

*
  •  25,849 25,849
  • Carnoustie, Scotland
    • View Profile
Re: Program a stepper motor for a sinusoidal movement
« Reply #1 on: March 27, 2012, 09:16:51 AM »
You will either have to write the G Code or use CAM to write it for you.
Have a look in the Mach manual it may help a bit with G Code, also click on the G Code button on the mach screen and it will  tell you about the supported G Codes Lastly you can look at LazyCAM which comes with Mach,  i think there is a manual in the members docs section for LazyCAM.
Hood
Re: Program a stepper motor for a sinusoidal movement
« Reply #2 on: March 27, 2012, 09:27:50 AM »
Probably the simplest way to do it is to program a two-axis circular move, with one axis being a "dummy" that isn't really driving anything.  The remaining axis will them move sinusoidally (after it gets accelerated up to speed).  The basic command is either G2 or G3.  Assuming Y is the "dummy" axis, and you want a 2" diameter motion at 10 IPM about x3.000 y5.000:

F10.0 (Set feedrate to use)
G0 X4.000 Y5.000 (Move to start point on circle 4.000,5.000)
M98 P001 L10 (Call subroutine 001 to do one circle, L10 calls subroutine 10 times)
M30 (Program End)

O001 (Subroutine ID)
G2 X3.000 Y5.000 I-1.000 J0.000  (Do one complete circle in XY plane, with center at X3.000, Y5.000)
M99 (Return)
M30

Regards,
Ray L.
Regards,
Ray L.

Offline BR549

*
  •  6,874 6,874
    • View Profile
Re: Program a stepper motor for a sinusoidal movement
« Reply #3 on: March 27, 2012, 11:27:43 AM »
TRY this: NOW it will display the entire string BUT when you run it it only displays a single loop BUT the machine willl move thru the entire string. IT is a display thing with mach3.

G0 X0Y0
F100
M98 P1 L10
M30
o001
G2 X3 Y0 R1.5
G3 X6 Y0 R1.5
G92 X0
M99
%