Luxturn LTI Lathe Retrofit

More
5 years 5 months ago #210466 by Bassblaster
Hi guys,

I want to share my experience retrofitting a 30 year old Japanese lathe that I lovingly call "Wakako".(From Cyberpunk 2077)
This is her in full 'old' glory:

[img

I am mostly posting this to share my pain as I am trying to enable her features, but also to maybe get some advice.
I am using a Mesa 7i96 card connected via ethernet to a Dell Optiplex running Debian 10 and Linux 2.8.0 .

The old lady sure is a little troublemaker, but so far, I got the x- and z-axis moving.

The next tasks will be:
  • Get the limit switches etc. connected and make sure they are working
  • Get the mesa board to output a PWM signal for the VFD for the main spindle
  • Get the spindle encoder to work with the mesa Board
  • Try to get the revolver-style ATC running

After everything is finished, I want to make a tutorial video on Youtube so that other people have an easier time (is that even possible? :evil: )

Kind regards,
Manuel

Please Log in to join the conversation.

More
5 years 5 months ago #210470 by tommylight
That is a nice little lady ! :)

Please Log in to join the conversation.

More
5 years 5 months ago #210568 by Bassblaster
Today, I made some more progress.
I used PnCConf tool to get an initial config. This way, I was able to get the limit switches and the coolant pump and so on working.

My Lathe already had a spindle encoder, and I wanted to keep it in order to avoid additional work on the hardware side of things.
Fortunately, I got the stock spindle encoder to work changing the jumpers on the mesa 7i96 board according to the manual for a single ended encoder. The encoder was a little bit confusing, because it has 8 wires coming out, but 4 of them need to be grounded, so it is indeed single ended:
 500


I was able to verify the working state of the encoder using halshow, The structure of the parameters wasn't intuitive in my opinion, but we can see it working here:

 500


Unfortenately, getting the mesa card to output a pwm signal for the spindle is appearantly not as easy. I did the following steps:
  • Flashing the mesacard with the firmware for 4 stepgens and 1 pwm generator using mesaflash
  • I then changed the .hal file manually, since PnCConf seems to have a problem with the custom firmware. I only changed one line, in which I specified the number of pwm gens to be 1.
  • Running mesaflash --device 7i96 --addr 10.10.10.10 -readhmid ,I found out the pins, where the pwm generator was assigned to.
  • Then I connected an oscilloscope (to pins 1 and 3 of TB2 in my case), but was not able to get any signal.

My first guess is that I have to change more in the .hal file. Does anyone have a clue what to change? Or an example of a .hal file from an 7i96 with pwm spindle control?

Please Log in to join the conversation.

More
5 years 5 months ago #210580 by PCW
Replied by PCW on topic Luxturn LTI Lathe Retrofit
Can you post your current hal and ini files?

Please Log in to join the conversation.

More
5 years 5 months ago #210728 by Bassblaster
Here are the .ini and the .hal , I think that in the .hal I might need to specify a pin for the PWM, I took a look at RotarySMP's ini and hal files for the minilathe, but couldn't get it to work for me. :unsure:

