How to set up a manuel gear change?

More
24 Jan 2019 23:10 #124774 by MATZE-ATZE-SCH
Hello.

On my mill i need to change the gears manual.

There is a lever with 3 positions, 1, 2 and 0.
On 1 I have a gear ratio from 1:5.57, on 2 it is 1:1.
If the lever is on 0, the Spindel is locked.
The lever is queried with 3 switches, S1, S2 and S3.
On Position 0 S1=1 S2=0 S3=0.
On position 1 S1=1 S2=0 S3=1
On Position 3 S1=0 S2=0 S3=1.
0=open switch, 1=closed switch.

S2 will be 1, if the lever is between 1,2, or 0 and the gears are not fully engaged.

The Spindel is controlles by a VFD.

My general Setup is a 5i20, a 7i33 for X,Y.Z, (later I will add a 4th axis), and a 7i37 for in- and outputs.
The VFD is controlles by a SpinX1 Card on P3 with pwmgen.04 to turn it on/off, set RPM and CW/CCW.

But how can I implement the manual gear box?
I want also to wire up a proximity sensor to the spindel to get a RPM feedback. The Sensor operates at 24V an can handel 1kHz, so I want to wire it to the 5i37?

Best regards
Marcel

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

More
25 Jan 2019 13:30 - 25 Jan 2019 13:30 #124809 by andypugh
One way to do this would be with HAL components.
Divide the speed request from the controller by 5.57 (actually multiply by 0.180) if the lever is in position 1
Set the command to zero (multiply by zero) if the lever is out of position.

converting the switch positions to binary:
P0 = 1
P1 = 5
P2 = 4
All others = invalid

linuxcnc.org/docs/2.7/html/man/man9/mux8.9.html
loadrt mux8
...
addf mux8.0 servo-thread
...
net switch1 mux8.0.sel0
net switch2 mux8.0.sel1
net switch3 mux8.0.sel2

setp mux

setp mux8.0.in0 0
# P0
setp mux8.0.in1 0
setp mux8.0.in2 0
setp mux8.0.in3 0
# P2
setp mux8.0.in4 1.0
# P1
setp mux8.0.in5 0.180
setp mux8.0.in6 0
setp mux8.0.in7 0

net ratio-out mux8.0.out

Then use a scale to change the VFD commanded speed
linuxcnc.org/docs/2.7/html/man/man9/scale.9.html
loadrt scale
...
addf scale.0  servo-thread
...
net speed-raw motion.spindle-speed-out-rpm-abs => scale.0.in0
net ratio => scale.0.in1
net speed-scaled <= scale.0.out
I can't be quite so helpful with the second snippet, I don't know which spindle speed you are using, or how you are driving the spindle.
Last edit: 25 Jan 2019 13:30 by andypugh.

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

More
25 Jan 2019 14:07 - 25 Jan 2019 14:09 #124814 by MATZE-ATZE-SCH
Hello Andy,

the Spindel I drive by this:
setp	hm2_5i20.0.pwmgen.03.output-type 3
setp hm2_5i20.0.pwmgen.04.output-type 1
net spindle-speed-cmd motion.spindle-speed-out => hm2_5i20.0.pwmgen.04.value
net spindle-on motion.spindle-on => hm2_5i20.0.pwmgen.04.enable
# Set the spindle's top speed in RPM
setp hm2_5i20.0.pwmgen.04.scale 3000
From there, it goes from the outputs of the 5i20 to the SpinX1, witch controlles the VFD, with 0-10V for RPM, an 2 Inputs for CW/CCW.

Best regards
Marcel
Last edit: 25 Jan 2019 14:09 by MATZE-ATZE-SCH.

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

More
25 Jan 2019 14:13 #124817 by andypugh
Replace this:

net spindle-speed-cmd motion.spindle-speed-out => hm2_5i20.0.pwmgen.04.value



with this
net spindle-speed-cmd motion.spindle-speed-out => scale.0.in
net spindle-speed-cmd-scaled  scale.0.out => hm2_5i20.0.pwmgen.04.value

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

More
25 Jan 2019 15:06 #124820 by MATZE-ATZE-SCH
OK, will give it a try.
But where I define the 3 switches from the lever,
and what do you mean with
converting the switch positions to binary:
P0 = 1
P1 = 5
P2 = 4
All others = invalid

Best regards
Marcel

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

More
25 Jan 2019 15:25 #124821 by andypugh

and what do you mean with
converting the switch positions to binary:
P0 = 1
P1 = 5
P2 = 4


The mux uses 3 input bits to encode for one of 8 outputs.
I have connected S1 to bit0, S2 to bit1 and S3 to bit2.
Looking at your switch case table, those are the binary numbers that correspond to the bit patterns.

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

More
25 Jan 2019 17:06 - 25 Jan 2019 17:08 #124827 by MATZE-ATZE-SCH
OK,

I have written the code from your first post in my .hal file.
But I get an Error,
"PIN speed-raw motion.spindle-speed-out-rpm-abs does not exist"

Best regards
Marcel
Last edit: 25 Jan 2019 17:08 by MATZE-ATZE-SCH.

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

More
25 Jan 2019 17:40 #124830 by andypugh
I did say that the second snippet was a guess and probably wrong.
Use the third snippet instead.

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

More
25 Jan 2019 17:57 #124833 by MATZE-ATZE-SCH
OK, got it.
Now I need to conect the inputs of the 3 switches to switch1 - switch3
net switch1 mux8.0.sel0
net switch2 mux8.0.sel1
net switch3 mux8.0.sel2
Is this correct?

Thanks for your help,
Marcel

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

More
25 Jan 2019 18:12 #124840 by andypugh
The following user(s) said Thank You: MATZE-ATZE-SCH

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

Time to create page: 0.105 seconds
Powered by Kunena Forum