No Closed-Loop Spindle Control with Working Encoder

More
02 Jun 2023 03:20 #272672 by mor
I'm using a 7i92 + 2x 5-axis Chinese BOBs and everything is wired up and working fine. 

The spindle is controlled using the BOB 0-10V analog output (converts the PWM signal to analog) and I'm using an analog-analog optoisolator to bypass my KBIC speed controller potentiometer.  The input of the optoisolator goes from 0-10V but the output only goes up to ~8.5V which is fine for me as it reaches near the maximum spindle RPM that I'm targeting.  I Just had to change the OUTPUT_SCALE to 15400 for 100% to equate to 9750 rpm.

I have a Masso optical encoder (quadtrature) connected to the BOB pins 11-13 and all the signals are working correctly when I manually turn the spindle. The RPM reading is very erratic until I changed the counter-mode to TRUE; not sure why but I can live with this since I don't really need the indexing.  I would like to fix it if possible.  I have changed the ENCODER_SCALE to -7 since the rpm was reversed.  It's reading correctly as compared to a tachometer I am using to verify.

I tried to perform a PID tuning process of increasing P until oscillation but all it does is increase the speed and I never hit any oscillation.  My pid.s.feedback always shows 0, not sure if this is normal.  Basically, I don't see any closed-loop control happening at all.  Any advise or suggestions would be greatly appreciated.

Thx, Mor
Attachments:

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

More
06 Jun 2023 23:29 #273044 by mor
Any ideas? I’m stuck right now. Any help much appreciated. Thanks!

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

More
07 Jun 2023 00:09 #273045 by tommylight
What PPR encoder?
What is the base period set at in the ini file?
Is the encoder wired to BOB?
Are you using a VFD or a servo drive for the spindle?
The following user(s) said Thank You: mor

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

More
07 Jun 2023 00:28 - 07 Jun 2023 00:52 #273047 by PCW
The signal spindle-vel-fb-rpm-abs is unconnected (so always 0)

This is a pncconf bug, it should create that signal from the output
of the absolute function, something like:


loadrt abs
addf abs.0 servo-thread
net spindle-vel-fb-rpm abs.0.in
net spindle-vel-fb-rpm-abs abs.0.out
Last edit: 07 Jun 2023 00:52 by PCW.
The following user(s) said Thank You: mor

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

More
07 Jun 2023 04:17 - 07 Jun 2023 04:18 #273057 by mor

What PPR encoder?

7

What is the base period set at in the ini file?

setp    [HMOT](CARD0).pwmgen.pwm_frequency 250
setp    [HMOT](CARD0).pwmgen.pdm_frequency 6000000
setp    [HMOT](CARD0).watchdog.timeout_ns 10000000


Is the encoder wired to BOB?

Yes, 5-axis Chinese BOB (ST-v2)

Are you using a VFD or a servo drive for the spindle?

Neither; using 0-10V directly to potentiometer inputs.

 

Last edit: 07 Jun 2023 04:18 by mor. Reason: Highlight

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

More
07 Jun 2023 04:22 - 07 Jun 2023 04:31 #273058 by mor

The signal spindle-vel-fb-rpm-abs is unconnected (so always 0)This is a pncconf bug, it should create that signal from the outputof the absolute function, something like:loadrt absaddf abs.0 servo-threadnet spindle-vel-fb-rpm abs.0.innet spindle-vel-fb-rpm-abs abs.0.out 

That explains the open loop.  
I'm not that great with HAL editing nor how the PID and spindle pins/parameters are supposed to be set up.
Can you explain how I should implement the above code?
Attached is the HAL provided by PNCConf and I added the lines you provided.  I now get pid.s.feedback with some values.

Attachments:
Last edit: 07 Jun 2023 04:31 by mor.

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

More
07 Jun 2023 06:06 #273062 by mor
Thanks for all the assistance. I got the closed-loop spindle control working now and did some preliminary PID tuning so I can use the entire RPM range.

Not sure about the quadrature encoder issues I'm having but with counter-mode it's working. I think this'll be good enough for now.

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

More
07 Jun 2023 16:14 #273084 by PCW
If quadrature mode is not working well, it suggests that there is significant
quadrature distortion in the encoder (duty cycle not 50% and A-B phase
difference not 90 degrees)

You can check this by running at a constant low speed and plotting the
A/B encoder inputs in halscope
The following user(s) said Thank You: mor

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

Moderators: cmorley
Time to create page: 0.088 seconds
Powered by Kunena Forum