Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: irondesk40 on April 18, 2019, 09:50:41 AM

Title: Remote Input to Start and output when complete
Post by: irondesk40 on April 18, 2019, 09:50:41 AM
Have a question i hope someone can assist with.
Have a machine we purchased from Cncrouter parts, its a Pro table with a x,y,z axis and is a very well built machine.
machine is operational and have been able to create g code files from 3d image files and run on the machine.
At the moment i have a ink pen mounted on the end of the z axis that is used to draw the pattern on a sheet of paper just to test and make sure everything is working.
Will be looking at mounting a floor mounted extruder machine and run a hose from it to the z axis and attach to the end of the z axis.
When machine is started, will start the extruder and extruder material to duplicate what was drawed on the paper.
At the moment,, starting the print from the Mach 3 screen.
is there a way to use the Mach3 to load the G code file and then a remote input such as from a push button etc. be wired into the machine to start the print cycle.
Title: Re: Remote Input to Start and output when complete
Post by: reuelt on April 20, 2019, 12:03:45 PM
Have a question i hope someone can assist with.
Have a machine we purchased from Cncrouter parts, its a Pro table with a x,y,z axis and is a very well built machine.
machine is operational and have been able to create g code files from 3d image files and run on the machine.
At the moment i have a ink pen mounted on the end of the z axis that is used to draw the pattern on a sheet of paper just to test and make sure everything is working.
Will be looking at mounting a floor mounted extruder machine and run a hose from it to the z axis and attach to the end of the z axis.
When machine is started, will start the extruder and extruder material to duplicate what was drawed on the paper.
At the moment,, starting the print from the Mach 3 screen.
is there a way to use the Mach3 to load the G code file and then a remote input such as from a push button etc. be wired into the machine to start the print cycle.

Why not Read this thread for Ideas
https://www.machsupport.com/forum/index.php?topic=8252.msg52260#msg52260
Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 26, 2019, 12:24:41 PM
Still trying to figure out a simple way and not being very familiar with Gcode etc..., but learning more by reading info on this site.

I was reading about a M30 command. That the best i can tell if you put this at the end of a Gcode program and once the program was completed it would automatically have the Gcode program restart at the first of the Gcode.
Is there a Gcode type command that could be added at the beginning of the program - Wait for input to go true and if that input went true then start running and executing the Gcode program again.
If so, can you assign the start to a input in mach3?
Thanks for any advice.
Title: Re: Remote Input to Start and output when complete
Post by: Overloaded on April 26, 2019, 01:50:02 PM
I was reading about a M30 command. That the best i can tell if you put this at the end of a Gcode program and once the program was completed it would automatically have the Gcode program restart at the first of the Gcode.
M30 rewinds the file to the beginning, and stops there. Press Run to run the file again.
M47 rewinds and runs the file automatically.   over and over.
You can have a remote start button to start the file.
Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 26, 2019, 02:03:14 PM
Thanks
I was reading some other post on the web and saw where it was mentioned that you could go into Config-Ports&Pins-Input Signals and assign for example Port#1 Pin 12 to OEM Trig#1 if you Enabled OEM Trig#1.

Then go into Config-System Hot Keys and place a value of 1000 which is the "Hotkey number" for a particular keyboard function, which I assume the 1000 value = The Cycle Start Pushbutton on the Mach3 screen.
 
Have not tried this yet. Is there a way to know what the Hotkey number value is for a particular keyboard function in mach3?
Thanks for any advice.  Still learning a little at a time, but at the moment having to try and work on this between projects so any assistance is appreciated.
Title: Re: Remote Input to Start and output when complete
Post by: reuelt on April 26, 2019, 02:26:12 PM

Is there a Gcode type command that could be added at the beginning of the program - Wait for input to go true and if that input went true then start running and executing the Gcode program again.
If so, can you assign the start to a input in mach3?

Miscellaneous functions, called M codes, are used by
the CNC to command on/off signals to the machine
functions.
i.e.
MØ3 - spindle forward (CW),
MØ5 - spindle stop stop, etc.....
M07 -  mist coolant on
M08 -  Flood coolant on
M09 - All coolant off