This is the .ini:
Code:
# Erstellt von PNCconf am Sun May 30 21:54:52 2021 # Using LinuxCNC version: 2.8 # Änderungen an dieser Datei werden beim nächsten # overwritten when you run PNCconf again [EMC] MACHINE = Wakako DEBUG = 0 VERSION = 1.1 [DISPLAY] DISPLAY = gmoccapy POSITION_OFFSET = RELATIVE POSITION_FEEDBACK = ACTUAL MAX_FEED_OVERRIDE = 2.000000 MAX_SPINDLE_OVERRIDE = 1.500000 MIN_SPINDLE_OVERRIDE = 0.500000 INTRO_GRAPHIC = linuxcnc.gif INTRO_TIME = 5 PROGRAM_PREFIX = /home/wakako/linuxcnc/nc_files INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm LATHE = 1 POSITION_FEEDBACK = ACTUAL DEFAULT_LINEAR_VELOCITY = 6.000000 MAX_LINEAR_VELOCITY = 25.000000 MIN_LINEAR_VELOCITY = 0.500000 DEFAULT_ANGULAR_VELOCITY = 12.000000 MAX_ANGULAR_VELOCITY = 180.000000 MIN_ANGULAR_VELOCITY = 1.666667 EDITOR = gedit GEOMETRY = xz [FILTER] PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image PROGRAM_EXTENSION = .py Python Script png = image-to-gcode gif = image-to-gcode jpg = image-to-gcode py = python [TASK] TASK = milltask CYCLE_TIME = 0.010 [RS274NGC] PARAMETER_FILE = linuxcnc.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 SERVO_PERIOD = 1000000 [HMOT] CARD0=hm2_7i96.0 [HAL] HALUI = halui HALFILE = Wakako.hal HALFILE = custom.hal POSTGUI_HALFILE = postgui_call_list.hal SHUTDOWN = shutdown.hal [HALUI] [KINS] JOINTS = 2 KINEMATICS = trivkins coordinates=XZ [TRAJ] COORDINATES = XZ LINEAR_UNITS = mm ANGULAR_UNITS = degree DEFAULT_LINEAR_VELOCITY = 3.33 MAX_LINEAR_VELOCITY = 33.33 NO_FORCE_HOMING = 1 [EMCIO] EMCIO = io CYCLE_TIME = 0.100 TOOL_TABLE = tool.tbl #****************************************** [AXIS_X] MAX_VELOCITY = 33.3333333333 MAX_ACCELERATION = 100.0 MIN_LIMIT = -0.0 MAX_LIMIT = 140.0 [JOINT_0] TYPE = LINEAR HOME = 10.0 FERROR = 10.0 MIN_FERROR = 1.0 MAX_VELOCITY = 33.3333333333 MAX_ACCELERATION = 100.0 # The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION # If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger. STEPGEN_MAXVEL = 41.67 STEPGEN_MAXACCEL = 125.00 P = 1000.0 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 1.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 0.0 # these are in nanoseconds DIRSETUP = 10000 DIRHOLD = 10000 STEPLEN = 5000 STEPSPACE = 5000 STEP_SCALE = 5120.0 MIN_LIMIT = -0.0 MAX_LIMIT = 140.0 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -1.000000 HOME_LATCH_VEL = -0.500000 HOME_FINAL_VEL = 0.000000 HOME_USE_INDEX = NO HOME_SEQUENCE = 1 #****************************************** #****************************************** [AXIS_Z] MAX_VELOCITY = 33.3333333333 MAX_ACCELERATION = 100.0 MIN_LIMIT = -350.0 MAX_LIMIT = 0.0 [JOINT_1] TYPE = LINEAR HOME = -20.0 FERROR = 10.0 MIN_FERROR = 1.0 MAX_VELOCITY = 33.3333333333 MAX_ACCELERATION = 100.0 # The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION # If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger. STEPGEN_MAXVEL = 41.67 STEPGEN_MAXACCEL = 125.00 P = 1000.0 I = 0.0 D = 0.0 FF0 = 0.0 FF1 = 1.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 0.0 # these are in nanoseconds DIRSETUP = 10000 DIRHOLD = 10000 STEPLEN = 5000 STEPSPACE = 5000 STEP_SCALE = 5120.0 MIN_LIMIT = -350.0 MAX_LIMIT = 0.0 HOME_OFFSET = 0.000000 HOME_SEARCH_VEL = -1.000000 HOME_LATCH_VEL = -0.500000 HOME_FINAL_VEL = 0.000000 HOME_USE_INDEX = NO HOME_SEQUENCE = 0 #****************************************** [SPINDLE_0] P = 0.0 I = 0.0 D = 0.0 FF0 = 1.0 FF1 = 0.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 1500.0 ENCODER_SCALE = 1024.0

