Manual tool changing with switch

More
16 Mar 2024 09:46 #296037 by GethoW
Hi,

I currently have a ATC spindle that requires a specific order of operations to complete a toolchange, ie activate different solenoids for different periods of time, etc. I have all the solenoids connected to relays and configured on a flexi-hal board. These pins are defined in linuxcnc and work correctly to activate things manually (M64/M65).

I don't plan on using a rack or carosel at this time, and will do the toolchanges manually. What I'd like to do is have a physical switch that I can toggle on, which starts the process by activating a solenoid, swap the tool,  toggle the switch off which completes the toolchange by deactivating the solenoid and activates another one for a certain period of time.

I'd like to have this logic in linuxcnc, so then I can incorporate some safety features, like check the spindle is not running, etc.

What would be the best way of going about this? Is there any components that this might fit with? Or would I need to write something?

The other option is I create a breakout board with a microcontroller that does all the changing logic and can read the spindle state from linuxcnc using an output pin. This would probably also have the advantage of being able to be used without linuxcnc running.

Thanks.

 

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

More
16 Mar 2024 10:39 #296045 by andypugh
This would probably be a good use-case for Classic Ladder, but I can't advise beyond that as I have never used it.

I would write a custom HAL component. Probably in the ".comp" preprocessor language (basically C) (because I am familiar with it) but you could do this in Python if you prefer, which makes waiting a bit easier.

You can't wait in a C realtime component, you have to write a state-machine, which ends up looking a bit like this:
static int sequence;
static double timer;
...
switch sequence {
...
case 0:
...
case 11:
if (condition == true){
   timer = 2; // two second pause in state 12
   sequence = 12;
}
break;
case 12; // waiting 
    timer -= fperiod
    if (timer > 0) break;
    case = 13;
case 13:
....
}

linuxcnc.org/docs/stable/html/hal/comp.html

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

More
16 Mar 2024 10:46 #296046 by GethoW
I've very familiar with C, so I'll look into creating a custom component.

Thanks for the bump in the right direction

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

Time to create page: 0.218 seconds
Powered by Kunena Forum