Author
Topic: Lathe speed control (Read 5401 times)

I have a viceroy lathe that I have converted for Mach and it works very well but spindle speed is still manual.

The speed control is by a variable speed pully that is driven by a motor with an up and down button that changes the ivariable pully drive.

The question is if I put 2 relays driven by 2 output port bits across the up/down button is there a way to get mach to adjust the speedto the speed given in the S command and monitor the spindle feed back to make it match the required speed ?

The first thing that you need is a spindle sensor so that Mach knows what is going on. Maybe you have one already? If you can get a readout of speed then maybe a bit of code could be written to do what you want, but I'm not sure how easy that would be.One way to do it would be using the brains system in Mach. It would be possible to compare the requested speed with the actual speed and turn on an output accordingly.There is also a hardware solution, with Mach using the normal PWM or pulse output to produce a voltage proportional to the speed. The rest of the hardware would require a couple of comparators and another pulse/ voltage converter. Basically the output from the spindle sensor would be converted to a local voltage which would be compared to the voltage produced by Mach. If the local volts are lower one comparator actuates the speed increase relay - if higher the other actuates the speed reduce relay. There would be a small dead band in the two levels so that relay chatter could be avoided.I'm not saying that it is simple, but if you are into electronics it would be both possible & interesting.

I have the speed sensor, (needed it for threading to work).I hadn't though of using a hardware comparitor with the PWM, that might work out simpler to deal with than trying to program Mach to do itSimpler to debug since I know a lot more about electronics than programing Mach!.

Chris,Having said all that, I've had a quick play amongst the brains and I think I can do it with a brain. The brain editor is a bit frustrating with its editing limitations, so I'll go off to the pub now & think about it on paper over a pint. I'll have another go tomorrow and try it on a real machine so I have some true spindle revs as an input.I assume you have a couple of outputs free as well as spindle start etc?

I've tried the brain on my lathe & it seems to work. There needs to be a bit of polishing but the idea works. See the attached file.I've allocated outputs 5 & 6 for the relays. To try it, load the brain file into you brains folder. You should then see it in Mach under Operator/ Brain control. Enable it and go to diagnostics. If you set a speed & start your spindle, Output 6 will start to flash (speed up relay), as the speed passes the requested number, 6 will go out & 5 will come on. ( speed reduce)I need to include a delay in operation so that the spindle reaches a stable speed before any corrections start & also a bit of dead space to stop chatter. As I say, it's not exactly right yet but it shows that it's possible.

Hmm it won't let me post brains, I'll try a .dxf ending. If it works you'll have to rename it.