Spindel problems in Gmoccapy

More
27 Apr 2017 12:48 #92200 by tecno
Have now my lathe running OK in Axis.

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.

More
27 Apr 2017 13:27 #92207 by rodw
Replied by rodw on topic Spindel problems in Gmoccapy
I don't have a spindle so can't help much. I think there are some .ini file settings that need to be set up as I see some warnings in the terminal window when I start Linuxcnc from the command line. Have a read here:
linuxcnc.org/docs/html/gui/gmoccapy.html#_basic_configuration

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

More
27 Apr 2017 15:46 - 27 Apr 2017 16:46 #92222 by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
Found the problem that is the slider was locked far left and only restart solved this so now I can command the spindle.


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
Attachments:
Last edit: 27 Apr 2017 16:46 by tecno.

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

More
27 Apr 2017 18:09 #92228 by newbynobi
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.

More
27 Apr 2017 18:25 #92229 by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
Thank you Norbert,
will give this a try tomorrow.

mfg
Bengt

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

More
28 Apr 2017 10:21 #92253 by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
Can somebody clarify the code from Norbert. I have only 1 par port = 0 and only index pulse on pin 10

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.

More
28 Apr 2017 14:43 - 28 Apr 2017 14:51 #92275 by newbynobi
The changed code
##########################################################
# 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
Last edit: 28 Apr 2017 14:51 by newbynobi.

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

More
28 Apr 2017 14:56 - 28 Apr 2017 14:59 #92276 by tecno
Replied by tecno on topic Spindel problems in Gmoccapy


Line 43

net spindle-index => encoder.1.phase-Z => encoder.1.phase-A
Attachments:
Last edit: 28 Apr 2017 14:59 by tecno.

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

More
28 Apr 2017 15:16 #92277 by newbynobi
Hallo bengt,

please use the changed code.
See my last post.

Norbert

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

More
28 Apr 2017 15:19 - 28 Apr 2017 15:22 #92278 by Todd Zuercher
I believe you only have one encoder so the pin names should be:
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.)
Last edit: 28 Apr 2017 15:22 by Todd Zuercher.

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

Moderators: newbynobiHansU
Time to create page: 1.404 seconds
Powered by Kunena Forum