PDA

View Full Version : Spindle - Slide Sychronisation



bobhare
03-01-2017, 06: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, 07: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.

bobhare
03-01-2017, 09:48 PM
Clive
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?
20206
Would this Friday be convenient to pay a visit?
Bob

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

bobhare
15-01-2017, 05: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, 06: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

depronman
15-12-2019, 10:17 PM
I know this is an old thread but I have just finish a retro fit of an ORAC with LinuxCNC and have all working including threading using the original orac encode wheel 48 slot and three optical readers so operating in quadrature
Let me know if you need any help
Paul

Doddy
16-12-2019, 02:58 AM
Paul, When I'm back in the country I'll be wiring up an encoder for my lathe - I might well be in touch!

depronman
16-12-2019, 08:16 AM
OK understood
I bought a encoder just in case the home made encoder was not up to the job but it meant making up a lay shaft to run the encoder and a set of timing pulleys to run the lay shaft at spindle speed. All very doable but the original ORAC encoder disc was looking me in the face so a bracket was designed in CAD to mount the 3 optical seasons with each sensor adjustable in radial position. The bracket was in two halves as it was to be 3D printed effectively a plate to hold the three sensors and adjusters and a separate stem that mounts to the lathe headstock
The two pieces are checked for position and then glued in place using cyno
Wire up the three sensors to the bob and and give it a try
The sensors have an led that flashes when the signal to the bob is triggered so rough adjustment of the sensor alignment was done using the LED on each sensor
One sensor reads the long slot to single pulse per rev
The other two read each slot and the alignment of these is rather more critical which I did with the spindle running and monitored the spindle speed in linuxcnc
It was showing on the display as varying by a few hundred rpm which it clearly was not but after redial adjustment of the two inner sensors the speed stabilised to a steady reading. The sensor mount screws were nipped up and threading on a test bar M10x1.5 attempted
To my amazement it waited the G04 P10 that I programmed in G76 then performed 15 cuts and 2 flex passes with no cut
The thread was nut deep enough so x touch off adjustment made and run again. To my amazement it picked up the thread perfectly and only made a cut after 13 passes of cutting air
Retired and nut still not quite going on
Further adjustment made and run again this time nut ran down the thread perfectly with just a slight amount of slop same feel as the nut on a commercial set screw
I cut the first thread 30mm long
Once depth was correct I cut another thread 9 mm long and the nut ran alway down the thread first time the feel of the nut is the same from first turn through the middle to the very end
Well please with the little ORAC my home brew encoder and linuxcnc

I never do manage to get mach3 to thread on a Boxford BUD I converted to cnc
It may be getting linuxcnc in the near future!!!

all the best. Paul