Spindle mapping to 0-10v

More
27 Oct 2022 14:37 #255198 by karnalta
Hello all,

How can I map my output voltage for spindle control in a "clamped" way ?

My VFD is setup as follow (to avoid running the spindle lower than 200hz) :
0v = 200hz -> 12000RPM
10v = 400hz -> 24000RPM

At the moment my HAL is outputting 0v-10v for a speed of 0RPM to 24000RPM. So my M3 command has incorrect speed.
I am quite new to HAL setup file so I cannot figure it by myself.

Here is my actual file :

loadrt pwmgen output_type=1
addf pwmgen.update servo-thread

net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 0.0
setp pwmgen.0.scale 24000
setp pwmgen.0.offset 0.05
setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm     <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps     <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed    => spindle.0.at-speed

setp parport.0.pin-01-out-invert true 
net spindle-pwm     => parport.0.pin-01-out

Thank for help.

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

More
27 Oct 2022 15:58 - 27 Oct 2022 16:01 #255201 by PCW
Replied by PCW on topic Spindle mapping to 0-10v
What if you set the PWM offset to -12000 and PWM scale to 12000?

Edit: I think its -0.5 for the offset as offset is added to the scaled PWM
Last edit: 27 Oct 2022 16:01 by PCW.

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

More
27 Oct 2022 17:49 #255212 by karnalta
Replied by karnalta on topic Spindle mapping to 0-10v
You were not far, it's giving good result with scale at 12000 and offset at -1.0.

It's just not working for speed under 12000 because of the absolute value but it's not a problem.

M3 S12000 = (12000/12000) - 1 = 0v => 200hz
M3 S18000 = (18000/12000) - 1 = 5v => 300hz
M3 S24000 = (24000/12000) - 1 = 10v => 400hz

But :

M3 S6000 = (6000/12000) - 1 = abs(-0.5) => 5v => 300hz, while it would have been better if it stay at 200hz.

Thank you for your help, you pointed me out in the right direction !

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

More
27 Oct 2022 17:57 #255215 by PCW
Replied by PCW on topic Spindle mapping to 0-10v
Another option would to setup the VFD without an offset (0=0 RPM),
set the PWM scaling to 24000, no offset but set the PWM minimum DC to 0.5
This way, any RPM <12000 would give you a 12000 PWM value

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

More
27 Oct 2022 19:09 #255224 by karnalta
Replied by karnalta on topic Spindle mapping to 0-10v

Another option would to setup the VFD without an offset (0=0 RPM),
set the PWM scaling to 24000, no offset but set the PWM minimum DC to 0.5
This way, any RPM <12000 would give you a 12000 PWM value
 

How can I set this minimal value ?
 

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

More
27 Oct 2022 19:26 #255226 by PCW
Replied by PCW on topic Spindle mapping to 0-10v
I don't recall off-hand but

man pwmgen

will help
The following user(s) said Thank You: karnalta

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

More
27 Oct 2022 20:48 #255240 by HansU
Replied by HansU on topic Spindle mapping to 0-10v

Another option would to setup the VFD without an offset (0=0 RPM),
set the PWM scaling to 24000, no offset but set the PWM minimum DC to 0.5
This way, any RPM <12000 would give you a 12000 PWM value
 

But in this case you would only use half of the scale, so you would loose half of the resolution if I understood you correctly.

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

More
27 Oct 2022 20:57 #255242 by HansU
Replied by HansU on topic Spindle mapping to 0-10v

Another option would to setup the VFD without an offset (0=0 RPM),
set the PWM scaling to 24000, no offset but set the PWM minimum DC to 0.5
This way, any RPM <12000 would give you a 12000 PWM value
 
How can I set this minimal value ?

 

You can try with limit1: linuxcnc.org/docs/2.9/html/man/man9/limit1.9.html
I could imagine that it works if you use this as the first block in your signal chain and limit the speed that is coming from the S word by setting limit1.0.min to 6000.
The following user(s) said Thank You: karnalta

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

Time to create page: 0.122 seconds
Powered by Kunena Forum