Open Loop Spindle control with DYN4

  • BeagleBrainz
  • Topic Author
  • New Member
  • New Member
More
5 years 7 months ago #204163 by BeagleBrainz
Open Loop Spindle control with DYN4 was created by BeagleBrainz
Ok so I have a DYN4 servo drive & motor I'm using on my mill. Johnnycnc has given me a good starting point, forum.linuxcnc.org/12-milling/39783-spindle-motor-advice

What I would like to do is just for the time being is run the motor in open loop.

Q1. Is this possible ?
Q2. What mods do I have to make to the hal file ?

Relevant section of HAL, in my hal I've made changes to reflect the 7i92 I'm using and such.
Any help or suggestions would be great.
Code:
#******************* # SPINDLE S #******************* setp pid.s.Pgain [SPINDLE_0]P setp pid.s.Igain [SPINDLE_0]I setp pid.s.Dgain [SPINDLE_0]D setp pid.s.bias [SPINDLE_0]BIAS setp pid.s.FF0 [SPINDLE_0]FF0 setp pid.s.FF1 [SPINDLE_0]FF1 setp pid.s.FF2 [SPINDLE_0]FF2 setp pid.s.deadband [SPINDLE_0]DEADBAND setp pid.s.maxoutput [SPINDLE_0]OUTPUT_MAX_LIMIT setp pid.s.error-previous-target true net spindle-index-enable <=> pid.s.index-enable hm2_5i25.0.encoder.00.index-enable net spindle-enable => pid.s.enable net spindle-vel-cmd-rpm => pid.s.command net spindle-fb-rpm => pid.s.feedback net spindle-output <= pid.s.output # ---Analog output signals/setup--- setp hm2_5i25.0.7i83.0.1.analogout5-scalemax [SPINDLE_0]OUTPUT_SCALE setp hm2_5i25.0.7i83.0.1.analogout5-minlim [SPINDLE_0]OUTPUT_MIN_LIMIT setp hm2_5i25.0.7i83.0.1.analogout5-maxlim [SPINDLE_0]OUTPUT_MAX_LIMIT net spindle-output => hm2_5i25.0.7i83.0.1.analogout5 # ---setup spindle control signals--- net spindle-vel-cmd-rps <= spindle.0.speed-out-rps net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs net spindle-vel-cmd-rpm <= spindle.0.speed-out net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs net spindle-enable <= spindle.0.on and2.ena.in0 estop-latch.1.reset net spindle-cw <= spindle.0.forward net spindle-ccw <= spindle.0.reverse net spindle-brake <= spindle.0.brake net spindle-revs => hm2_5i25.0.encoder.00.position spindle.0.revs net spindle-at-speed => spindle.0.at-speed net spindle-vel-fb-rps => spindle.0.speed-in net spindle-index-enable <=> spindle.0.index-enable net spindle-lockout-db estop-latch.1.ok-out => and2.ena.in1 net spindle-OK and2.ena.out => timedelay.0.in net DYN-enable timedelay.0.out => hm2_5i25.0.7i76.0.0.output-03 hm2_5i25.0.7i83.0.1.analogena5 net spindle-Lockout hm2_5i25.0.7i76.0.0.input-07-not => estop-latch.1.fault-in # ---Setup spindle at speed signals--- net spindle-vel-cmd-rpm-abs => near.0.in1 net spindle-fb-rpm-abs => near.0.in2 net spindle-at-speed spindle.0.at-speed <= near.0.out setp near.0.scale 1.04 # Use ACTUAL spindle velocity from spindle encoder # spindle-velocity bounces around so we filter it with lowpass # spindle-velocity is signed so we use absolute component to remove sign # ACTUAL velocity is in RPS not RPM so we scale it. setp scale.0.gain 60 setp lowpass.0.gain .007 setp lowpass.0.load false net spindle-vel-fb-rps hm2_5i25.0.encoder.00.velocity => scale.0.in net spindle-fb-rpm scale.0.out => abs.0.in net spindle-fb-rpm-abs abs.0.out => lowpass.0.in net spindle-fb-rpm-abs-filtered lowpass.0.out

Please Log in to join the conversation.

More
5 years 6 months ago #204275 by Michael
On the surface it doesn't look bad but you would need to know how you plan on controlling the spindle. What card are you using (7i76, etc)? Will you be using +/-10v or 0-10v? Will the spindle be geared? Why not add the encoder?

Also there are a number of components you are using that will need to be loaded in the hal. They are most likely at the top of the hal file but we only see the spindle section. Most likely look like this:

loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt scale names=scale.spindle

Please Log in to join the conversation.

  • BeagleBrainz
  • Topic Author
  • New Member
  • New Member
More
5 years 6 months ago #204306 by BeagleBrainz
Replied by BeagleBrainz on topic Open Loop Spindle control with DYN4
As the snippet shows I’m using a 7i83.

I figured that there are some components that won’t be needed.

The reason I don’t want to add the encoder ATM as it will take some time to get the right cable to connect the DYN4 encoder output to my 7i76.
The wiring from the encoder on the spindle motor to the driver is sorted.

