Hurco BMC30 toolchanger setup with Pico PPMC

More
05 Dec 2021 20:44 #228404 by Jake
Thanks Micheal!

I need to change out some of the SSR's that are on the PPMC. They do not have quite enough to get the relays to consistently pick up.

I'll make the change in the NGC also. Should be able to get back out there tonight hopefully!

I am having the PC lock up on me right now. So I need to figure that one out also. I keep thinking about building a new PC for this, but can't make up my mind on parts. The one that's in the is old.

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

More
10 Dec 2021 00:26 - 10 Dec 2021 03:12 #228751 by Jake
Couple challenges I am working through.

o100 looks like the unload routine
o200 looks like the load commanded tool

Then it completes what is after o200 endif after either o100 or o200 is complete  depending on if there was a tool in the spindle or not.

Which if this is the flow of it, seems like there  is something  going on with either my logic for "lock-tool = true" and "tool-released = true" which is allowing it to not lock the tool on the first tool pickup and moving the arm back out before the  lock-tool = true.  Which these are 2 different switches to separate inputs. 


[code]; HURCO BMC30 11/24/2021
o<toolchange> sub

; M66 inputs
; P0 carosuel completed
; P1 spindle-oriented
; P2 arm-retracted
; P3 arm-extended
; P4 tool-locked
; P5 tool-released
; P6 air-alarm

; M64 outputs
; P0  start carosuel
; P1  spindle-orient
; P2  arm-retract
; P3  arm-extend
; P5  release-tool

