View Full Version : Spindle - Slide Sychronisation

03-01-2017, 05:27 PM
I'm converting an ORAC lathes electronics and have had the slides under CNC control and the spindle operating at variable speed through a VFD. It's not all integrated and under CNC control but when it is i intend to use Linux CNC but also have Mach3.
The VFD is a Eurotherm 601 and the BOB is one advertised as a Mach3 board with a 0-10V 0utput and a relay. On the non-working end of the spindle is an encoder disc with, i think, 100 slots with one extending to the outside of the disc.
The three images below show the VFD, the BOB and the encoder disc.
I need the lathe for thread cutting and obviously need to sync the z slide and the spindle.
My understanding is that the Encoder sends a feedback signal to Linux CNC which then controls the slide traverse rate to the spindle speed.
I don't know whether the BOB I have can fulfill this task and even if it can i don't know how to do it.
So the questions are:-
1 Is the BOB adequate and if not can someone recommend a more suitable one.
2 How do i build the kit that picks the signal up from the encoding disc and
3 How do i integrate the bits and control it through Linux CNC.

Clive S
03-01-2017, 06:06 PM
Bob I have done this on a ML S7 with a 100 slot encoder. Do you intend to put homing switches on the lathe. As that bob will only have 5 inputs. you can get away with A and Index pulse (2 inputs) better with A + B and index 3 inputs. personally I would go with a mesa card something like 7i76 or 7i76e for ethernet. if using Lcnc.

I am happy if you want to come over to see mine Stockport.

03-01-2017, 08:48 PM
Thanks for the speedy reply and invitation. The latter i will willingly take up.
I've just completed a 3-axis router and this has limit switches on all axes and an emergency stop button. The limit switches are primarily used for homing but have the other useful function of minimising the risk of crashes. I'm rebuilding this for a friend who has the machining experience so i don't know whether homing switches are necessary. (The chaps name is Dave Forest and he may already have contacted you.) The ORAC has just one limit switch as original.
Based on your reply and reading part of the linux manual Pins 10 and 11 on the DB25 are used to provide feedback to the controller. I presume these are two of the input pins on the BOB.
I also presume that a device similar to this would provide the encoder signals?
Would this Friday be convenient to pay a visit?

Clive S
03-01-2017, 09:28 PM
Bob Could you put up a link for this part. I will PM you my address.

15-01-2017, 04:54 PM
Thanks Clive and i've now moved on some but i have encountered another hurdle.
The HAL file for the set up is shown below.

# Generated by stepconf 1.1 at Sun Jan 15 15:33:03 2017
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hal_parport cfg="0 out"
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0
loadrt pwmgen output_type=1

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf pwmgen.update servo-thread

net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 876.0
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= motion.spindle-speed-out
net spindle-cmd-rpm-abs <= motion.spindle-speed-out-abs
net spindle-cmd-rps <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs <= motion.spindle-speed-out-rps-abs
net spindle-at-speed => motion.spindle-at-speed

net spindle-pwm => parport.0.pin-01-out
setp parport.0.pin-02-out-invert 1
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
setp parport.0.pin-03-out-invert 1
net xdir => parport.0.pin-03-out
setp parport.0.pin-04-out-invert 1
net zstep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
setp parport.0.pin-05-out-invert 1
net zdir => parport.0.pin-05-out
net spindle-on => parport.0.pin-17-out

setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable

setp stepgen.1.position-scale [AXIS_2]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.1.position-cmd
net zpos-fb stepgen.1.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.1.step
net zdir <= stepgen.1.dir
net zenable axis.2.amp-enable-out => stepgen.1.enable

net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in

loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

If I input M3 S876 then the output from Pin 1 is 4.9V and the spindle runs at approx 876rpm.
If i input S438 the output drops to a steady 2.45v but the spindle rpm oscillates between 0 and 876rpm. The closer i set the S speed the more the spindle is at max speed.

If I use a power supply to feed into the VFD at say 2.45V then the spindle runs at the correct speed.

I deduced there must be some other input that's causing this oscillation and measured the AC voltage on pin1 at 2.7V. I can't determine it's frequency but if this is very low then it might explain the issue?

Is there a way of filtering out the AC component if in fact it is this that is causing the problem?

Clive S
15-01-2017, 05:37 PM
Bob I think that this would be better put on the Linuxcnc forum Having said that Have you had a look at this
http://linuxcnc.org/docs/2.4/html/examples_spindle.html#r1_3 this is for version 2.4 I think.

Where did you get the scale from in setp pwmgen.0.scale 876.0 I think this should be set to the max speed of the spindle

Are you using 0-10V

I hope somebody can chime in to help plese