Using UCCNC to Activate a Pneumatic Valve

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Using UCCNC to Activate a Pneumatic Valve

Postby John Cimino » Sat Aug 26, 2023 4:22 pm

Hi Fellow CNC Enthusiasts,

I am in need of assistance.

I am using UCCNC Software to communicate to a AXBB-E Ethernet Motion Controller.

My DIY CNC Machine runs fine both motion and spindle and I have completed many woodworking projects with it. I have a pneumatic style ATC on my spindle and have been using it manually to make tool changes. I am now wanting to automate the tool changes.

I have built a linear style tool change rack which is currently off of the main cutting area of the CNC machine. A pneumatic rod pushes the rack onto the cutting surface so that the automatic tool change can take place.

The first step of my M6 tool change will be to extend the pneumatic rod and the last step of M6 will be to retract the rod (so the rack will be out of the way of the cutting area).

I have the rod controlled by a simple DC24V air valve (model 4V210-08). This valve will only draw 200mA so I believe I can control it directly from the AXBB-E Isolated Output ports. The valve has been tested manually and moves the ATC linear rack without issue.

Question:

1. The first step is to figure out how to have UCCNC activate the valve and then de-activate it.
2. The second step is to figure out how to incorporate this code into the M6 tool change code. Not sure if it is code within the M6 code or whether it would be separate M commands (one to extend and one to retract the rod). I have reviewed the M6 ATC code that comes with UCCNC and can probably use this as a starting point if I can figure out how to activate and deactivate the valve.

My programming skills are limited so ideally I would like to reference some code that I can customize or incorporate into the M6 code that comes with UCCNC. A wiring diagram would be nice. Instruction on which UCCNC screens need the configurations would also help.


Looking for any help that will put me in the right direction.
John Cimino
 
Posts: 1
Joined: Fri Aug 04, 2023 5:47 pm

Re: Using UCCNC to Activate a Pneumatic Valve

Postby ger21 » Sun Aug 27, 2023 12:07 am

Look at the Default M6 macro in the UCCNC\Profiles\Macro_Default folder.
At the beginning,
Code: Select all
int Chuckopenport = 1;
int Chuckopenpin = 16;

defines the port and pin for your solenoid.

Then
Code: Select all
exec.Setoutpin(Chuckopenport, Chuckopenpin); // Open the chuck with pneumatic valve


And

Code: Select all
exec.Clroutpin(Chuckopenport, Chuckopenpin); // Close the chuck with pneumatic valve
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Using UCCNC to Activate a Pneumatic Valve

Postby mark68 » Sun Aug 27, 2023 4:56 pm

I'm going to have the same set up shortly too, so find this very useful.

If you wanted to build in some safety so that Uccnc knows the rack is in extended position prior to the Atc releasing the tool and also in park postion before machining can resume I presume fit a couple of sensors which is active when the rack is extended/parked, conected the sensors to a port/pin numbers
What would the code be to check the extended pin is active before tool release and if not trigger an E stop condition and also the rack is parked before resuming machining if that's the right method?
mark68
 
Posts: 59
Joined: Tue Oct 22, 2019 10:42 pm
Location: Yorkshire Uk

Re: Using UCCNC to Activate a Pneumatic Valve

Postby dezsoe » Sun Aug 27, 2023 7:23 pm

You just need to check LED states. In the documentation you can find the table of LEDs.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Using UCCNC to Activate a Pneumatic Valve

Postby mark68 » Sun Aug 27, 2023 8:19 pm

dezsoe wrote:You just need to check LED states. In the documentation you can find the table of LEDs.


In the documentation is there also an example of the code to use for this Dezsoe? Not everyone who uses UCCNC can write code.

I'm wondering in the next release if there is better support for machines with ATC, IE a screen set that is already set up for ATC and an easier front end to the software to enable setting up your ATC parameters?
mark68
 
Posts: 59
Joined: Tue Oct 22, 2019 10:42 pm
Location: Yorkshire Uk

Re: Using UCCNC to Activate a Pneumatic Valve

Postby ger21 » Sun Aug 27, 2023 8:48 pm

What would the code be to check the extended pin is active before tool release and if not trigger an E stop condition and also the rack is parked before resuming machining if that's the right method?

Something like this:

Code: Select all
bool Sensor1OK = AS3.GetLED(750); // Check if sensor is active

if (!Sensor1OK)
   {
   MessageBox.Show (exec.mainform, "Sensor 1 Not Active", "Sensor 1 Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
   exec.AddStatusmessage("Sensor 1 Not Active");
   exec.Wait(250); // Wait 1/4 sec
   exec.Stop();
   exec.Callbutton(144); // Put machine in Reset mode
   return;
   }
   
DialogResult result;
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Using UCCNC to Activate a Pneumatic Valve

Postby dezsoe » Sun Aug 27, 2023 10:57 pm

Gerry wrote you a sample: use the exec.GetLED(nnn) function to check any pin state. Here is a table where you can find the LED numbers for a given motion controller port and pin.

Some years ago I started to write an ATC plugin which you could configure for your ATC, but I could not finish it. Since I started to work on it I programmed a lot of ATCs and I had to see that there are so many different ATC constructions that cannot be included in one general program. Now I know that I have to start it again (there were too many fundamental changes) and make it ready for the most popular constructions only.
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary


Return to Macros

Who is online

Users browsing this forum: No registered users and 19 guests