Hardware push buttons to set jog speed. how to?

More
16 Nov 2015 13:25 #65321 by ttontsa
Hi

I like to get 2 external hardware push buttons to set jog velocity slider. I have mesa 5i25 + 7i77. Available inputs could be for example:

hm2_5i25.0.7i77.0.0.input-22 to for reduce jog speed
hm2_5i25.0.7i77.0.0.input-23 to for increasing jog speed

While button held down slider moves slowly (selectable parameter) against to min limit and other button to against max limit.

Or with one button that is continuously increasing value until max "overflow" and slider jump back to min limit.

Gmoccapy has some jog related pins alredy (linuxcnc manual pages 106...141):

gmoccapy.jog-speed-counts = HAL_S32 (Jog velocity)
gmoccapy.jog-vel-value = HAL_FLOAT To adjust the jog velocity slider

I think this site will include all needed advice but i am bit too dummy to get bright idea how to get work:

github.com/jepler/linuxcnc-mirror/blob/m...on/shuttlexpress.hal

-t-

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

More
16 Nov 2015 22:04 #65349 by newbynobi
Have never done that, but should be possible to increase the hal values with the button.
Can only wish good luck:-)

Norbert

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

More
17 Nov 2015 15:52 #65377 by andypugh

gmoccapy.jog-speed-counts = HAL_S32 (Jog velocity)
gmoccapy.jog-vel-value = HAL_FLOAT To adjust the jog velocity slider


I think you want this component:
linuxcnc.org/docs/2.7/html/man/man9/updown.9.html

connect the output to jog-vel-value (I think)

I suspect that it will always start at zero, so you might need to add on a fixed offset with sum2.

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

More
25 Sep 2016 04:34 - 25 Sep 2016 04:35 #80873 by pippin88
I got this working for spindle override

However, I would like the button press to increase the speed by 10% not 1%. Then I have a second button (a 'shift button') that changes the increment to 5%. I had this working with axis and halui, but with gmoccapy the gmoccapy slider and halui count seemed to be fighting - the spindle speed would vary back and forth rapidly between what was set on the screen slider (100%) and what I had set by the buttons (e.g. 110%). I'm not sure how to do this. Maybe a scale?

# Spindle override 

loadrt updown count=1

addf updown.0 servo-thread

setp gmoccapy.spindle-override.count-enable true

net spinup updown.0.countup <= hm2_7i43.0.7i76.0.0.input-00 #up orange 
net spindown updown.0.countdown <= hm2_7i43.0.7i76.0.0.input-01 #down blue

net spincount updown.0.count => gmoccapy.spindle-override.counts ###connect updown count to gmoccapy count

#reset white Physical button to reset spindle override / set spindle to 100%
net spinreset <= hm2_7i43.0.7i76.0.0.input-03 ### connect physical reset button
net spinreset => gmoccapy.reset-spindle-override updown.0.reset ###reset both gmoccapy count and updown
Last edit: 25 Sep 2016 04:35 by pippin88.

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

More
25 Sep 2016 04:49 #80874 by pippin88
I have now this working with scale, such that one button press results in 10% change in spindle speed. This required converting s32 to float for scaling, then back to s32.
# Spindle override 

loadrt updown count=1
### load extra scale in main hal file loadrt scale count=1
# To convert s32 from updown to float for scale
loadrt conv_s32_float count=1
# To convert float from scale back to s32 for counts
loadrt conv_float_s32 count=1

addf updown.0 servo-thread
addf scale.3 servo-thread
addf conv-s32-float.0 servo-thread 
addf conv-float-s32.0 servo-thread 

setp gmoccapy.spindle-override.count-enable true

# Connect pins to updown
net spinup updown.0.countup <= hm2_7i43.0.7i76.0.0.input-00 #up orange 
net spindown updown.0.countdown <= hm2_7i43.0.7i76.0.0.input-01 #down blue

# Set scale gain
setp scale.3.gain 10
# Connect updown to s32->float in for conversion
net spindle-s32 conv-s32-float.0.in <= updown.0.count
# Connect output of s32->float to scale
net scale-s32 conv-s32-float.0.out => scale.3.in
# Connect output of scale to float->s32 converter
net scale-floatin scale.3.out => conv-float-s32.0.in
# Connect output of float->s32 to counts
net scale-floatout conv-float-s32.0.out => gmoccapy.spindle-override.counts

# Reset white - Physical button to reset spindle override / set spindle to 100%
net spinreset <= hm2_7i43.0.7i76.0.0.input-03
net spinreset => gmoccapy.reset-spindle-override updown.0.reset

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

More
25 Sep 2016 05:44 - 25 Sep 2016 05:47 #80877 by pippin88
Can't get a 'shift' button to work at present.

I tried using a mux2 to set the scale for updown.n.count to 5 or 10. The up and down buttons increment by 10% when the shift button is NOT pressed. When the shift button is pressed, the slider increment halves, e.g. if I have gone up 30% to 130%, when I press shift, the spindle speed goes to 115%, then back up to 130% if I release the shift button. If I hold shift and press up or down, the override changes by 5%, but when I release shift it jumps as if I had incremented by 10% each button. E.g. I increase by 5% to 105%, release shift and the spindle override jumps to 110%. Code is below.