M64 P1         ;spindle orient command
M66 P1 L3 Q5   ;spindle oriented complete
    O030 if [#5399 LT 0]
    O030 endif

; only unload the tool if there is a tool in the spindle
; This assumes that the carousel is already aligned correctly.
; It is important to unload the tool before shutting down the machine.

O100 IF [#<tool_in_spindle> GT 0]
    G53 G0 Z -3.5
    M66 P6 L0; air-alarm
    M64 P3 ; extend arm
    M66 P3 L3 Q5 ; wait for arm-extended = true
    O104 if [#5399 LT 0]
        (abort, failed to move arm-extended)
    O104 endif

    M65 P3 ; arm extend off
    M64 P5 ; release tool
    M66 P5 L3 Q2 ; wait for tool-released = true
    O105 if [#5399 LT 0]
        (abort, failed to release tool)
    O105 endif

O100 ENDIF

    G53 G0 Z0

O200 IF [#<selected_tool> GT 0]


    M68 E0 Q#<selected_pocket> ;set the carousel to move to the right pocket

    M64 P0 ; start carousel
    G4 P2
    M66 P0 L3 Q60 ; wait for carousel finished
    O107 if [#5399 LT 0]
        (abort, failed to align carousel)
    O107 endif

    M65 P0  ; stop carousel
    M66 P6 L0; air-alarm
    M64 P3 ; move arm extend (might already be in)
    M66 P3 L3 Q5 ; wait for arm-extended = true
    M65 P3 ; arm extend off
    O108 if [#5399 LT 0]
        (abort, failed to move arm in)
    O108 endif

    G53 G0 Z-3.5 ; pick up the tool

O200 ENDIF

M65 P5 ; lock-tool (release tool off)
M66 P4 L3 Q2 ; wait for tool-locked = true
O110 if [#5399 LT 0]
    (abort, failed to lock tool)
O110 endif

M64 P2 ; arm-retract
M66 P2 L3 Q5 ; wait for arm-retracted = true
O111 if [#5399 LT 0]
    (abort, failed to move arm out)
O111 endif
M65 P2 ; arm-retract off


o<toolchange> endsub [1]


M2
[/code]

When it does a tool change from no tool to the first tool the spindle is not unlocking to pick the tool up.

Second one is one a tool change where there is a tool, the arm retracts right after the spindle lock solenoid turns off. Does not wait for the locked tool = true before the arm retract is happening.

3rd is the carousel will not home. Am I missing " carousel.0.homing, and carousel.0.homed " in my .hal ? On startup it just assumes it is at #1 It is just counting to the next holder. I have one mag switch on the motor and one on the #24 spot on the carousel. It will index the correct amount of holders, but if it starts on something other than 1 its going to be an issue.

4th is I need both my forward and reverse relays true to go reverse. This is not really that big of a deal. It would be nice if I could get it to work with the software side. I am not sure if just an AND2 could make this happen. Last thing is getting the OR2 to work for the tool release button. Button works, (did manual tool changes for a LONG LONG LONG time. ) I see the input on the botton change states, and the or2.0.in0 change states. I thought that on the output this needed to be "OR2.0.out0" to be the output of the OR function.

OR should this be "OR2.0.out"
# RELEASE-BUTTON DI 32 net release-button ppmc.0.din.31.in-not or2.0.in0 net tool-release motion.digital-out-05 ppmc.0.dout.09.out and2.1.in1 or2.0.in1 #or2.0.out

[code][code][code][code][code][code][code][code][code]Thanks everyone!



[code][code][code][code]# HAL config file for Pico Systems USC board
# HURCO BMC30 JAKE FREESE 12/09/2021

# MESSAGES -----------------------------------------------------

loadrt message names=ppmcEstop,spindle-alarm,air-alarm,lube_level,amp-fault messages="EMERGENCY STOP,SPINDLE FAULT,LOW AIR PRESSURE,LOW LUBE,SERVO FAULT"
addf ppmcEstop servo-thread
addf spindle-alarm servo-thread
addf air-alarm servo-thread
addf lube_level servo-thread
addf amp-fault servo-thread

# LIMITS, HOMING, ENCODERS -------------------------------------

net Xmaxlim axis.0.pos-lim-sw-in ppmc.0.din.01.in-not
net Xminlim axis.0.neg-lim-sw-in ppmc.0.din.02.in-not
net Xmaxlim axis.0.home-sw-in

net Ymaxlim axis.1.pos-lim-sw-in ppmc.0.din.03.in-not
net Yminlim axis.1.neg-lim-sw-in ppmc.0.din.04.in-not
net Ymaxlim axis.1.home-sw-in

net Zmaxlim axis.2.pos-lim-sw-in ppmc.0.din.06.in-not
net Zminlim axis.2.neg-lim-sw-in ppmc.0.din.05.in-not
net Zmaxlim axis.2.home-sw-in

loadrt logic personality=0x203
addf logic.0 servo-thread
net x-homing axis.0.homing => logic.0.in-00
net y-homing axis.1.homing => logic.0.in-01
net z-homing axis.2.homing => logic.0.in-02
net any-homing logic.0.or => ppmc.0.dout.00.out

#ENCODERS
net Xindex <= axis.0.index-enable ppmc.0.encoder.00.index-enable
net Yindex <= axis.1.index-enable ppmc.0.encoder.01.index-enable
net Zindex <= axis.2.index-enable ppmc.0.encoder.02.index-enable

# SERVOS AND ENCODERS ------------------------------------------

# Servo Alarms  ALL ALARMS DI0
net amp-fault-x axis.0.amp-fault-in ppmc.0.din.00.in
net amp-fault amp-fault.trigger
setp amp-fault.edge 0
# Servo enable     SSR7
net Xenable <= axis.0.amp-enable-out ppmc.0.dout.06.out
# Servo Alarm Reset          SSR 4
# net amp-fault-reset axis.o.amp-fault-reset ppmc.0.dout.04.out

# EMERGENCY STOP -----------------------------------------------

net ppmcEstop ppmc.0.din.estop.in
net ppmcEstop ppmcEstop.trigger
setp ppmcEstop.edge 1
net ppmcEstop and2.0.in0
net EstopOkIn estop-latch.0.fault-in
net EstopOkIn and2.0.out
net EstopOkOut ppmc.0.dout.07.out
net EstopOkOut ppmc.0.dout.Estop.out
net EstopOkOut iocontrol.0.emc-enable-in
net EstopOkOut estop-latch.0.ok-out
net EstopOkOut and2.0.in1
net emc-estop-out iocontrol.0.user-enable-out
net emc-estop-out estop-latch.0.ok-in
net emc-estop-reset iocontrol.0.user-request-enable
net emc-estop-reset estop-latch.0.reset

# SPINDLE ------------------------------------------------------

# Low Speed Winding Select   SSR 5
# Low speed comp             DI9
# linksp        <= ppmc.0.dout.05.out
# linksp        => iocontrol.0.

# Spindle orient below in tool changer section

# Spindle Alarm              DI 08
net spindle-alarm motion.enable ppmc.0.din.08.in-not
net spindle-alarm spindle-alarm.trigger
setp spindle-alarm.edge 1

# connect mist/flood coolant to I/O controller  SSR 15 and 16
net coolant-mist iocontrol.0.coolant-mist ppmc.0.dout.15.out
net coolant-flood iocontrol.0.coolant-flood ppmc.0.dout.11.out

# lube
net lube_level iocontrol.0.lube_level ppmc.0.din.27.in-not
net lube_level lube_level.trigger
setp lube_level.edge 1

# X Torque            DI 16
# linksp        <= ppmc.0.din.16.in
# linksp        => iocontrol.0.

# Y Torque            DI 17
# linksp        <= ppmc.0.din.17.in
# linksp        => iocontrol.0.

# Z Torque            DI 18
# linksp        <= ppmc.0.din.18.in
# linksp        => iocontrol.0.

# S Torque            DI 19
# linksp        <= ppmc.0.din.19.in
# linksp        => iocontrol.0.

#net SpindleON motion.spindle-on => near.1.in1
setp near.1.in2 0
setp near.1.difference 2.0
net spindle-stopped near.1.out => and2.1.in0

# Tool Locked (spindle inhibit if false)     DI 08
# net tool-locked motion.spindle-inhibit ppmc.0.din.09.in

# TOOL CHANGER SECTION  -------------------------------------------------------

# Mag ROTATE BUTTON         SSR 9
# linksp        <= ppmc.0.dout.09.out
# linksp        => iocontrol.0.

# Tool Caroseul rotate button DI29
# new sig Rotate-tool
# net Rotate-tool .0. ppmc.0.din.29.in

#24 Pocket tool changer, Home pin @#24 Index switch on rotator.
loadrt carousel pockets=24 dir=2 encoding=index num_sense=2
loadrt conv_float_s32
loadrt timedelay
addf timedelay.0 servo-thread
setp timedelay.0.on-delay 0.1
setp timedelay.0.off-delay 0
addf carousel.0 servo-thread
addf conv-float-s32.0 servo-thread
net car-enable motion.digital-out-00 carousel.0.enable  
net car-ready carousel.0.ready motion.digital-in-00
net index carousel.0.sense-0 ppmc.0.din.20.in
net pulse carousel.0.sense-1 timedelay.0.out
net  pulsein ppmc.0.din.23.in timedelay.0.in

net car-pos-req motion.analog-out-00 conv-float-s32.0.in
net car-pos-s32 conv-float-s32.0.out carousel.0.pocket-number

net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed

# RELEASE-BUTTON    DI 32
net release-button  ppmc.0.din.31.in-not or2.0.in0

# Mag ROTATE   
net car-fwd carousel.0.motor-fwd ppmc.0.dout.01.out
net car-rev carousel.0.motor-rev ppmc.0.dout.14.out
# net jog-fwd motion.digital-in-10 ppmc.0.din.29.in

# M66 INPUTS
net spindle-is-oriented motion.digital-in-01 ppmc.0.din.10.in-not
#net spindle-stopped motion.digital-in-09 ppmc.0.din.02.in-not
#net is-z-homed motion.digital-in-08 halui.joint.2.is-homed
net arm-retracted motion.digital-in-02 ppmc.0.din.21.in-not
net arm-extended motion.digital-in-03 ppmc.0.din.22.in-not
net tool-locked motion.digital-in-04 ppmc.0.din.07.in-not
net tool-released motion.digital-in-05 ppmc.0.din.11.in-not
net air-alarm motion.digital-in-06 ppmc.0.din.28.in-not
net air-alarm air-alarm.trigger
setp air-alarm.edge 0

#M62-65   OUTPUTS
net spindle-orient motion.digital-out-01 ppmc.0.dout.05.out
net arm-retract motion.digital-out-02 ppmc.0.dout.12.out
net arm-extend motion.digital-out-03 ppmc.0.dout.13.out
net tool-release motion.digital-out-05 ppmc.0.dout.09.out and2.1.in1 or2.0.in1
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed



[code][code][code] 
[/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code][/code]
Last edit: 10 Dec 2021 03:12 by Jake. Reason: lightbulb.

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

More
10 Dec 2021 04:28 - 10 Dec 2021 04:29 #228754 by Michael
Looks like you made a lot of progress. This is what I can see with your current NGC:
  1. If you have no tool in spindle it skips all of o100 and goes to o200. In o200 I don't see any sort of command to unlock tool. In o100 that command is M64 P5 and you would need that in o200 for when no tool is in the spindle to start. May also need a sensor check to go with it.
  2. Your tool arm maybe retracting because it thinks the pin is true. I would use Hal show or meter to verify the function of the digital input 04 and pay attention that in hal you are using the -not statement which inverts that pins function. In your tool change NGC it is expecting the signal to be true before moving on. My bet is that you don't need the -not statement. But verify by manually tripping the switch while observing Hal show/meter for that pin.
  3. Carousel should home after first use. This may be another input that is or needs to be inverted. If input 20 is true at startup then it thinks it is homed and will carry on. Why do you have the pocket count on a time delay? Also with carousel index mode on you shouldn't need num_sense=2 as that is the default with index mode. Maybe remove that.
  4. You shouldn't need and2 component to make 2 outputs work from a single input. And2 is typically if you would like to make sure 2 inputs are on to feed a single output. Here are some options for the car-rev:

    net car-fwd carousel.0.motor-fwd ppmc.0.dout.01.out
    net car-rev carousel.0.motor-rev ppmc.0.dout.01.out ppmc.0.dout.14.out

    But a better way to do it would be to use the xor2 component.

    net car-fwd <= carousel.0.motor-fwd
    net car-fwd => xor2.0.in0

    net forward-relay-switch <= xor2.0.out
    net forward-relay-switch => ppmc.0.dout.01.out

    net car-rev <= carousel.0.motor-rev
    net car-rev => xor2.0.in1
    net car-rev => ppmc.0.dout.14.out                                                                                                                                                                       
  5. Also here is the logic you would need for your button to work. or2 would be fine but an xor2 would be better as it is exclusive.

    net release-button ppmc.0.din.31.in-not or2.0.in0
    net tool-release motion.digital-out-05 or2.0.in1
    net release-solenoid or2.0.out ppmc.0.dout.09.out
Last edit: 10 Dec 2021 04:29 by Michael.

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

More
11 Dec 2021 00:37 #228834 by Jake
Looks like I have the tool locked issue straightened out. The limit switch was too high and due to a pipe fitting on the assembly the switch was going true false true during the unclamp cycle. So it was true, locked and unlocked, only false in mid travel for a split second.
That should take care of the arm leaving before it should, I think I have the code fixed picking up the first tool, just ran out of time to test

I worked on the XOR's for both the tool unlock and carousel and have not been able to get them to work yet. I'll try again tomorrow....

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

More
11 Dec 2021 03:48 #228842 by Michael
No promises what I wrote is accurate. Check your actual pin values. And also loadrt and addf each instance as necessary.

Sorry I forgot to mention that.
The following user(s) said Thank You: Jake

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

More
12 Dec 2021 02:56 - 12 Dec 2021 02:57 #228899 by Jake
Yeah I starting tweaking some things and had some support lines to add. I got busy dealing with the limit switch. Then got derailed on to something else.....

I should be back out in the shop tomorrow, hopefully I'll get it buttoned up tomorrow. 

Thanks again for the help!
Last edit: 12 Dec 2021 02:57 by Jake.

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

More
12 Dec 2021 19:18 - 12 Dec 2021 19:32 #228939 by Jake
ALMOST THERE!

Carousel forward, reverse working, manual button working!, logic is all correct now, limit switches are happy.

It still will not home the carousel.  It just assumes it is at #1 when you start the machine.  I need to figure this one out.

Need to figure out why when you turn " machine off " I am using AXIS the tool change actions continue.  Only way to stop is estop.  Which they resume when you reset ESTOP.    I do not like having any motion when machine is off.   Also need a way to abort the tool change process if there is an issue, I have to restart LCNC to get it done.  If it errors out on a fault I can do it with 5399.  Or I could just add more 5399 instances in the remap to get out of an error. 

  Any ideas on how to make that better ?


Thanks!
 
Last edit: 12 Dec 2021 19:32 by Jake. Reason: deedadee

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

More
13 Dec 2021 05:19 - 13 Dec 2021 05:22 #228990 by Michael
For the tool changer to stop with e stop you may need to and2 the e stop signal and the the digital motion pin into the carousel.0.enable it is kind of weird that carousel will keep going with e stop

As for the index issue I would disconnect the sensor for the home on the carousel and try and do a tool change. The carousel should hunt for pocket 1 for 60 seconds and then fault out. If it does this the issue is with the sensor. You may have the sensor going high at startup so the carousel component thinks it's homed right at start up. When you look at it in hal show and it's low or false I would imagine that's your issue. Your sensor types may not be the best type for linuxcnc use. You should use PNP NO switches. These will only go true (+voltage to input) when tripped. 
Last edit: 13 Dec 2021 05:22 by Michael.

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

More
14 Dec 2021 20:13 #229074 by Jake
Everything stops with an Estop, but it will resume when the estop is reset ( which it should not do that. ) I am sure there is something I can enhance in the logic to make it reset if an estop condition comes in. It will continue to run if the machine is turned "off" in Axis, which everything else stops, such as motion, spindle, all the pumps...and all controls do nothing.

I am going to go out there in a bit and see what I can do with the carousel homing. The index sensor that is on the rotating mechanism typically always stops in the true state, so it is true on startup. The carousel has no issue counting to the next pocket. I know the sensor on the home position does change states and go true when the pin is there (which is at pocket #24) I need to look to see if I can change that home position from pocket #1 to #24.

I know when the machine is started and "no tool" is shown that is says it is at pocket 0. I am trying to think of how I have these switches wired, I think they are PNP and NO. I will validate that.

I will check the HAL pin to see if carousel.o.homed state is at startup.

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

More
18 Dec 2021 01:02 #229358 by Jake
Got it going, you were right on it seeing that it index was TRUE, I was able to swap it to "in-not" and that took care of that. The only thing is it homes to #24 which is where my pin is. Since my numbers are pretty sorry looking I am just going to renumber the carousel instead.

Now I just need to work through the PC locking up and spindle-at-speed not working and I think I am just about complete.
The following user(s) said Thank You: Michael

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

Time to create page: 0.119 seconds
Powered by Kunena Forum