7i96S Analog Spindle

More
09 Feb 2023 02:40 #264092 by PCW
Replied by PCW on topic 7i96S Analog Spindle
It looks OK (except you have not connected the pwmgen to new_offset_spindle_signal)

I would trace the signals in halshow

Scale does the expected thing here:

halcmd: loadrt scale
halcmd: addf scale.0 servo-thread
halcmd: show pin scale.0.
Component Pins:
Owner Type Dir Value Name
55 float IN 0 scale.0.gain
55 float IN 0 scale.0.in
55 float IN 0 scale.0.offset
55 float OUT 0 scale.0.out
55 s32 OUT 144 scale.0.time

halcmd: setp scale.0.gain 1
halcmd: setp scale.0.offset 2222
halcmd: getp scale.0.out
2222
halcmd: setp scale.0.in 2222
halcmd: getp scale.0.out
4444

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

More
09 Feb 2023 23:08 #264179 by andypugh
Replied by andypugh on topic 7i96S Analog Spindle
You still have
net spindle-vel-cmd-rpm     => hm2_7i96s.0.pwmgen.00.value

You need:

[code]
net new_offset_spindle_signal scale.0.out (already in the file)
net new_offset_spindle_signal hm2_7i96s.0.pwmgen.00.value[/quote]

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

More
10 Feb 2023 03:27 #264195 by reynolds087
Replied by reynolds087 on topic 7i96S Analog Spindle
Thanks for the reply. I tried your suggestion, but it still does not seem to be working. Do you see anything wrong with my code?

#*******************
# 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
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-abs => pid.s.feedback
net spindle-output <= pid.s.output

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

setp hm2_7i96s.0.pwmgen.00.output-type 1
setp hm2_7i96s.0.pwmgen.00.scale [SPINDLE_0]OUTPUT_SCALE


#net spindle-vel-cmd-rpm => hm2_7i96s.0.pwmgen.00.value
net spindle-enable => hm2_7i96s.0.pwmgen.00.enable

# ---Custom Spindle PWM Scaling ---

loadrt scale
addf scale.0 servo-thread
setp scale.0.gain 1
setp scale.0.offset 2222
# 2222 = 1V if 11111 = 5V
net spindle-vel-cmd-rpm scale.0.in
net new_offset_spindle_signal scale.0.out
net new_offset_spindle_signal => hm2_7i96s.0.pwmgen.00.value

# ---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

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

More
10 Feb 2023 14:12 #264224 by PCW
Replied by PCW on topic 7i96S Analog Spindle
Can you post your hal and ini files and also the results of:

halcmd show all | grep spindle > spindle.txt

When LinuxCNC is running and you have the spindle enabled and set for say 1/2 of full speed

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

More
11 Feb 2023 21:34 #264320 by reynolds087
Replied by reynolds087 on topic 7i96S Analog Spindle
Thanks, PCW. Files attached.

 
Attachments:

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

More
16 Feb 2023 00:19 #264590 by reynolds087
Replied by reynolds087 on topic 7i96S Analog Spindle
Any update on this?

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

More
16 Feb 2023 16:15 #264628 by PCW
Replied by PCW on topic 7i96S Analog Spindle
It looks about right, what is your issue?
Did you measure the output voltage? (with no connected load)

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

More
16 Feb 2023 23:50 #264674 by reynolds087
Replied by reynolds087 on topic 7i96S Analog Spindle
I am not getting any output from the spindle. It also seems to cause the remote desktop session to start lagging when I open LinuxCNC.

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

More
17 Feb 2023 00:57 - 17 Feb 2023 02:15 #264679 by PCW
Replied by PCW on topic 7i96S Analog Spindle
I would disconnect your spindle and use a voltmeter.

Edit: Just tried with your hal/ini files and the 7I96S
spindle out  works as expected with one surprise:

 M3 S1  ~1V out

M3 S5000 ~3.3V out

Surprise:

M3 S0 ~0V out

(because LinuxCNC turns the spindle off when at 0 speed
so the PWM is disabled (this could be fixed in hal if desired)
Last edit: 17 Feb 2023 02:15 by PCW.

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

More
17 Feb 2023 19:34 - 17 Feb 2023 19:40 #264717 by reynolds087
Replied by reynolds087 on topic 7i96S Analog Spindle
Ok, my spindle has not been connected during testing, but I'll test it again to be sure. I think it might be ok if the offset is only applied to non-zero spindle speeds. I'll need to see how my spindle reacts to that. If I recall, the offset was just to get the scaling right, because it starts rotating at 1v.

This is an E-bike motor that was controlled by a hall effect sensor in a throttle assembly, so it behaves in some strange ways. Maybe there is a dead zone intentionally set below 1v as a safety feature. I also have to turn on the spindle for 2 seconds before applying voltage or it won't start.

Has a lot of torque for the size, price point, and the RPM that it operates at, so I'd really like to get it working if possible.
Last edit: 17 Feb 2023 19:40 by reynolds087.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum