Machsupport Forum

G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Danpelli on January 05, 2018, 06:44:07 AM

Title: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 05, 2018, 06:44:07 AM
Hello everyone, I have a problem with Mach3 that I can not solve.
I'm trying to make my machine change the speed of the spindle at a certain point in a straight line.
I will give an example for better understanding:
I have to make a straight line of 1000 mm and at 700 mm I need to vary the speed of the spindle from 800 to 400 rpm.
Since in the same line I can not place two different S's I have divided the line into two lines, leaving the code like this:
M3 s800
g01 x700
s400
g01 x1000
The problem is that when I split the line, the machine decelerates when it reaches the x700 and accelerates again to continue to the point x1000, creating a stop that I have to avoid.
I have also done a test without the S code to see if the movement was continuous but it has not worked either.
My look ahead is configured for 150 lines.
If someone could tell me what could be happening, I would appreciate it very much.
Thank you!!
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: TOTALLYRC on January 05, 2018, 06:48:10 PM
Try putting a G64  at the beginig of your code or selecting constant velocity on the general config page.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 06, 2018, 05:03:57 AM

Thanks for your answer, I forgot to comment but the constant velocity is activated and even then I have this problem.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: TOTALLYRC on January 06, 2018, 08:17:42 AM
Try the G64 at the beginning of the code. That is better than the check-box.
Once in a while Mach 3 doesn't honor the check-box/I program something weird.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 06, 2018, 09:08:22 AM

Hello, I tried it but it continues to decelerate and accelerate when it reaches the point x500. You can see how the feed rate speed decreases in the feed rate visor.
Can you have a check to the gcode ?

G71 G64 F10000

m3s500
x500
s50
x1000
s500
m5

Thanks!
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: TOTALLYRC on January 06, 2018, 12:59:25 PM
Of course it is possible that it won't work since you normally don't change the feed while in the middle of coordinated motion. Hopefully with somebody with more knowledge will chime in.


Mike
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 06, 2018, 05:29:18 PM
Thanks you Mike!!
This really is a problem for me because I need to move the machine in this way. Due to the type of activity I am doing, I need to find a way that is no deceleration in these points.

I hope someone knows how to do it!!

Dan
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: garyhlucas on January 07, 2018, 10:54:55 AM
Dan,
Is this a mill, router or custom machine you a controlling with Mach?
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Graham Waterworth on January 07, 2018, 03:07:58 PM
the only way I can think this may be possible is in the Macropump, run a check in the Macropump code to check the current position DRO and if its greater than 700 drop the speed, the down side to this is it would do it for every program that travelled over 700mm so you would have to edit it out once the job was complete.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 08, 2018, 06:46:02 AM
Dan,
Is this a mill, router or custom machine you a controlling with Mach?
Hi, It´s a custom machine.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 08, 2018, 06:59:52 AM
the only way I can think this may be possible is in the Macropump, run a check in the Macropump code to check the current position DRO and if its greater than 700 drop the speed, the down side to this is it would do it for every program that travelled over 700mm so you would have to edit it out once the job was complete.
Thanks for your answer,
I do not know how to do this in macropump, I will investigate on how to do it, if you could pass me some tutorials about how to proceed I would appreciate it.

My problem really is that I would need to decrease the velocity of spindle gradually as the speed of the machine goes down (feed rate). Maybe it's easier to set something up this way? Do you know if it is possible?

Thanks again!!

Dan
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: garyhlucas on January 08, 2018, 09:48:32 AM
Dan,
Lots of people try to use Mach for a custom machine because the thinking is that if it can control a CNC machine then it should be easy and cheap to use it here.  Nearly everyone winds up where you are, some little tweak you need but can't do. Figure in the cost of the PC and keeping it running and the cost is way higher than you realize. 

However there is a really good answer now for what you are trying to do.  You need to use an Automation Direct DoMore BRX plc.  You can get them with up to 8 high speed outputs to control stepper or servo at up to 250Kz step rate.  Lots of digital IO. Up to 4 channels analog inputs and 2 channels of analog output on the base module.  Expansion modules available of all kinds.  The BRX has a ton of motion commands and can do what you need easily.  Programming is via DoMore Designer ladder logic software which is FREE. Phone tech support is excellent and FREE. Has ethernet, serial, modbus communications and can do email and talk to anything.

I use them at work, and just installed one in my homebuilt CNC so that I can get control of my lathe spindle running on a large stepper motor, which Mach can't do, plus controlling the heat for the 3D printer extruder, and the heated build plate, and analog output to my DC mill spindle controller.
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: Danpelli on January 09, 2018, 06:33:53 AM
Hi Gary, thanks for your response.
To use a PLC is something I already thought might be necessary for my machine. But always thinking of a cnc control software with a built-in PLC, I never thought of doing it all by PLC. The fact is that I have researched a little about this system that you have recommended me and I do not find anything about how it would work as cnc, that is, the G code would no longer be used but then, you can't use softwares for create and editing the codes from a design. So how do you create the coordinates of movement? The whole process is manual? Is not this much more complicated?

Thanks!!
Dan
Title: Re: How to change the speed of spindle on the same line without stops.
Post by: garyhlucas on January 09, 2018, 09:48:08 AM
Dan,
You didn’t say much about what the machine does or how many axis etc. Years ago I built watering/spraying robots for commercial greenhouses. We tried to use a PC as HMI with a PLC controlling everything. We constantly had problems on the PC side and I finished the job in the PLC alone. Still running 20 years later!

I faced the same problem and created  a G-code. Short for Growbot which is what we called the machine. The PLC read two digit codes  and four digit data entered by the operator and then the PLC performed the appropriate task. The BRX has the advantage of an SD card that can be programmed off line and has huge capacity. Also using something called stage programming you can simply read a line for the G-code and jump to a stage that performs that task. Create only those codes you need and also the special ones no CNC program would have, like what you are trying to do.

You may only need a few G-codes because a CAM program like CamBam could create everything your machine needs from just some basic codes. G-code has been around for a long time and lots of the codes were useful when the machine had no memory and programming was done by hand. With  CAM many codes are no longer needed.

You might want to look at a C-More HMI. That would connect to the PLC and give you every pushbutton, selector, and slider needed. It also has a recipe function that can store a sequence of steps. A recipe could even be a file selection on the SD card containing the program to use. A C-more does data logging and trending to get data on what you produced. It also has web server and you can see and run your machine from a connected PC or using a $5 app from your cell phone!