And this is the hal:
Code:
# Erstellt von PNCconf am Sun May 30 21:54:52 2021 # Using LinuxCNC version: 2.8 # Änderungen an dieser Datei werden beim nächsten # overwritten when you run PNCconf again loadrt [KINS]KINEMATICS loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS loadrt hostmot2 loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=1 num_pwmgens=1 num_stepgens=3 sserial_port_0=00xxxx" setp [HMOT](CARD0).watchdog.timeout_ns 5000000 loadrt pid names=pid.x,pid.z,pid.s loadrt scale names=scale.gear loadrt mux16 names=ratio_select addf [HMOT](CARD0).read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.x.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf pid.s.do-pid-calcs servo-thread addf ratio_select servo-thread addf scale.gear servo-thread addf [HMOT](CARD0).write servo-thread # external output signals # --- COOLANT-FLOOD --- net coolant-flood => [HMOT](CARD0).ssr.00.out-00 # --- SPINDLE-ENABLE --- net spindle-enable => [HMOT](CARD0).ssr.00.out-01 # --- SPINDLE-CW --- net spindle-cw => [HMOT](CARD0).ssr.00.out-02 # --- SPINDLE-CCW --- net spindle-ccw => [HMOT](CARD0).ssr.00.out-03 # --- MACHINE-IS-ENABLED --- net machine-is-enabled => [HMOT](CARD0).ssr.00.out-04 # --- DOUT-00 --- net dout-00 => [HMOT](CARD0).ssr.00.out-05 # external input signals # --- MIN-X --- net min-x <= [HMOT](CARD0).gpio.000.in # --- MAX-X --- net max-x <= [HMOT](CARD0).gpio.001.in # --- HOME-X --- net home-x <= [HMOT](CARD0).gpio.002.in # --- MIN-Z --- net min-z <= [HMOT](CARD0).gpio.003.in # --- MAX-Z --- net max-z <= [HMOT](CARD0).gpio.004.in # --- HOME-Z --- net home-z <= [HMOT](CARD0).gpio.005.in #******************* # AXIS X JOINT 0 #******************* setp pid.x.Pgain [JOINT_0]P setp pid.x.Igain [JOINT_0]I setp pid.x.Dgain [JOINT_0]D setp pid.x.bias [JOINT_0]BIAS setp pid.x.FF0 [JOINT_0]FF0 setp pid.x.FF1 [JOINT_0]FF1 setp pid.x.FF2 [JOINT_0]FF2 setp pid.x.deadband [JOINT_0]DEADBAND setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT setp pid.x.error-previous-target true # This setting is to limit bogus stepgen # velocity corrections caused by position # feedback sample time jitter. setp pid.x.maxerror 0.012700 net x-index-enable <=> pid.x.index-enable net x-enable => pid.x.enable net x-pos-cmd => pid.x.command net x-pos-fb => pid.x.feedback net x-output <= pid.x.output # Step Gen signals/setup setp [HMOT](CARD0).stepgen.00.dirsetup [JOINT_0]DIRSETUP setp [HMOT](CARD0).stepgen.00.dirhold [JOINT_0]DIRHOLD setp [HMOT](CARD0).stepgen.00.steplen [JOINT_0]STEPLEN setp [HMOT](CARD0).stepgen.00.stepspace [JOINT_0]STEPSPACE setp [HMOT](CARD0).stepgen.00.position-scale [JOINT_0]STEP_SCALE setp [HMOT](CARD0).stepgen.00.step_type 0 setp [HMOT](CARD0).stepgen.00.control-type 1 setp [HMOT](CARD0).stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL setp [HMOT](CARD0).stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL setp [HMOT](CARD0).stepgen.00.step.invert_output true setp [HMOT](CARD0).stepgen.00.direction.invert_output true # ---closedloop stepper signals--- net x-pos-cmd <= joint.0.motor-pos-cmd net x-vel-cmd <= joint.0.vel-cmd net x-output <= [HMOT](CARD0).stepgen.00.velocity-cmd net x-pos-fb <= [HMOT](CARD0).stepgen.00.position-fb net x-pos-fb => joint.0.motor-pos-fb net x-enable <= joint.0.amp-enable-out net x-enable => [HMOT](CARD0).stepgen.00.enable # ---setup home / limit switch signals--- net home-x => joint.0.home-sw-in net min-x => joint.0.neg-lim-sw-in net max-x => joint.0.pos-lim-sw-in #******************* # AXIS Z JOINT 1 #******************* setp pid.z.Pgain [JOINT_1]P setp pid.z.Igain [JOINT_1]I setp pid.z.Dgain [JOINT_1]D setp pid.z.bias [JOINT_1]BIAS setp pid.z.FF0 [JOINT_1]FF0 setp pid.z.FF1 [JOINT_1]FF1 setp pid.z.FF2 [JOINT_1]FF2 setp pid.z.deadband [JOINT_1]DEADBAND setp pid.z.maxoutput [JOINT_1]MAX_OUTPUT setp pid.z.error-previous-target true # This setting is to limit bogus stepgen # velocity corrections caused by position # feedback sample time jitter. setp pid.z.maxerror 0.012700 net z-index-enable <=> pid.z.index-enable net z-enable => pid.z.enable net z-pos-cmd => pid.z.command net z-pos-fb => pid.z.feedback net z-output <= pid.z.output # Step Gen signals/setup setp [HMOT](CARD0).stepgen.01.dirsetup [JOINT_1]DIRSETUP setp [HMOT](CARD0).stepgen.01.dirhold [JOINT_1]DIRHOLD setp [HMOT](CARD0).stepgen.01.steplen [JOINT_1]STEPLEN setp [HMOT](CARD0).stepgen.01.stepspace [JOINT_1]STEPSPACE setp [HMOT](CARD0).stepgen.01.position-scale [JOINT_1]STEP_SCALE setp [HMOT](CARD0).stepgen.01.step_type 0 setp [HMOT](CARD0).stepgen.01.control-type 1 setp [HMOT](CARD0).stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL setp [HMOT](CARD0).stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL # ---closedloop stepper signals--- net z-pos-cmd <= joint.1.motor-pos-cmd net z-vel-cmd <= joint.1.vel-cmd net z-output <= [HMOT](CARD0).stepgen.01.velocity-cmd net z-pos-fb <= [HMOT](CARD0).stepgen.01.position-fb net z-pos-fb => joint.1.motor-pos-fb net z-enable <= joint.1.amp-enable-out net z-enable => [HMOT](CARD0).stepgen.01.enable # ---setup home / limit switch signals--- net home-z => joint.1.home-sw-in net min-z => joint.1.neg-lim-sw-in net max-z => joint.1.pos-lim-sw-in #******************* # SPINDLE #******************* setp pid.s.Pgain [SPINDLE_0]P setp pid.s.Igain [SPINDLE_0]I setp pid.s.Dgain [SPINDLE_0]D setp pid.s.bias [SPINDLE_0]BIAS setp pid.s.FF0 [SPINDLE_0]FF0 setp pid.s.FF1 [SPINDLE_0]FF1 setp pid.s.FF2 [SPINDLE_0]FF2 setp pid.s.deadband [SPINDLE_0]DEADBAND net ratio_select.out pid.s.maxoutput setp pid.s.error-previous-target true net spindle-index-enable <=> pid.s.index-enable net spindle-enable => pid.s.enable net spindle-vel-cmd-rpm-abs => pid.s.command net spindle-vel-fb-rpm-abs => pid.s.feedback net spindle-pid-out pid.s.output => scale.gear.in net gear-ratio ratio_select.out-f => scale.gear.gain setp ratio_select.in00 0.000667 setp ratio_select.in01 0.000167 net gear-select-a => ratio_select.sel0 net spindle-output <= scale.gear.out # ---Encoder feedback signals/setup--- setp [HMOT](CARD0).encoder.00.counter-mode 0 setp [HMOT](CARD0).encoder.00.filter 1 setp [HMOT](CARD0).encoder.00.index-invert 0 setp [HMOT](CARD0).encoder.00.index-mask 0 setp [HMOT](CARD0).encoder.00.index-mask-invert 0 setp [HMOT](CARD0).encoder.00.scale [SPINDLE_0]ENCODER_SCALE net spindle-revs <= [HMOT](CARD0).encoder.00.position net spindle-vel-fb-rps <= [HMOT](CARD0).encoder.00.velocity net spindle-index-enable <=> [HMOT](CARD0).encoder.00.index-enable # ---setup spindle control signals--- net spindle-vel-cmd-rps <= spindle.0.speed-out-rps net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs net spindle-vel-cmd-rpm <= spindle.0.speed-out net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs net spindle-enable <= spindle.0.on net spindle-cw <= spindle.0.forward net spindle-ccw <= spindle.0.reverse net spindle-brake <= spindle.0.brake net spindle-revs => spindle.0.revs net spindle-at-speed => spindle.0.at-speed net spindle-vel-fb-rps => spindle.0.speed-in net spindle-index-enable <=> spindle.0.index-enable # ---Setup spindle at speed signals--- sets spindle-at-speed true #****************************** # connect miscellaneous signals #****************************** # ---HALUI signals--- net axis-select-x halui.axis.x.select net jog-x-pos halui.axis.x.plus net jog-x-neg halui.axis.x.minus net jog-x-analog halui.axis.x.analog net x-is-homed halui.joint.0.is-homed net axis-select-z halui.axis.z.select net jog-z-pos halui.axis.z.plus net jog-z-neg halui.axis.z.minus net jog-z-analog halui.axis.z.analog net z-is-homed halui.joint.1.is-homed net jog-selected-pos halui.axis.selected.plus net jog-selected-neg halui.axis.selected.minus net spindle-manual-cw halui.spindle.0.forward net spindle-manual-ccw halui.spindle.0.reverse net spindle-manual-stop halui.spindle.0.stop net machine-is-on halui.machine.is-on net jog-speed halui.axis.jog-speed net MDI-mode halui.mode.is-mdi # ---coolant signals--- net coolant-mist <= iocontrol.0.coolant-mist net coolant-flood <= iocontrol.0.coolant-flood # ---probe signal--- net probe-in => motion.probe-input # ---motion control signals--- net in-position <= motion.in-position net machine-is-enabled <= motion.motion-enabled # ---digital in / out signals--- net dout-00 <= motion.digital-out-00 # ---estop signals--- net estop-out <= iocontrol.0.user-enable-out net estop-out => iocontrol.0.emc-enable-in # ---manual tool change signals--- loadusr -W hal_manualtoolchange net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change net tool-change-confirmed 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

