Use 0-10V + dir on 7i77 instead of +-10V out

More
24 Sep 2018 17:48 #117928 by xaxxes
Hi.
I'm sorry that I dig up this old thread, but have exactly the same problem as the thread creator. I also own these Lichuan-B2 drivers.

Servo driver: Lichuan_B2 series
Board: Mesa 7i77

Now I want to solve the problem as suggested, using the ABS function (direction signal + 0-10V). Can someone help me please? Have never wrote some HAL-code.


Thank you.

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

More
24 Sep 2018 23:57 #117943 by andypugh
Can you give us an example snippet of the HAL that connects one axis to the 7i77?

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

More
25 Sep 2018 12:03 - 25 Sep 2018 12:04 #117954 by xaxxes
Thanks for your reply.

Here is the code for the Y-Axis, which was created with Pncconf:
#*******************
#  AXIS Y
#*******************

setp   pid.y.Pgain     [AXIS_1]P
setp   pid.y.Igain     [AXIS_1]I
setp   pid.y.Dgain     [AXIS_1]D
setp   pid.y.bias      [AXIS_1]BIAS
setp   pid.y.FF0       [AXIS_1]FF0
setp   pid.y.FF1       [AXIS_1]FF1
setp   pid.y.FF2       [AXIS_1]FF2
setp   pid.y.deadband  [AXIS_1]DEADBAND
setp   pid.y.maxoutput [AXIS_1]MAX_OUTPUT
setp   pid.y.error-previous-target true

net y-index-enable  <=> pid.y.index-enable
net y-enable        =>  pid.y.enable
net y-pos-cmd       =>  pid.y.command
net y-vel-cmd       =>  pid.y.command-deriv
net y-pos-fb        =>  pid.y.feedback
net y-output        =>  pid.y.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout1-scalemax  [AXIS_1]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout1-minlim    [AXIS_1]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout1-maxlim    [AXIS_1]OUTPUT_MAX_LIMIT

net y-output                             => hm2_5i25.0.7i77.0.1.analogout1
net y-pos-cmd    axis.1.motor-pos-cmd
net y-enable     axis.1.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.01.counter-mode 0
setp    hm2_5i25.0.encoder.01.filter 1
setp    hm2_5i25.0.encoder.01.index-invert 0
setp    hm2_5i25.0.encoder.01.index-mask 0
setp    hm2_5i25.0.encoder.01.index-mask-invert 0
setp    hm2_5i25.0.encoder.01.scale  [AXIS_1]ENCODER_SCALE

net y-pos-fb               <=  hm2_5i25.0.encoder.01.position
net y-vel-fb               <=  hm2_5i25.0.encoder.01.velocity
net y-pos-fb               =>  axis.1.motor-pos-fb
net y-index-enable    axis.1.index-enable  <=>  hm2_5i25.0.encoder.01.index-enable
net y-pos-rawcounts        <=  hm2_5i25.0.encoder.01.rawcounts

# ---setup home / limit switch signals---

net home-y     =>  axis.1.home-sw-in
net y-neg-limit     =>  axis.1.neg-lim-sw-in
net y-pos-limit     =>  axis.1.pos-lim-sw-in

I think i have to edit the section "PWM Generator signals/setup" but don't know how.

Many thanks.
Last edit: 25 Sep 2018 12:04 by xaxxes.

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

More
25 Sep 2018 14:54 - 25 Sep 2018 14:56 #117959 by andypugh

Thanks for your reply.

Here is the code for the Y-Axis, which was created with Pncconf:
net y-output        =>  pid.y.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout1-scalemax  [AXIS_1]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout1-minlim    [AXIS_1]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout1-maxlim    [AXIS_1]OUTPUT_MAX_LIMIT

net y-output                             => hm2_5i25.0.7i77.0.1.analogout1


Change the above to
#Near the top of the file
loadrt abs names = abs.x,abs.y,abs.z

addf abs.x servo-thread
addf abs.y servo-thread
addf abs.z servo-thread

#Then for each axis
# delete net y-output                             => hm2_5i25.0.7i77.0.1.analogout1
net y-output => abs.y.in
net y-abs        abs.y.out    => hm2_5i25.0.7i77.0.1.analogout1
# This is the direction output, use is-negative if required
# Choose a GPIO pin to suit. 
net y-dir        abs.y.is-positive      =>       hm2_5i25.0.7i77.0.0.output-00

Docs: linuxcnc.org/docs/2.7/html/man/man9/abs.9.html
Last edit: 25 Sep 2018 14:56 by andypugh.
The following user(s) said Thank You: xaxxes

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

More
27 Sep 2018 18:56 #118071 by xaxxes
Thank you.
I changed the code.

Now i have a other problem:
I've tried to tune the motor but i get an following error if i set PID P= 0,05, 1, 20, or 100 or something else. And when i set P=0,00005 or something like this, the motor hold the position, but vibrates extremely.

Can this issue came from the direction signal? I've connected the mesa output directly to the servo input and the input on the servo works. Maybe is the input of the servo too slow?

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

More
28 Sep 2018 12:19 #118103 by andypugh
If it holds but vibrates, try an even smaller number.
What is the value on the pid.L.error pins? If you need a very small P then this might indicate that the scaling on the feedback input is unusual.

Is there any chance that the spindle drive is configured or 4-20mA operation?

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

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