Spindle speed and instatnly powered led
- _skinner
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 1
01 Jan 2025 13:00 #317774
by _skinner
Spindle speed and instatnly powered led was created by _skinner
Hello,
I have little troubles with my spindle, I have to S1200 to get 12000RPM, S1800 to get 18000RPM etc, i tried many things with parameters but without results:
Generally PWM signal from motion controller card drive a 0-10V signal to spindle, when scale set to 24000 it won't work at all.
MAX_OUTPUT = 24000.0
OUTPUT_SCALE = 1
OUTPUT_MIN_LIMIT = 5000
OUTPUT_MAX_LIMIT = 24000
hal:
net spindle-pid-out pid.s.output => scale.gear.in
setp scale.gear.gain 0.00035
net spindle-output <= scale.gear.out
setp hm2_7c81.0.pwmgen.01.output-type 1
setp hm2_7c81.0.pwmgen.01.scale [SPINDLE_0]OUTPUT_SCALE
net spindle-output => hm2_7c81.0.pwmgen.01.value
net spindle-enable => hm2_7c81.0.pwmgen.01.enable
net spindle-at-speed <= hm2_7c81.0.gpio.051.in_not
second thing I like to drive LED in qtdragon_hd which is instantly powered on after spindle enable:
in ini file in DISPLAY section I've added :
USER_COMMAND_FILE = CONFIGFOLDER/qtdragonrc.py
and code in file:
print('\nUser command file for following spindle.0.at_speed\n')
# needed to instance patch
# reference: ruivieira.dev/python-monkey-patching-for-readability.html
import types
# import the handlerfile to get reference to it's libraries.
# use <screenname>_handler
import qtdragon_handler as SELF
###############################################
# add hook to add a status request
###############################################
def before_loop__(self):
try:
#self.w.led_at_speed.setProperty('halpin_option',False)
self.w.led_at_speed.setProperty('follow_halpin_state',True)
self.w.led_at_speed.setProperty('halpin_name','spindle.0.at-speed')
self.w.led_at_speed. _hal_init()
except Exception as e:
pass
# Here we are instance patching the original handler file to add a new
# function that calls our new function (of the same name)
# defined in this file
self.before_loop__ = types.MethodType(before_loop__, self)
but led won't work (i tried 'self.w.led_at_speed' and 'self.w.hal_led_atspeed'), i have simple relay to inform that spindle reach speed, which is working correctly but only led on screen not working
Thank You in advance for help
I have little troubles with my spindle, I have to S1200 to get 12000RPM, S1800 to get 18000RPM etc, i tried many things with parameters but without results:
Generally PWM signal from motion controller card drive a 0-10V signal to spindle, when scale set to 24000 it won't work at all.
MAX_OUTPUT = 24000.0
OUTPUT_SCALE = 1
OUTPUT_MIN_LIMIT = 5000
OUTPUT_MAX_LIMIT = 24000
hal:
net spindle-pid-out pid.s.output => scale.gear.in
setp scale.gear.gain 0.00035
net spindle-output <= scale.gear.out
setp hm2_7c81.0.pwmgen.01.output-type 1
setp hm2_7c81.0.pwmgen.01.scale [SPINDLE_0]OUTPUT_SCALE
net spindle-output => hm2_7c81.0.pwmgen.01.value
net spindle-enable => hm2_7c81.0.pwmgen.01.enable
net spindle-at-speed <= hm2_7c81.0.gpio.051.in_not
second thing I like to drive LED in qtdragon_hd which is instantly powered on after spindle enable:
in ini file in DISPLAY section I've added :
USER_COMMAND_FILE = CONFIGFOLDER/qtdragonrc.py
and code in file:
print('\nUser command file for following spindle.0.at_speed\n')
# needed to instance patch
# reference: ruivieira.dev/python-monkey-patching-for-readability.html
import types
# import the handlerfile to get reference to it's libraries.
# use <screenname>_handler
import qtdragon_handler as SELF
###############################################
# add hook to add a status request
###############################################
def before_loop__(self):
try:
#self.w.led_at_speed.setProperty('halpin_option',False)
self.w.led_at_speed.setProperty('follow_halpin_state',True)
self.w.led_at_speed.setProperty('halpin_name','spindle.0.at-speed')
self.w.led_at_speed. _hal_init()
except Exception as e:
pass
# Here we are instance patching the original handler file to add a new
# function that calls our new function (of the same name)
# defined in this file
self.before_loop__ = types.MethodType(before_loop__, self)
but led won't work (i tried 'self.w.led_at_speed' and 'self.w.hal_led_atspeed'), i have simple relay to inform that spindle reach speed, which is working correctly but only led on screen not working
Thank You in advance for help
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17994
- Thank you received: 4838
01 Jan 2025 15:02 #317779
by PCW
Replied by PCW on topic Spindle speed and instatnly powered led
The scale is odd because you have the .00035 scale factor (so the full scale value (to get PWM=1) is 2857 )
Do you need the scale component? Eliminating it and setting the output scale to 24000 would certainly
simplify debugging.
With the existing scaling, setting the output scale (and max output) to 8.4 should be about right:
MAX_OUTPUT = 8.4
OUTPUT_SCALE = 8.4
OUTPUT_MIN_LIMIT = 1.75
OUTPUT_MAX_LIMIT = 8.4
But why would you do that?
MAX_OUTPUT = 24000.0
OUTPUT_SCALE = 24000
OUTPUT_MIN_LIMIT = 5000
OUTPUT_MAX_LIMIT = 24000
and no scale component is 100% easier to understand
Do you need the scale component? Eliminating it and setting the output scale to 24000 would certainly
simplify debugging.
With the existing scaling, setting the output scale (and max output) to 8.4 should be about right:
MAX_OUTPUT = 8.4
OUTPUT_SCALE = 8.4
OUTPUT_MIN_LIMIT = 1.75
OUTPUT_MAX_LIMIT = 8.4
But why would you do that?
MAX_OUTPUT = 24000.0
OUTPUT_SCALE = 24000
OUTPUT_MIN_LIMIT = 5000
OUTPUT_MAX_LIMIT = 24000
and no scale component is 100% easier to understand
Please Log in or Create an account to join the conversation.
- _skinner
- Offline
- New Member
Less
More
- Posts: 10
- Thank you received: 1
01 Jan 2025 16:47 #317784
by _skinner
Replied by _skinner on topic Spindle speed and instatnly powered led
Your remedy is working as it should and now i can set correct value, thank You. But I forgotten to tell that linearity of voltage 0-10V is terrible, I used scale for make it "more linear" and that works like a charm. Before on raspberry pi 4 i didn't noticed that strange behavior, it was simple as that to calculate resolution etc, but I also didn't use qtdragon display, when I switched to rpi5 then I noticed those strange things.
Now I bend it little by cheat real max rpm so its almost fit, but I don't like doing things in a slapdash way.
Below table how analog output voltage works for me...
value [RPM] / VFD frequency [Hz] / Uout [V] .
3000 30 0.8
6000 93 2.36
12000 220 5.6
18000 350 8.6
20000 396 9.6
21000 400 9.7
Now I bend it little by cheat real max rpm so its almost fit, but I don't like doing things in a slapdash way.
Below table how analog output voltage works for me...
value [RPM] / VFD frequency [Hz] / Uout [V] .
3000 30 0.8
6000 93 2.36
12000 220 5.6
18000 350 8.6
20000 396 9.6
21000 400 9.7
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17994
- Thank you received: 4838
01 Jan 2025 18:29 #317794
by PCW
Replied by PCW on topic Spindle speed and instatnly powered led
Depending on your breakout card, you may get better linearity by lowering the PWM frequency
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.056 seconds