Please Log in to join the conversation.

More
5 years 5 months ago #210743 by andypugh
Replied by andypugh on topic Luxturn LTI Lathe Retrofit
The missing link seems to be pid.s.output to pwm.

Somewhere in the [SPINDLE] section try adding:
Code:
net spindle-enable [HMOT](CARD0)pwmgen.00.enable net pwm-dc pid.s.output [HMOT](CARD0)pwmgen.00.value setp [HMOT](CARD0)pwmgen.00.scale {your max rpm}

Please Log in to join the conversation.

More
5 years 5 months ago #210750 by Bassblaster
Thanks for the help, that totally worked! Now the old lady is spinning up! B) I am a total noob, so I appreciate your help a lot!

For now there is one task left, unfortunately, it is propably also the most difficult. The toolchanger.
The toolchanger is a 8-station turret toolchanger, which can freely move in one direction,but in the other direction, there are stops for each tool position, kind of like a ratchet. Currently there is no index switch on the toolchanger, so I might add one, if necessary.
I am planning to utilize one of the mesa cards stepgenerators to drive the stepper motor for the toolchanger.
I think I have to write a macro of sorts to achieve this, if I am right.

Do you have any suggestions/ examples for this case?

Please Log in to join the conversation.

More
5 years 5 months ago #210751 by andypugh

Please Log in to join the conversation.

Time to create page: 0.199 seconds
Powered by Kunena Forum