You would note that M## codes normally output a signal to a pin of a parallel port that can be used in the Break Out Board (BOB) to control a RELAY on or off.
So the RELAY is what will "push the button" to on your extruder or conveyor belt to load material etc

Attached is the MACH3 std M-codes list.

Std M codes can be edited (modified) and you can also create your own (higher number) M codes too.

But for your requirements, you can for simplicity (& proof of concept) initially adapt
M03 or M04 to on  and M5 to off
M07 or M08 to on and M9 to off
YOUR extruder machine.
The PWM or 0-10V output can be used to control the flow rate of the extruder material

You could use G4 to wait

To further assist you, it would be good that you let us know your motion controller (parallel port or ext USB or ext Ethernet) and BOB brand and model.



Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 26, 2019, 03:23:42 PM
thanks
What we actually have is a Pro48 table from Cncrouterparts with the Nema34 Electronics kit.
It has Cncrouterparts custom breakout boards but is using EthernetSmoothStepper for the brains.
Really nice unit. We have been testing our theory of using the extruder etc.. to prove some concepts for new products we looking at producing and it has worked great for that.
You have to manually load the material and push the Cycle Start on the Mach3 interface which is okay, except for testing to produce a production machine. Looking at Automatically feeding the material, etc.. and then once in place, start the Cncrouter machine with a remote dry contact relay which is controlled by a PLC.
Basically, with the external extruder hose mounted on the Z axis instead of actual Spindle it will function very similar to 3D printer.  I can handle the Automation of feeding material in automatically at a exact position everytime and removing it and feeding more material in since my background is Allen Bradley and Omron PLC controls etc... but trying to figure out a way to start the Cncrounter mach3 program etc..
Thanks for your assistance and posting the attachment
Title: Re: Remote Input to Start and output when complete
Post by: reuelt on April 26, 2019, 04:20:37 PM
[CycleStart] is Alt-R on keyboard
So what you need to do is
connect a relay to an unused INPUT pin.
Then assign an OEM Trigger to it in INPUT SIGNALS settings of ports and pins say OEM_Trig#1
Then make the OEM_Trig#1  emulate keyboard scan code of Alt-R which is 1000.
see attached

Then your PLC triggering a relay (connected to OEM_trig#1  pin) should be able to remotely [CYCLE-START] loaded Mach3 program.

Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 26, 2019, 07:28:30 PM
Thanks
Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 26, 2019, 07:30:57 PM
is there a way to get a output from the mach3 to let you know the cycle is complete.
what i had thought about was at the end of each program add the Gcode to go to a certain position and have the axis trigger a prox switch that could be used to signal the cycle is complete, automatically remove the product and move another in place, then trigger machine again and continue operation.
Title: Re: Remote Input to Start and output when complete
Post by: reuelt on April 27, 2019, 01:47:18 AM
There are many ways
here is one possible way:-
You can install one relay to one of OUTPUT#1 to OUTPUT#20 in ports and pins.
Then write a custom M### code to turn on the relay and another to turn off the relay
( using a free macro name from  M791 - M798)

say it is M797 turns on relay
and M798 turns off relay

Then,
you can add M998
before you end your program with M30

and add M997 when you start the program.
Title: Re: Remote Input to Start and output when complete
Post by: irondesk40 on April 29, 2019, 08:10:24 AM
Thanks to everyone. This site is pretty awesome. Trying to work on this and design a Vision Camera system at the same time and its a little confusing when you can not dedicate all of your time. Actually, this is a lot more interesting and fun.
All of the info has been very helpful.  not very up on VB and doing custom macro programs.  is there any reading material or some type of Macro for dummy book related to Gcode type programming?   Thanks
Would it be too much to ask if you wrote an example of the above macro? Not asking to actually do it for me, but a sample similar would be very helpful. Sample programs, schematics etc. like what is on here and a couple of other great Forums I use such as Plc.net and Mr.Plc are worth a lot more and very helpful.
Title: Re: Remote Input to Start and output when complete
Post by: TPS on April 29, 2019, 02:16:44 PM
code to turn a Output ON

Code: [Select]
Sub Main()
 ActivateSignal(Output1)
End Sub

code to turn a Output OFF

Code: [Select]
Sub Main()
 DeactivateSignal(Output1)
End Sub

feel free to read any manual