Tweaking spindle speed and spindle at speed PWM

More
18 Oct 2018 12:39 #118992 by sharpshooterser
With a lot of help from Andy I managed to make my BOB correlate with SPINx1 and to get the spindle working through VFD.

Now, my spindle speeds up to full speed slowly, and I wanted to insert spindle-at-speed option into HAL. I followed the instructions found online, but I get error messages, until I use a file like one attached (pc5.hal attached). And then, tool starts cutting even if the spindle isnt at full speed. I guess that hal has to be modified some more - its missing something.

Second problem - when I issue M3 command in MDI, spindle starts to turn. It also starts to turn if I use subroutines. However, if I start a saved gcode, with M3 Sxxxx command, spindle stays still (example ngc attached). I guess that is something simple, I just fail to see it.

Third problem, fine tuning the pwm. My spindle motor is capable of 2715 rpm. Pulley is calculated to correspond to max 2500 rpm. However I enter those values in hal, I cant get over 2000 rpm. Also, If I issue S500 I get 500 rpm. If I issue s1000 I get 1100 rpm. S1500 I get 1800 (and that is about max). Can I do something to get those values a bit closer (setting up a 25% near margin seems a bit much?).
pc5-old.hal is the first setup that gave sign of life for controls.
Any advice is appreciated.
Attachments:

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

More
18 Oct 2018 19:38 #119016 by sharpshooterser
also, my threading cycle isnt working. I get the readout on the spindle speed, but the tool advances to the start point and just sits there.

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

More
18 Oct 2018 20:49 #119019 by sharpshooterser
and here is the complete folder, including custom hal (that might interfere with proper operation)

File Attachment:

File Name: pc5_2018-10-18.rar
File Size:6 KB
Attachments:

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

More
19 Oct 2018 10:43 #119071 by andypugh
I can't open .rar files, but the earlier HAL file has a number of issues.

There are some duplicated lines. This probably won't cause an error, but isn't right either.

The "near" component is connected to the "spindle-cmd" signal, but I don't see another "end" to that signal and the near.0.out doesn't go anywhere.

That section of the HAL probably needs to be
loadrt near
addf near.0 servo-thread
net spindle-cmd-rps => near.0.in1
net spindle-velocity-feedback-rps => near.0.in2
net spindle-at-speed near.0.out motion.spindle-at-speed

I see no sign of any attempt to allow forward/reverse control of the spindle.

Note that pwmgen type 0 will give no output for negative inputs, so you should be connecting the absolute version of the spindle command.
net net spindle-cmd-rpm-abs  => pwmgen.0.value

Or, better, use pwmgen type 2, and connect the pwmgen.dir pin to an output pin to control the direction (and then you must _not_ use the absolute seed command)

Which IO pin is connected to the SPIN1x direction pin?

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

More
29 Oct 2018 11:56 #119585 by sharpshooterser
Thanks to Andy, my hal and ini are configured properly, and PWM is functional.
I had to change "setp lowpass.0.gain 1.000000" from 1 to 0.01 to get more clear reading of rpm, and g76 is also functional.

now, I wanted to tweak the speed given with S command to match the out speed, and I found a lincurve, so I tried to implement that into hal, but I get an error message on startup

#lincurve

loadrt lincurve personality=6
addf lincurve.0 servo-thread
setp lincurve.0.x-val 00 0
setp lincurve.0.y-val 00 0
setp lincurve.0.x-val 00 250
setp lincurve.0.y-val 00 185
setp lincurve.0.x-val 00 500
setp lincurve.0.y-val 00 460
setp lincurve.0.x-val 00 750
setp lincurve.0.y-val 00 745
setp lincurve.0.x-val 00 1000
setp lincurve.0.y-val 00 1055
setp lincurve.0.x-val 00 1500
setp lincurve.0.y-val 00 1765

net spindle-raw-motion.spindle-out => lincurve.0.in
net spindle-corrected lincurve.0.out => pwmgen.0.in

but I get error for "pwmgen.0.in pin" (input speeds are 250,500,750,1000,1500 and speeds achieved are 185,460,745,1055 and 1765)
what did I miss?
Attachments:

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

More
29 Oct 2018 12:34 - 29 Oct 2018 12:35 #119587 by andypugh
The pin is "pwmgen.0.value"

You already have a signal connected to that, so you will need to make a couple of changes.

Currently you have:
net spindle-cmd-rpm     <= motion.spindle-speed-out
...
net spindle-cmd-rpm => pwmgen.0.value

So you need to change the signal name in both places and insert the lincurve
net spindle-cmd-rpm-raw <= motion.spindle-speed-out
net spindle-cmd-rpm-raw => lincurve.0.in
...
net spindle-cmd-rpm-corr <= lincurve.0.out
net spindle-cmd-rpm-corr => pwmgen.0.value
Last edit: 29 Oct 2018 12:35 by andypugh.

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

More
29 Oct 2018 15:30 #119600 by sharpshooterser
got it. It works now. Thanks!

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

Time to create page: 0.232 seconds
Powered by Kunena Forum