0-10V output for spindle speed control is not working
13 Nov 2023 06:11 #285234
by Gurt
0-10V output for spindle speed control is not working was created by Gurt
Hello guys,I am using a chinese BOB 5 axis with an 0-10V analog output to control the spindle speed.In the VDF side, everything is ok.I modify my HAL file in the way I found on the forum but the output is always at 10V and I don't know how to do.In Linuxcnc, the start function of the spindle is working but when I want to increase of decrease via the and - button, nothing happens... the displayed speed is always 0 and the output voltage always at 10V.Maybe I do wrong in Linuxcnc and my HAL is ok...Any help woulb be much appreciated.Regards,Nicolas
Attachments:
Please Log in or Create an account to join the conversation.
13 Nov 2023 15:08 #285267
by andypugh
You might want to use motion.spindle-speed-out-rpm (or use 24000/60 for the scale) as motion.spindle-speed-out is in revs per second.
However I don't think that is the issue.
You could try lookng at the parport HAL pin with the Halscope tool, to see if the PWM is getting that far.
I think that many of these Chinese BOB boards need the USB connection to supply 5V to generte the 0-10V. Do you have that connected?
Replied by andypugh on topic 0-10V output for spindle speed control is not working
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-01-out
setp pwmgen.0.scale 24000
You might want to use motion.spindle-speed-out-rpm (or use 24000/60 for the scale) as motion.spindle-speed-out is in revs per second.
However I don't think that is the issue.
You could try lookng at the parport HAL pin with the Halscope tool, to see if the PWM is getting that far.
I think that many of these Chinese BOB boards need the USB connection to supply 5V to generte the 0-10V. Do you have that connected?
Please Log in or Create an account to join the conversation.
13 Nov 2023 16:08 - 13 Nov 2023 16:27 #285277
by Gurt
Replied by Gurt on topic 0-10V output for spindle speed control is not working
Hello Andy, these BOB cards need a 12 or 24V for this 0-10V output and the 5V USB is for the card itself. I have both.
In the VDF side, I can start and stop from external switch and also change speed using an external 0-10V so the problem is between Linux and the BOB. When I try the Halmeter command, I've got an error (errno=2)... and if I put motion.spindle-speed-out-rpm there is an error (command doesn't exist).
Thanks a lot
In the VDF side, I can start and stop from external switch and also change speed using an external 0-10V so the problem is between Linux and the BOB. When I try the Halmeter command, I've got an error (errno=2)... and if I put motion.spindle-speed-out-rpm there is an error (command doesn't exist).
Thanks a lot
Last edit: 13 Nov 2023 16:27 by Gurt.
Please Log in or Create an account to join the conversation.
13 Nov 2023 16:24 #285279
by Gurt
Replied by Gurt on topic 0-10V output for spindle speed control is not working
my HAL is based on this example :
1.2 PWM Spindle Speed
If your spindle can be controlled by a PWM signal, use the pwmgen component to create the signal:
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
# Set the spindle's top speed in RPM
setp pwmgen.0.scale 1800
This assumes that the spindle controller's response to PWM is simple: 0% PWM gives 0RPM, 10% PWM gives 180 RPM, etc. If there is a minimum PWM required to get the spindle to turn, follow the example in the nist-lathe sample configuration to use a scale component.
1.2 PWM Spindle Speed
If your spindle can be controlled by a PWM signal, use the pwmgen component to create the signal:
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-09-out
# Set the spindle's top speed in RPM
setp pwmgen.0.scale 1800
This assumes that the spindle controller's response to PWM is simple: 0% PWM gives 0RPM, 10% PWM gives 180 RPM, etc. If there is a minimum PWM required to get the spindle to turn, follow the example in the nist-lathe sample configuration to use a scale component.
Please Log in or Create an account to join the conversation.
14 Nov 2023 15:35 #285389
by Gurt
Replied by Gurt on topic 0-10V output for spindle speed control is not working
Hello, I create a free install of LinuxCNC with version 2.9.1 and went true stepconf. I put this on the custom.hal :
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd spindle.0.speed-out => pwmgen.0.value
net spindle-on spindle.0.on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-01-out
# Set the spindle's top speed in RPM
setp pwmgen.0.scale 24000
Now I can start and stop the Spindle and also change the speed via the + or - button (Axis screen selected during stepconf option).
The problem is that to reduce speed, I have to click on + (it is inverted) and the speed is not displayed in LinuxCNC...
Is it possible to display the speed by using the pwm signal ? How can I invert + and - ?
Thank you
loadrt pwmgen output_type=0
addf pwmgen.update servo-thread
addf pwmgen.make-pulses base-thread
net spindle-speed-cmd spindle.0.speed-out => pwmgen.0.value
net spindle-on spindle.0.on => pwmgen.0.enable
net spindle-pwm pwmgen.0.pwm => parport.0.pin-01-out
# Set the spindle's top speed in RPM
setp pwmgen.0.scale 24000
Now I can start and stop the Spindle and also change the speed via the + or - button (Axis screen selected during stepconf option).
The problem is that to reduce speed, I have to click on + (it is inverted) and the speed is not displayed in LinuxCNC...
Is it possible to display the speed by using the pwm signal ? How can I invert + and - ?
Thank you
Please Log in or Create an account to join the conversation.
14 Nov 2023 17:22 #285397
by PCW
Replied by PCW on topic 0-10V output for spindle speed control is not working
Does setting the spindle speed to say 1000 ( MDI M3 s1000 )
give you a ~1000 RPM spindle speed?
give you a ~1000 RPM spindle speed?
The following user(s) said Thank You: Gurt
Please Log in or Create an account to join the conversation.
15 Nov 2023 08:09 - 15 Nov 2023 08:19 #285470
by Gurt
Replied by Gurt on topic 0-10V output for spindle speed control is not working
Hello PCW, MDI M3 s1000 shows 1000rpm on LinuxCNC but my output voltage is about 9.25V instead of about 0.75, so the spindle speed is about 21'800rpm.
To solve my problem, I have to invert the duty cycle of my pwm... but how?
Probably something to set in my custom.hal where my pwmgen is set
To solve my problem, I have to invert the duty cycle of my pwm... but how?
Probably something to set in my custom.hal where my pwmgen is set
Last edit: 15 Nov 2023 08:19 by Gurt.
Please Log in or Create an account to join the conversation.
15 Nov 2023 11:22 #285488
by PCW
Replied by PCW on topic 0-10V output for spindle speed control is not working
Probably something like:
setp parport.0.pin-01-out-invert true
setp parport.0.pin-01-out-invert true
Please Log in or Create an account to join the conversation.
15 Nov 2023 12:25 - 15 Nov 2023 12:27 #285492
by Gurt
Replied by Gurt on topic 0-10V output for spindle speed control is not working
Thank you so much, it works with this extra line in my custom.hal !!!!
Other questions :
- to go from 0V to 10V it takes a while (due to the converter on the BOB probably ; or a parameter in pwgen...)
- the "Spindle-at-speed" indicator is stuck green, I have to look about that...
Once all my problem solved, I will do a "quick help" for other users who have problems to drive the spindle with these chinese BOB
Other questions :
- to go from 0V to 10V it takes a while (due to the converter on the BOB probably ; or a parameter in pwgen...)
- the "Spindle-at-speed" indicator is stuck green, I have to look about that...
Once all my problem solved, I will do a "quick help" for other users who have problems to drive the spindle with these chinese BOB
Last edit: 15 Nov 2023 12:27 by Gurt.
Please Log in or Create an account to join the conversation.
Time to create page: 0.083 seconds