Halui with it's halui.spindle-override.increase worked great in axis, but not in gmoccapy :(

NOT WORKING
# Spindle override 

loadrt updown count=1
### load extra scale in main hal file loadrt scale count=1
# To convert s32 from updown to float for scale
loadrt conv_s32_float count=1
# To convert float from scale back to s32 for counts
loadrt conv_float_s32 count=1

addf updown.0 servo-thread
addf scale.3 servo-thread
addf conv-s32-float.0 servo-thread 
addf conv-float-s32.0 servo-thread 

setp gmoccapy.spindle-override.count-enable true

# Connect pins to updown
net spinup updown.0.countup <= hm2_7i43.0.7i76.0.0.input-00 #up orange 
net spindown updown.0.countdown <= hm2_7i43.0.7i76.0.0.input-01 #down blue

# Set scale gain
#mux allows us to choose between the two values. mux2.n.out defaults to .in0 if mux2.n.sel is not called

setp mux2.0.in0 10
setp mux2.0.in1 5
net spinshift mux2.0.sel <= hm2_7i43.0.7i76.0.0.input-02 #shift white

net scalegain scale.3.gain mux2.0.out
# Connect updown to s32->float in for conversion
net spindle-s32 conv-s32-float.0.in <= updown.0.count
# Connect output of s32->float to scale
net scale-s32 conv-s32-float.0.out => scale.3.in
# Connect output of scale to float->s32 converter
net scale-floatin scale.3.out => conv-float-s32.0.in
# Connect output of float->s32 to counts
net scale-floatout conv-float-s32.0.out => gmoccapy.spindle-override.counts

# Reset white - Physical button to reset spindle override / set spindle to 100%
net spinreset <= hm2_7i43.0.7i76.0.0.input-03
net spinreset => gmoccapy.reset-spindle-override updown.0.reset
Last edit: 25 Sep 2016 05:47 by pippin88.

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

More
25 Sep 2016 06:14 #80878 by pippin88
Halui feed override works fine with gmoccapy.

Below is my old code for feed and spindle override. Feed works great, spindle has the varying speed problem.
# Spindle override 
#mux allows us to choose between the two values. mux2.n.out defaults to .in0 if mux2.n.sel is not called
setp mux2.0.in0 0.1
setp mux2.0.in1 0.05
net spinshift mux2.0.sel <= hm2_7i43.0.7i76.0.0.input-02 #shift white
net spinup <= hm2_7i43.0.7i76.0.0.input-00 #up orange 
net spindown <= hm2_7i43.0.7i76.0.0.input-01 #down blue
net spinoverride halui.spindle-override.scale <= mux2.0.out
net spinup => halui.spindle-override.increase
net spindown => halui.spindle-override.decrease


# Feed override
setp mux2.1.in0 0.1
setp mux2.1.in1 0.05
net feedshift mux2.1.sel <= hm2_7i43.0.7i76.0.0.input-10 #shift white
net feedup <= hm2_7i43.0.7i76.0.0.input-08 #up orange
net feeddown <= hm2_7i43.0.7i76.0.0.input-09 #down blue
net feedoverride halui.feed-override.scale <= mux2.1.out
net feedup => halui.feed-override.increase
net feeddown => halui.feed-override.decrease

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

More
25 Sep 2016 08:42 #80886 by newbynobi
@pippin88

I tested with sim.gmoccapy with a glade panel as button.

Attached the hal file and the glade file to test:

to embedd the tab in gmoccaopy use:
EMBED_TAB_NAME = Override
EMBED_TAB_LOCATION = ntb_preview
EMBED_TAB_COMMAND = gladevcp -x {XID} -H override.hal override.glade

all files must be in your config dir!

that does work fine, so there must be a problem in the rest of your config files!

Norbert
Attachments:

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

More
25 Sep 2016 10:30 - 25 Sep 2016 10:35 #80896 by pippin88
Norbert, thanks for your help.

Did you run the spindle? The problem only appears when I run the spindle.

I am using a huanyang vfd with the hy_vfd component. I'm not sure if that could make any problems.

I will try your glade panel in the next few days.

EDIT: Someone has the exact same problem: forum.linuxcnc.org/forum/gmoccapy/31613-...e-increase-bug#80897
Last edit: 25 Sep 2016 10:35 by pippin88.

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

More
08 Oct 2016 08:44 - 08 Oct 2016 08:45 #81387 by auto-mation-assist
I had a problem when lowering the spindle closed loop speed that caused uneven spindle speed at times. There was nothing wrong with my hal configuration. As it turned out the minimum speed settings in the huanyang vfd were the cause of the problem. I was trying to set the spindle speed lower than the minimum allowed by the VFD internally programed settings of 600 rpm. In my case this was 10Hz output. This caused the spindle encoder to put out a constant pulse train for 600 rpm when its minimum programmed speed was reached. The closed loop attempted to adjust the speed to the desired one which caused uneven speed and at times a total run away to a max rpm condition. VFD programming may be a potential source of the problem you are having. I use analog control of the VFD at 0-10v. reprogramming the vfd solved my problem.
Last edit: 08 Oct 2016 08:45 by auto-mation-assist.
The following user(s) said Thank You: ikkuh

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

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