encoder.N.velocity-rpm

More
02 Sep 2024 19:46 - 02 Sep 2024 19:49 #309224 by greg23_78
I need a little help, I can't get the spindle speed in rpm.

I have a 1024 pulse/revolution encoder on the spindle
The encoder A phase is connected to the hm2_7i97.0.7i84.0.0.input-28
The encoder index pulse is connected to the hm2_7i97.0.7i84.0.0.input-30
I have the impression that my encoder transmits the pulses correctly, but the value of low.pass.0.out and encoder.0.velocity-rpm is not fixed and displays values from 3 to 19 for a rotation speed of 500 RPM.

what do I need to change ?

 

INI
[SPINDLE_0]
P = 0
I = 0
D = 0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 2554
ENCODER_SCALE = 1024
OUTPUT_SCALE = 2554
OUTPUT_MIN_LIMIT = 0
OUTPUT_MAX_LIMIT = 2600

HAL
# Axis: SPINDLE Joint: 5 Output: 5

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
setp   pid.s.maxoutput [SPINDLE_0]MAX_OUTPUT
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      =>  pid.s.feedback
net spindle-output          <=  pid.s.output

# ---PWM Generator signals/setup---

setp   hm2_[MESA](BOARD).0.pwmgen.05.scale  [SPINDLE_0]OUTPUT_SCALE
setp   hm2_[MESA](BOARD).0.pwmgen.05.output-type 1
setp   hm2_[MESA](BOARD).0.pwmgen.05.offset-mode 1

# ---Encoder feedback signals/setup---

setp    encoder.3.position-scale  [SPINDLE_0]ENCODER_SCALE
setp    encoder.3.counter-mode    true

net spindle-position        encoder.3.position      =>      spindle.0.revs
#net spindle-velocity        encoder.3.velocity      =>      spindle.0.speed-in

setp scale.0.gain 60
setp lowpass.0.gain 1.2

net spindle-velocity-rps                        encoder.3.velocity => scale.0.in
net spindle-velocity-rpm                        scale.0.out => abs.0.in
net spindle-velocity-rpm-abs                    abs.0.out => lowpass.0.in
net spindle-velocity-rpm-abs-filtered           lowpass.0.out 

net spindle-index-enable    encoder.3.index-enable  <=>     spindle.0.index-enable

net spindle-phase-a     encoder.3.phase-A <= hm2_7i97.0.7i84.0.0.input-28
net spindle-phase-b     encoder.3.phase-B
net spindle-index       encoder.3.phase-Z <= hm2_7i97.0.7i84.0.0.input-30

# ---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-at-speed           =>  spindle.0.at-speed


# ---Setup spindle at speed signal

net spindle-cw              => hm2_7i97.0.7i84.0.0.output-05
net spindle-ccw             => hm2_7i97.0.7i84.0.0.output-06
net spindle-output          => hm2_7i97.0.pwmgen.05.value
net spindle-enable          => hm2_7i97.0.pwmgen.05.enable
Attachments:
Last edit: 02 Sep 2024 19:49 by greg23_78.

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

More
02 Sep 2024 20:03 #309226 by PCW
Replied by PCW on topic encoder.N.velocity-rpm
You would normally use a 7i97 encoder for this:

net spindle-vel-fb-rps       <=   hm2_[MESA](BOARD).0.encoder.05.velocity

net spindle-vel-fb-rpm       <=  hm2_[MESA](BOARD).0.encoder.05.velocity-rpm


 

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

More
02 Sep 2024 22:01 #309235 by greg23_78
Replied by greg23_78 on topic encoder.N.velocity-rpm
thank you, it works perfectly except for the spindle speed pyvcp and spindle at speed led, which do not work.
in halcmd spindle at speed work.

in which file are they affected, i created my config with mesact ?

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

More
03 Sep 2024 03:44 #309250 by PCW
Replied by PCW on topic encoder.N.velocity-rpm
If you post your hal and ini files, I can take a look.

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

More
03 Sep 2024 06:19 #309265 by greg23_78
Replied by greg23_78 on topic encoder.N.velocity-rpm
HAL
 

File Attachment:

File Name: main_2024-09-03-2.hal
File Size:12 KB


INI
 

File Attachment:

File Name: cnc_samua_...03-2.ini
File Size:3 KB


IO
 

File Attachment:

File Name: io_2024-09-03-2.hal
File Size:0 KB
Attachments:

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

More
03 Sep 2024 14:56 #309292 by PCW
Replied by PCW on topic encoder.N.velocity-rpm
I'm no pyvcp expert but I don't see any connections from
spindle-at-speed or the actual spindle speed to pyvcp pins

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

Time to create page: 0.082 seconds
Powered by Kunena Forum