7i96 Configuration Tool

More
22 Nov 2019 18:26 #150957 by jools
Replied by jools on topic 7i96 Configuration Tool

Y

Basically:
spindle-speed-command => PID command
spindle-speed-feedback => PID feedback
PID-output => PWM value

Be aware of units. Use a revs-per-second spindle speed command, as encoder velocity is in revs-per-second.


So

that would be something like

net spindle_speed spindle.0.speed-out => pid.3.command for the first one (got the pin name from the bit in my hal that links motion to output.
Then I need to look and find the name of the spindle feedback pin and the PID feedback pin
Find the name the PID out put pin and the pwm value pin

The above would come before the standard PID settings / values

Then below all that would come the pwmgen settings I all ready have?

On daddy duty now but if that's correct I'll hunt for pin names later and see if I can figure this out.

Cheers

Jools

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

More
23 Nov 2019 11:36 #151036 by jools
Replied by jools on topic 7i96 Configuration Tool

Yes, this is a perfect application for a PID controller.

There is an example here: wiki.linuxcnc.org/cgi-bin/wiki.pl?Closed...pindle_Speed_Control

But it isn't a very good one.... It adds the PID output on to the spindle speed command. I presume this is because it is old and dates to a time before the PID component included feed-forward terms.

Basically:
spindle-speed-command => PID command
spindle-speed-feedback => PID feedback
PID-output => PWM value

(ie, the PID is inserted between the spindle command out and the PID command in)

Start with P, I, D all zero and adjust FF0 to give the right speed under no-load. Then adjust I (mainly) and some P to get good stiff speed control.

Be aware of units. Use a revs-per-second spindle speed command, as encoder velocity is in revs-per-second.


How does this look
# Spindle
setp hm2_7i96.0.pwmgen.00.output-type 1
setp hm2_7i96.0.pwmgen.00.scale [SPINDLE]MAX_RPM
setp hm2_7i96.0.pwmgen.pwm_frequency [SPINDLE]PWM_FREQUENCY

net spindle_on spindle.0.on hm2_7i96.0.pwmgen.00.enable hm2_7i96.0.ssr.00.out-05
net spindle_speed spindle.0.speed-out => pid.3.command
net spindle-speed-feedback hm2_7i96.0.encoder.00.velocity-rpm pid.3.feedback
net pid-output-command pid.3.output spindle.0.speed-out


setp pid.3.Pgain [SPINDLE]P
setp pid.3.Igain [SPINDLE]I
setp pid.3.Dgain [SPINDLE]D
setp pid.3.bias [SPINDLE]BIAS
setp pid.3.FF0 [SPINDLE]FF0
setp pid.3.FF1 [SPINDLE]FF1
setp pid.3.FF2 [SPINDLE]FF2
setp pid.3.deadband [SPINDLE]DEADBAND
setp pid.3.maxoutput [SPINDLE]MAX_RPM
setp pid.3.maxerror [SPINDLE]MAX_ERROR

Jools

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

More
23 Nov 2019 12:15 - 23 Nov 2019 12:16 #151039 by jools
Replied by jools on topic 7i96 Configuration Tool
That didn't work so changed to this and linuxcnc loads now. Just need to hook the servo to the encoder input.

Does this look right?
# Spindle
setp hm2_7i96.0.pwmgen.00.output-type 1
setp hm2_7i96.0.pwmgen.00.scale [SPINDLE]MAX_RPM
setp hm2_7i96.0.pwmgen.pwm_frequency [SPINDLE]PWM_FREQUENCY

net spindle_on spindle.0.on hm2_7i96.0.pwmgen.00.enable hm2_7i96.0.ssr.00.out-05
net spindle_speed spindle.0.speed-out => pid.3.command
net spindle-speed-feedback hm2_7i96.0.encoder.00.velocity-rpm pid.3.feedback
net pid-output-command pid.3.output hm2_7i96.0.pwmgen.00.value


setp pid.3.Pgain [SPINDLE]P
setp pid.3.Igain [SPINDLE]I
setp pid.3.Dgain [SPINDLE]D
setp pid.3.bias [SPINDLE]BIAS
setp pid.3.FF0 [SPINDLE]FF0
setp pid.3.FF1 [SPINDLE]FF1
setp pid.3.FF2 [SPINDLE]FF2
setp pid.3.deadband [SPINDLE]DEADBAND
setp pid.3.maxoutput [SPINDLE]MAX_RPM
setp pid.3.maxerror [SPINDLE]MAX_ERROR



Jools
Last edit: 23 Nov 2019 12:16 by jools.

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

More
30 Nov 2019 16:11 #151581 by Leon82
Replied by Leon82 on topic 7i96 Configuration Tool
The io.hal file says if you make changes you are screwed.

How does one invert the io pin?

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

More
30 Nov 2019 16:29 #151583 by PCW
Replied by PCW on topic 7i96 Configuration Tool
By changing

hm2_7i96.0.gpio.XXX.in

to

hm2_7i96.0.gpio.XXX.in_not
The following user(s) said Thank You: Leon82

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

More
30 Nov 2019 16:31 - 30 Nov 2019 16:36 #151584 by Leon82
Replied by Leon82 on topic 7i96 Configuration Tool

By changing

hm2_7i96.0.gpio.XXX.in

to

hm2_7i96.0.gpio.XXX.in_not


Ah, the underscore got me
One of my axis is reversed. In not quite sure the best way to invert it
Last edit: 30 Nov 2019 16:36 by Leon82.

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

More
30 Nov 2019 16:47 - 30 Nov 2019 16:58 #151585 by PCW
Replied by PCW on topic 7i96 Configuration Tool
If you are in doubt about pin or parameter names you can run

halcmd show all > all.txt

(with linuxcnc running) to get a list of all parameters, pins and signals

There are many ways to reverse a step motor direction:

1. swap one motor winding
2. reverse the direction pin wiring (use DIR- instead of DIR+ for example)
3. invert the direction pin in hal ( setp hm2_7i96.0.stepgen.XX.direction.invert_output true )
4. invert the stepgen scale
Last edit: 30 Nov 2019 16:58 by PCW.
The following user(s) said Thank You: Leon82

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

More
30 Nov 2019 16:57 - 30 Nov 2019 16:58 #151587 by Leon82
Replied by Leon82 on topic 7i96 Configuration Tool

If you are in doubt about pin or parameter names you can run

halcmd show all > all.txt

(with linuxcnc running) to get a list of all parameters, pins and signals

There are many ways to reverse a step motor direction
hm2_7i95.0.stepgen.00.direction.invert_output
1. swap one motor winding
2. reverse the direction pin wiring (use DIR- instead of DIR+ for example)
3. invert the direction pin in hal ( setp hm2_7i96.0.stepgen.XX.direction.invert_output true )
4. invert the stepgen scale


Thank you, I inverted the scale
Last edit: 30 Nov 2019 16:58 by Leon82.

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

More
30 Nov 2019 18:35 #151594 by Leon82
Replied by Leon82 on topic 7i96 Configuration Tool
When setting the external estop on input 0 I left the joint as select.

It is not tied to CNC however. Other hal files I have found had a couple extra lines under the estop section but I got a pin already defined error when I added them.

I've found some other Hal examples where an external estop was referenced but they were for a plasma machine

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

More
30 Nov 2019 18:45 #151596 by PCW
Replied by PCW on topic 7i96 Configuration Tool
You might take a look at Samco's Estop video:

forum.linuxcnc.org/24-hal-components/379...s-work-series#151551
The following user(s) said Thank You: Leon82

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

Moderators: PCWjmelson
Time to create page: 0.122 seconds
Powered by Kunena Forum