Fitting an encoder on a Tormach 1100

More
08 Jul 2020 14:14 #173978 by snowgoer540

Yes, clockwise from the top should give a positive velocity

Spindle synced motions need:

1. Spindle at speed true
2. Spindle feedback position from encoder increasing for forward rotation
3. Index detection

1 and 2 can be checked with halshow, 3 can be checked manually by
sets-ing the signal that carries index enable and verifying that the index
enable signal gets cleared when you rotate the spindle (by hand) past the
index position:

halcmd sets index_enable


Thank you!

How do I verify #1?

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 14:19 - 08 Jul 2020 14:20 #173979 by PCW
halmeter/halshow motion.spindle−at−speed

(or spindle.0.at-speed if you have a very recent version of LinuxCNC)
Last edit: 08 Jul 2020 14:20 by PCW.

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 14:20 #173980 by snowgoer540
Thanks again, I’ll check it out after work and report back.

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 14:46 #173985 by snowgoer540

Thanks again, I’ll check it out after work and report back.

I...didn't change anything, and it works today... which makes me wonder if the VFD is right on the cusp as far as meeting the speed requirements.

Which brings me to two more questions:
1. How do I get the encoder feedback to drive spindle RPM, right now it seems like tormach controls it based on pre-determined pwm frequencies in a comp file?
2. If I get the spindle speed accurate based on encoder feedback, is there a way to display actual spindle speed on the GUI, rather than the current faked in spindle speed ramp up it does, again, based on the spindle comp they wrote?

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 15:15 - 08 Jul 2020 15:16 #173987 by PCW
1. You would setup a PID loop to add encoder feedback to create close loop spindle
speed control, this basically means that the spindle speed PWM value comes from the
PID component and the the encoder velocity and commanded spindle speed are wired to
the PID inputs .

2. You would connect the encoder velocity to the GUIs spindle speed display pin, note
that you often need a low pass filter for the displayed value to prevent digit flicker in
the least significant digits.
Last edit: 08 Jul 2020 15:16 by PCW.
The following user(s) said Thank You: snowgoer540

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 01:34 - 18 Jul 2020 01:34 #174992 by snowgoer540
So, I started looking at the HAL file, but it seems to be above my skill level.

I was wondering if someone could help me figure out what to unlink and relink so that the actual RPM displays in the GUI, and so that I can use the spindle PID feedback to control the speed of the spindle?

Here's what I added to make the encoder work with synchronized motion:
net spindle-position hm2_5i25.0.encoder.00.position => motion.spindle-revs
net spindle-velocity hm2_5i25.0.encoder.00.velocity => motion.spindle-speed-in
net spindle-index-enable hm2_5i25.0.encoder.00.index-enable <=> motion.spindle-index-enable
setp hm2_5i25.0.encoder.00.scale -1440

Here's what I had to comment out of the main HAL file:
# motion.spindle-speed-in is necessary for G95 f/rev
net spindle-rps  tormachspindle.speed-out-rps  motion.spindle-speed-in

# DPLL configuration
setp hm2_[HOSTMOT2](BOARD).0.dpll.01.timer-us [HOSTMOT2](DPLL_TIMER_US)

# default is -1 which means don't use the DPLL timer and simply sample on read()
# set to 1 for Ethernet boards to use DPLL timer 1 and sample 100 micro seconds
# before the nominal servo thread read() time
setp hm2_[HOSTMOT2](BOARD).0.stepgen.timer-number  [HOSTMOT2](DPLL_TIMER_NUMBER)

Here's Tormach's spindle connections:
########################################################################
# Spindle speed control
#
# stepgen outputs the frequency it is told by tormachspindle comp
#

# type 1 velocity control mode
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.control-type 1

# step/dir
# type 2 quadrature output for 50% duty cycle
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.step_type 2

# no scaling 1:1
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.position-scale 1.0

# handle spindle at speed via separate component
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.maxaccel 0

# stepspace in nanoseconds
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.stepspace 0

# steplen in nanoseconds (10 microseconds)
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.steplen 10000

# assume standard spindle until UI sets it
setp tormachspindle.spindle-type 0

# hispeed spindle min/max
setp tormachspindle.hispeed-min 1000
setp tormachspindle.hispeed-max 24000

# allow UI to access min/max for high speed spindle
# do not net these until the UI code is changed to set them explicitly
# or the setp command above will not stick and they will be set to 0
net spindle-hispeed-min      tormachspindle.hispeed-min
net spindle-hispeed-max      tormachspindle.hispeed-max

# these let the UI read the min/max maintained by the comp based on spindle type
net spindle-min-speed        tormachspindle.min-speed
net spindle-max-speed        tormachspindle.max-speed

# the UI sets the spindle type
net spindle-type             tormachspindle.spindle-type

# assume high range until UI sets it
setp tormachspindle.belt-position 1
net spindle-range            tormachspindle.belt-position
net spindle-range-alarm      tormachspindle.speed-alarm

setp tormachspindle.lowbelt-min-rpm  [SPINDLE]LO_RANGE_MIN
setp tormachspindle.lowbelt-max-rpm  [SPINDLE]LO_RANGE_MAX
setp tormachspindle.lowbelt-ratio [SPINDLE]LO_RANGE_PULLEY_RATIO