Please Log in to join the conversation.

More
5 years 6 months ago #204317 by Michael
I assumed the hm2_5i25.0.7i83.0.1.... was a copy and paste of the person you mentioned hal. If this is your actual hal then the 5i25 will need to be replaced with the 7i92.

How did you get the hal file to this point? If you are copying and pasting from someone else you may encounter errors unless their setup is exactly the same, which it doesn't appear to be. You can go through pncconf and setup a spindle with no feedback. That will get the hal completed perfectly. Otherwise I would recommend checking all of this by configuring hal in a terminal: linuxcnc.org/docs/2.8/html/hal/tutorial.html#_a_simple_example

Either way you will need to double check that the pins you have listed in this hal example actually exist on your machine. Thats why I mentioned you are missing a bunch of loadrt. It may be at the top but if it isn't then many of the pins you have on the list won't be there.

Please Log in to join the conversation.

  • BeagleBrainz
  • Topic Author
  • New Member
  • New Member
More
5 years 6 months ago #204324 by BeagleBrainz
Replied by BeagleBrainz on topic Open Loop Spindle control with DYN4
OK.

The machine I'm using has no internet, and I was lazy and did just copy and paste the snippet, as I said I was using it as a reference, which I thought would imply I made the changes required. Hell my 7i83 is on the second sserial port and a different channel.
Yes I have changed the the hal lines to resemble my machine, the hal file loads and linuxcnc starts. So obviously the components are being loaded. And no I'm trying to use the vcp Johnny is using, so no need to mention that. That is not the issue, that was not even my question.

All I asked was whether it is possible to run the spindle open loop and if it was, what changes are required.

I'm familiar with hal, my full hal file includes a custom component I wrote for my pendant.

I'm even using a custom Mint ISO that I used to distribute and supply updated packages for. I'm just unfamiliar ATM with spindle control. The machine has been running for a couple of years, first with Mach3, then Machinekit on a BBB with custom breakout boards, then with a J3355B and my mesa hardware, now I've switched over to a Odroid H2+ and a completely rebuilt control cabinet. The decision to add spindle control was the reason for the rebuild.

I looked a pncconf and really didn't see a an option to configure the spindle without feedback, maybe I missed something.

Please Log in to join the conversation.

More
5 years 6 months ago #204325 by Michael
Seems you got it figured out then

Please Log in to join the conversation.

  • BeagleBrainz
  • Topic Author
  • New Member
  • New Member
More
5 years 6 months ago #204332 by BeagleBrainz
Replied by BeagleBrainz on topic Open Loop Spindle control with DYN4

Michael wrote: Seems you got it figured out then



No.

I still need a bit of advice in going from a closed loop to open loop config.

Please Log in to join the conversation.

More
5 years 6 months ago #204566 by andypugh

BeagleBrainz wrote: I still need a bit of advice in going from a closed loop to open loop config.


Set P, I, D FF1 and FF2 to zero.
Then adjust FF0 to get the correct speed.

Please Log in to join the conversation.

  • BeagleBrainz
  • Topic Author
  • New Member
  • New Member
More
5 years 6 months ago #204588 by BeagleBrainz
Replied by BeagleBrainz on topic Open Loop Spindle control with DYN4
Ok so I still need PID that's great to know.

Had it running last night on the test bench, feeding (using correct hal notation)

spindle.0.speed-out straight to hm2_7i92.0.7i83.1.5.analogout5 and was able to get movement, the 7i83 was supplying a calculated voltage that was correct.
Code:
#******************* # SPINDLE S (open loop) #******************* setp pid.s.Pgain 0 setp pid.s.Igain 0 setp pid.s.Dgain 0 setp pid.s.bias 0 setp pid.s.FF0 "adjust to suit" setp pid.s.FF1 0 setp pid.s.FF2 0 setp pid.s.deadband 0 setp pid.s.maxoutput 4000 setp pid.s.error-previous-target true #net spindle-index-enable <=> pid.s.index-enable hm2_7i92.0.encoder.00.index-enable net spindle-enable => pid.s.enable net spindle-vel-cmd-rpm => pid.s.command #net spindle-fb-rpm => pid.s.feedback net spindle-output <= pid.s.output setp hm2_7i92.0.7i83.1.5.analogout5-scalemax 4000 setp hm2_7i92.0.7i83.1.5.analogout5-minlim -4000 setp hm2_7i92.0.7i83.1.5.analogout5-maxlim 4000 net spindle-output => hm2_7i92.0.7i83.1.5.analogout5 net spindle-vel-cmd-rpm <= spindle.0.speed-out

Does the above look right or am I wayyyyy off ? (assuming I have loaded pid.s)

Eventually the encoder output from the servo driver will get connected up, just need to get hold of a small amount of 3 pair shielded twisted pair.

Please Log in to join the conversation.

More
5 years 6 months ago #204615 by johnmc1
Have you enabled analog5 elswhere.

Please Log in to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum