spindle with encoder
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 562
- Thank you received: 106
15 Apr 2025 22:14 #326413
by JohnnyCNC
Replied by JohnnyCNC on topic spindle with encoder
Hold on a second. I lied. Not intentionally. My spindle motor is a DYN4 servo motor geared 1:1.8 and it has a simulated encoder signal generated by the servo driver. That is the signal I am using for the coordination for rigid tapping. The sensor on the slotted plate it just for measuring RPM.
It's been a few years since I set this up and when you mentioned more slots I thought "I knew that, why didn't I do that?" Then I looked deeper and remembered how it really works.
To actually do this with a slotted plate and sensors you would want more slots and two sensors. Read up on how quadrature encoders work.
As long as you know the ratio between the spindle and encoder you can make almost any arrangement work.
These are my .ini settings.
[SPINDLE_0]
P = 2.0
I = 4.0
D = 0.0
FF0 = 1.08
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
OUTPUT_MIN_LIMIT = -5400.0
OUTPUT_MAX_LIMIT = 5400.0
OUTPUT_SCALE = -10800
ENCODER_SCALE = 4551.111111
#((2048 * 4) / 1.8) = 4551.111111
#The maximum spindle speed (in rpm)
MAX_FORWARD_VELOCITY = 5400
#The minimum spindle speed (in rpm)
MIN_FORWARD_VELOCITY = 50
#This setting will default to MAX_FORWARD_VELOCITY if omitted.
MAX_REVERSE_VELOCITY = 5400
#The minimum spindle speed (in rpm)default to MIN_FORWARD_VELOCITY if omitted.
MIN_REVERSE_VELOCITY = 50
Sorry for the confusion. I hope this helps.
It's been a few years since I set this up and when you mentioned more slots I thought "I knew that, why didn't I do that?" Then I looked deeper and remembered how it really works.
To actually do this with a slotted plate and sensors you would want more slots and two sensors. Read up on how quadrature encoders work.
As long as you know the ratio between the spindle and encoder you can make almost any arrangement work.
These are my .ini settings.
[SPINDLE_0]
P = 2.0
I = 4.0
D = 0.0
FF0 = 1.08
FF1 = 0.0
FF2 = 0.0
BIAS = 0.0
DEADBAND = 0.0
OUTPUT_MIN_LIMIT = -5400.0
OUTPUT_MAX_LIMIT = 5400.0
OUTPUT_SCALE = -10800
ENCODER_SCALE = 4551.111111
#((2048 * 4) / 1.8) = 4551.111111
#The maximum spindle speed (in rpm)
MAX_FORWARD_VELOCITY = 5400
#The minimum spindle speed (in rpm)
MIN_FORWARD_VELOCITY = 50
#This setting will default to MAX_FORWARD_VELOCITY if omitted.
MAX_REVERSE_VELOCITY = 5400
#The minimum spindle speed (in rpm)default to MIN_FORWARD_VELOCITY if omitted.
MIN_REVERSE_VELOCITY = 50
Sorry for the confusion. I hope this helps.
The following user(s) said Thank You: vre
Please Log in or Create an account to join the conversation.
- vre
- Offline
- Platinum Member
-
Less
More
- Posts: 644
- Thank you received: 17
15 Apr 2025 23:42 #326415
by vre
Replied by vre on topic spindle with encoder
This helps..
What is OUTPUT_SCALE = -10800 ?
This config is for fixed motor:spindle transmition ratio.
I have 2 selectable speeds after encoder-motor
These 2 speeds are selected by hydraulic electrovalve that switches gears
position 1 max rpm is 760rpm and position 2 max rpm 3060
What is OUTPUT_SCALE = -10800 ?
This config is for fixed motor:spindle transmition ratio.
I have 2 selectable speeds after encoder-motor
These 2 speeds are selected by hydraulic electrovalve that switches gears
position 1 max rpm is 760rpm and position 2 max rpm 3060
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 562
- Thank you received: 106
16 Apr 2025 23:21 #326495
by JohnnyCNC
Replied by JohnnyCNC on topic spindle with encoder
I'm not really sure exactly what is does, but this is where it is used in my hal file.
It looks like it is set to -10800 because 5400 to -5400 is -10800.
# ---Analog output signals/setup---
setp hm2_7i76e.0.7i83.0.1.analogout5-scalemax [SPINDLE_0]OUTPUT_SCALE
setp hm2_7i76e.0.7i83.0.1.analogout5-minlim [SPINDLE_0]OUTPUT_MIN_LIMIT
setp hm2_7i76e.0.7i83.0.1.analogout5-maxlim [SPINDLE_0]OUTPUT_MAX_LIMIT
net spindle-output => hm2_7i76e.0.7i83.0.1.analogout5
It looks like it is set to -10800 because 5400 to -5400 is -10800.
# ---Analog output signals/setup---
setp hm2_7i76e.0.7i83.0.1.analogout5-scalemax [SPINDLE_0]OUTPUT_SCALE
setp hm2_7i76e.0.7i83.0.1.analogout5-minlim [SPINDLE_0]OUTPUT_MIN_LIMIT
setp hm2_7i76e.0.7i83.0.1.analogout5-maxlim [SPINDLE_0]OUTPUT_MAX_LIMIT
net spindle-output => hm2_7i76e.0.7i83.0.1.analogout5
Please Log in or Create an account to join the conversation.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23297
- Thank you received: 4938
18 Apr 2025 10:10 #326585
by andypugh
Replied by andypugh on topic spindle with encoder
Note that unless the index pulse is from the spindle shaft, or the gear ratio is exactly 1:1, you can't peck-tap with the encoder on the motor shaft. This probably isn't a problem in most cases, but is worth being aware of.
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 562
- Thank you received: 106
18 Apr 2025 20:55 #326630
by JohnnyCNC
Replied by JohnnyCNC on topic spindle with encoder
Ah, I took a look at the actual wiring on my machine. I get the A/B signals from the simulated encode in the servo drive and the Z (index) signal from the sensor that is looking at the slot in the disc on my spindle. That is how mine is able to work.
Thanks Andy
Thanks Andy
Please Log in or Create an account to join the conversation.
- vre
- Offline
- Platinum Member
-
Less
More
- Posts: 644
- Thank you received: 17
18 Apr 2025 21:02 #326632
by vre
Replied by vre on topic spindle with encoder
What this means?
That for rigid tapping encoder must be on spindle shaft
or must be on 1:1 ratio with spindle shaft?
Other ratio configurations can't work for rigid tapping ?
That for rigid tapping encoder must be on spindle shaft
or must be on 1:1 ratio with spindle shaft?
Other ratio configurations can't work for rigid tapping ?
Please Log in or Create an account to join the conversation.
- JohnnyCNC
-
- Offline
- Platinum Member
-
Less
More
- Posts: 562
- Thank you received: 106
18 Apr 2025 21:45 #326637
by JohnnyCNC
Replied by JohnnyCNC on topic spindle with encoder
The index signal sent to the encoder input to LCNC must be 1:1 with the spindle. My encoder is on my motor. But, I get the index signal from the sensor on my spindle. If the gearing of the motor to the spindle was exactly 1:1 you could attached the encoder to either the motor or spindle. But if the gearing is anything other than 1:1 you must get the index signal from the spindle. My gearing is 1:1.8 and the A/B encoder signals come from the motor side, but my Z (index) signal comes from the spindle side.
The following user(s) said Thank You: tommylight, vre
Please Log in or Create an account to join the conversation.
- vre
- Offline
- Platinum Member
-
Less
More
- Posts: 644
- Thank you received: 17
21 Apr 2025 11:31 #326801
by vre
Replied by vre on topic spindle with encoder
So i must attach encoder of encoder disk to spindle shaft because all other places
i can mount the encoder are not 1:1 gear ratio with spindle shaft.
i can mount the encoder are not 1:1 gear ratio with spindle shaft.
Please Log in or Create an account to join the conversation.
- langdons
- Offline
- Elite Member
-
Less
More
- Posts: 287
- Thank you received: 24
21 Apr 2025 13:46 #326808
by langdons
Replied by langdons on topic spindle with encoder
You can install the encoder before the geartrain if you can electronically or mechanically account for the ratio.
As an example, you coul drive a separate "timing pulley" that is adjusted to the "timing pulley" spins at the same speed as the spindle, then install an encoder onto that.
4520B counters or 4017B counters can be used to divide the frequency of pulses from the encoder.
As an example, you coul drive a separate "timing pulley" that is adjusted to the "timing pulley" spins at the same speed as the spindle, then install an encoder onto that.
4520B counters or 4017B counters can be used to divide the frequency of pulses from the encoder.
The following user(s) said Thank You: vre
Please Log in or Create an account to join the conversation.
- vre
- Offline
- Platinum Member
-
Less
More
- Posts: 644
- Thank you received: 17
21 Apr 2025 13:59 #326810
by vre
Replied by vre on topic spindle with encoder
To mechanically adjust the exact same ratio is very difficult
Also with counter chips division maybe can not be integer multiple
so the only real option is to mount and aluminum disk to spindle shaft
and because my spindle shaft from top has the hydraulic cylinder that locks the tool
the only place can put this is only to the downside of spindle shaft.
How many lines must have the disc for rigid tapping ?
Also must have disc with A B and Z signals or only A is enough ?
Also with counter chips division maybe can not be integer multiple
so the only real option is to mount and aluminum disk to spindle shaft
and because my spindle shaft from top has the hydraulic cylinder that locks the tool
the only place can put this is only to the downside of spindle shaft.
How many lines must have the disc for rigid tapping ?
Also must have disc with A B and Z signals or only A is enough ?
Please Log in or Create an account to join the conversation.
Time to create page: 0.082 seconds