setp tormachspindle.highbelt-min-rpm [SPINDLE]HI_RANGE_MIN
setp tormachspindle.highbelt-max-rpm [SPINDLE]HI_RANGE_MAX
setp tormachspindle.highbelt-ratio [SPINDLE]HI_RANGE_PULLEY_RATIO

# frequencies sent to stepgen to achieve low belt speeds
#   500 Hz ->   6 Hz at VFD ->   175 RPM at spindle (770)
# 10900 Hz -> 120 Hz at VFD ->  3250 RPM at spindle (770)
#   500 Hz ->   6 Hz at VFD ->   100 RPM at spindle (1100-2-3)
# 10900 Hz -> 120 Hz at VFD ->  2000 RPM at spindle (1100-2-3)
#  1600 Hz ->                    300 RPM at spindle (1100-1)
# 10900 Hz ->                   1750 RPM at spindle (1100-1)
setp tormachspindle.lowbelt-min-mcb-freq [SPINDLE]MIN_MCB_FREQUENCY
setp tormachspindle.lowbelt-max-mcb-freq [SPINDLE]MAX_MCB_FREQUENCY

# frequencies sent to stepgen to achieve high belt speeds
#   500 Hz ->   6 Hz at VFD ->   525 RPM at spindle (770)
# 10900 Hz -> 120 Hz at VFD -> 10200 RPM at spindle (770)
#   500 Hz ->   6 Hz at VFD ->   250 RPM at spindle (1100-2-3)
# 10900 Hz -> 120 Hz at VFD ->  5140 RPM at spindle (1100-2-3)
#  1600 Hz ->                    800 RPM at spindle (1100-1)
# 10900 Hz ->                   4500 RPM at spindle (1100-1)
setp tormachspindle.highbelt-min-mcb-freq [SPINDLE]MIN_MCB_FREQUENCY
setp tormachspindle.highbelt-max-mcb-freq [SPINDLE]MAX_MCB_FREQUENCY

# speed-out is displayed by UI when program running
net spindle-speed-fb-rpm     tormachspindle.speed-out

# connect motion speed-out to input of spindle comp
net spindle-speed-raw        motion.spindle-speed-out    tormachspindle.speed-in

# connect output of spindle comp to stepgen
net spindle-speed            tormachspindle.mcb-freq-out hm2_[HOSTMOT2](BOARD).0.stepgen.04.velocity-cmd

# spindle at speed parameters for tormachspindle component
setp tormachspindle.startup-delay     [SPINDLE]STARTUP_DELAY

# time to reach max speed from stopped
setp tormachspindle.seconds-to-max-rpm [SPINDLE]SECONDS_TO_MAX_RPM

# connect spindle comp at-speed output to motion
net spindle-at-speed  tormachspindle.at-speed  motion.spindle-at-speed

# motion.spindle-speed-in is necessary for G95 f/rev
#GDCnet spindle-rps  tormachspindle.speed-out-rps  motion.spindle-speed-in

# connect motion spindle enable to stepgen enable and spindle comp
net spindle-on        motion.spindle-on        hm2_[HOSTMOT2](BOARD).0.stepgen.04.enable    tormachspindle.spindle-on

# spindle direction
# P3 pin 16 gpio 005
setp hm2_[HOSTMOT2](BOARD).0.gpio.005.is_output 1
net spindle-cw motion.spindle-forward => hm2_[HOSTMOT2](BOARD).0.gpio.005.out

# UI access to stop spindle while in feedhold / INTERP_PAUSED
net spindle-disable tormachspindle.disable

# max RPM when enclosure door open
net enc-door-open-max-rpm tormachspindle.enc-door-open-max-rpm

# ATC uses this pin for BT30 configs -- this is a stub
newsig orient-status float
sets   orient-status 0

I also attached the HAL in case it's needed.

I appreciate the help!
Attachments:
Last edit: 18 Jul 2020 01:34 by snowgoer540.

Please Log in or Create an account to join the conversation.

More
20 Jul 2020 11:29 #175247 by snowgoer540
Maybe I asked too much at once. I'll try to break it down a little bit.

Currently, to me, it looks like they are using a comp to take the commanded RPM value, and output a frequency with a stepgen output. They give the frequency range of 1000 to 24000. It looks like the comp file also fakes the RPM ramp up on the GUI. And I'm guessing it also ramps the frequency to the specified RPM based on some rate.

I'm not sure if this is how regular spindles work (this is my first trek down this particular road, so forgive my ignorance).

From what I can tell, the only real input and output to the component are:
# speed-out is displayed by UI when program running
net spindle-speed-fb-rpm     tormachspindle.speed-out

# connect motion speed-out to input of spindle comp
net spindle-speed-raw        motion.spindle-speed-out    tormachspindle.speed-in

Just to try to get somewhere, I tried hooking the spindle-velocity signal to spindle-speed-fb-rpm, but it didn't work. Pathpilot wouldnt load. Also, the speed would have been showed in RPS, but I figured I could deal with that later.

I guess overall, has Tormach made this too difficult to work with? Or is it really simple, but I just have a ways to go to understand it/how to make it work?

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.156 seconds
Powered by Kunena Forum