Spindel problems in Gmoccapy
- tecno
- Topic Author
- Offline
- Platinum Member
- Posts: 1855
- Thank you received: 127
In Gmoccapy I can not start the spindle, works OK in Axis.
Obviously I have something set wrong but what can that be, spindle starts at 200rpm in Axis.
Please Log in or Create an account to join the conversation.
- rodw
- Offline
- Platinum Member
- Posts: 10752
- Thank you received: 3543
linuxcnc.org/docs/html/gui/gmoccapy.html#_basic_configuration
Please Log in or Create an account to join the conversation.
- tecno
- Topic Author
- Offline
- Platinum Member
- Posts: 1855
- Thank you received: 127
slider far left was locked
But, still no visual rpm display. Copied TURBO and his solution
I mean i just got the gmoccapy spindle meter and led working.
In the ini hal section I added
# Single file that is executed after the GUI has started.
POSTGUI_HALFILE = custom_postgui.hal
in custom_postgui.hal
net spindle-fb-rpm-abs-filtered => gmoccapy.spindle_feedback_bar
net spindle-at-speed => gmoccapy.spindle_at_speed_led
So how can I get some rpm feedback having only INDEX pulse on spindle shaft.
Cheers
Bengt
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Moderator
- Posts: 2075
- Thank you received: 406
##########################################################
# Spindeldrehzahl messen / mesurement spindle revolution #
##########################################################
loadrt encoder num_chan=1
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
setp encoder.1.position-scale 1 # Anzahl der Impulse je Umdrehung
setp encoder.1.counter-mode 1 # Wenn 1 gesetzt, wird B-Signal ignoriert
# disable 4 times encoder, otherwise each klick will ingreas jogwheel-count by 4 instead of 1
# 4-fach-Auswertung vom Encoder ausschalten, sonst wird jogwheel-count bei jedem Klick um 4 statt um 1 erhoeht
setp encoder.0.x4-mode FALSE
loadrt scale count=1 # Wird gebraucht, um U/Sekunde in U/min umzurechnen
addf scale.0 servo-thread
setp scale.0.gain 60 # Ausgang = 60 x Eingang
net spindle_index parport.1.pin-12-in => encoder.1.phase-A => encoder.1.phase-Z
net spindle-index-enable motion.spindle-index-enable <=> encoder.1.index-enable
net spindle-rps encoder.1.velocity => scale.0.in
net spindle-rpm scale.0.out
# Zum Erkennen ob Geschwindigkeit erreicht wurde
# For at Speed detection
loadrt near
addf near.0 servo-thread
# Stellt fest ob zwei Werte in etwa gleich sind
# Wahr wenn, in1/scale <= in2 <= in1*scale
# oder wenn |in1-in2| <= difference
# prooves if two values are roughly the same
# true if in1/scale <= in2 <= in1*scale
# OR |in1-in2| <= difference
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-cmd => near.0.in1
# net spindle-revs motion.spindle-revs => near.0.in1
net spindle-rpm => near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
After that spindle-rpm must be connected in postgui.hal to gmoccapy.spindle_feedback_bar
May be you need to pass the signal through an ABS to get positive values.
Hope that helps.
Norbert
Please Log in or Create an account to join the conversation.
- tecno
- Topic Author
- Offline
- Platinum Member
- Posts: 1855
- Thank you received: 127
will give this a try tomorrow.
mfg
Bengt
Please Log in or Create an account to join the conversation.
- tecno
- Topic Author
- Offline
- Platinum Member
- Posts: 1855
- Thank you received: 127
What lines should be edited to suit above as I get nowhere with the code as-is.
Cheers
bengt
Here is a simple spindle connection I use for a small machine:
########################################################## # Spindeldrehzahl messen / mesurement spindle revolution # ########################################################## loadrt encoder num_chan=1 addf encoder.update-counters base-thread addf encoder.capture-position servo-thread setp encoder.1.position-scale 1 # Anzahl der Impulse je Umdrehung setp encoder.1.counter-mode 1 # Wenn 1 gesetzt, wird B-Signal ignoriert # disable 4 times encoder, otherwise each klick will ingreas jogwheel-count by 4 instead of 1 # 4-fach-Auswertung vom Encoder ausschalten, sonst wird jogwheel-count bei jedem Klick um 4 statt um 1 erhoeht setp encoder.0.x4-mode FALSE loadrt scale count=1 # Wird gebraucht, um U/Sekunde in U/min umzurechnen addf scale.0 servo-thread setp scale.0.gain 60 # Ausgang = 60 x Eingang net spindle_index parport.1.pin-12-in => encoder.1.phase-A => encoder.1.phase-Z net spindle-index-enable motion.spindle-index-enable <=> encoder.1.index-enable net spindle-rps encoder.1.velocity => scale.0.in net spindle-rpm scale.0.out # Zum Erkennen ob Geschwindigkeit erreicht wurde # For at Speed detection loadrt near addf near.0 servo-thread # Stellt fest ob zwei Werte in etwa gleich sind # Wahr wenn, in1/scale <= in2 <= in1*scale # oder wenn |in1-in2| <= difference # prooves if two values are roughly the same # true if in1/scale <= in2 <= in1*scale # OR |in1-in2| <= difference setp near.0.scale 1.2 setp near.0.difference 10 net spindle-cmd => near.0.in1 # net spindle-revs motion.spindle-revs => near.0.in1 net spindle-rpm => near.0.in2 net spindle-at-speed near.0.out => motion.spindle-at-speed
After that spindle-rpm must be connected in postgui.hal to gmoccapy.spindle_feedback_bar
May be you need to pass the signal through an ABS to get positive values.
Hope that helps.
Norbert
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Moderator
- Posts: 2075
- Thank you received: 406
##########################################################
# Spindeldrehzahl messen / mesurement spindle revolution #
##########################################################
loadrt encoder num_chan=1
addf encoder.update-counters servo-thread
addf encoder.capture-position servo-thread
setp encoder.0.position-scale 1 # Anzahl der Impulse je Umdrehung
setp encoder.0.counter-mode 1 # Wenn 1 gesetzt, wird B-Signal ignoriert
# disable 4 times encoder, otherwise each klick will ingreas jogwheel-count by 4 instead of 1
# 4-fach-Auswertung vom Encoder ausschalten, sonst wird jogwheel-count bei jedem Klick um 4 statt um 1 erhoeht
setp encoder.0.x4-mode FALSE
loadrt scale count=1 # Wird gebraucht, um U/Sekunde in U/min umzurechnen
addf scale.0 servo-thread
setp scale.0.gain 60 # Ausgang = 60 x Eingang
net spindle_index parport.0.pin-10-in => encoder.0.phase-A => encoder.0.phase-Z
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable
net spindle-rps encoder.0.velocity => scale.0.in
net spindle-rpm scale.0.out
# Zum Erkennen ob Geschwindigkeit erreicht wurde
# For at Speed detection
loadrt near
addf near.0 servo-thread
# Stellt fest ob zwei Werte in etwa gleich sind
# Wahr wenn, in1/scale <= in2 <= in1*scale
# oder wenn |in1-in2| <= difference
# prooves if two values are roughly the same
# true if in1/scale <= in2 <= in1*scale
# OR |in1-in2| <= difference
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-cmd => near.0.in1
net spindle-rpm => near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
In your postgui.hal file you need:
net spindle-rpm gmoccapy.spindle_feedback_bar
net spindle-at-speed gmoccapy.spindle_at_speed_led
Norbert
Please Log in or Create an account to join the conversation.
- tecno
- Topic Author
- Offline
- Platinum Member
- Posts: 1855
- Thank you received: 127
Please Log in or Create an account to join the conversation.
- newbynobi
- Offline
- Moderator
- Posts: 2075
- Thank you received: 406
please use the changed code.
See my last post.
Norbert
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
- Posts: 5009
- Thank you received: 1443
net spindle-index => encoder.0.phase-Z => encoder.0.phase-A
(There were also other places where encoder.1 should be changed to encoder.0, but Norbert corrected them while I was typing.)
Please Log in or Create an account to join the conversation.