Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: jelle_bos on July 22, 2019, 07:03:44 AM

Title: Mach4 automatic ways oiler
Post by: jelle_bos on July 22, 2019, 07:03:44 AM
Dear people,

I am using mach4 to retrofit an machine. There is an oiling system on the machine to oil the ways where the axis ride on. I want to turn on the oiler for a set time when the machine reaches an certain total run time.

The only problem is that I am unsure what variable I need to use from the mach4 API. I am also unsure how to program a counter in Lua.
If someone knows or has some ideas, feel free to reply

Thanks in advance
Title: Re: Mach4 automatic ways oiler
Post by: Ya-Nvr-No on July 22, 2019, 08:07:48 AM
Why not do a Bing or Google image search for
"ladder diagram for way lube timer"
and then emulate the ladder code using the PMC scripting/ladder feature in Mach4 to write the code for you?
Might help you learn and understand how timers and lua works.
would be a good test and lesson.
Title: Re: Mach4 automatic ways oiler
Post by: jelle_bos on July 23, 2019, 09:44:31 AM
Why not do a Bing or Google image search for
"ladder diagram for way lube timer"
and then emulate the ladder code using the PMC scripting/ladder feature in Mach4 to write the code for you?
Might help you learn and understand how timers and lua works.
would be a good test and lesson.

Thanks I totally forgot about the pcm editor. Tried a diagram which turns on when the controller is enabled and then generated a Lua code.
The code worked flawlessly. Thanks again.
Title: Re: Mach4 automatic ways oiler
Post by: Cbyrdtopper on July 24, 2019, 10:02:40 PM
Glad you got it working.
Post your code to help others that may have the same question.
Title: Re: Mach4 automatic ways oiler
Post by: jelle_bos on July 25, 2019, 04:09:54 AM
For the people wanting to use a similair code. Here is the lua file. I can't upload a pmc file.

The program is activated when the controller is enabled.  The first timer will determine at which interval the pump is enabled and the second timer sets how long the pump is activated before it will be deactivated and the interval timer will be reset.
The timers are both set to 10 seconds.

Title: Re: Mach4 automatic ways oiler
Post by: jelle_bos on July 25, 2019, 01:51:47 PM
I forgot to add that the program is made to control the outputs on an output device. The device I use is the csmio-ip/a. I could send the pcm program via mail if someone wants it.  Then you can change the outputs to your device and makes it easier to change the time of the timers.

Just let me know if you want the pcm program. I will change the names/variables to English instead of Dutch.
Title: Re: Mach4 automatic ways oiler
Post by: Chaoticone on July 25, 2019, 04:07:01 PM
I just added pmc to the allowed attachment file type list............. if you want to try attaching it again. I'm pretty sure it was added before as pcm. If computers are so smart I don't know why they don't know what we were trying to say.  ;D

Garbage in = garbage out.
Title: Re: Mach4 automatic ways oiler
Post by: TOTALLYRC on July 25, 2019, 08:49:24 PM
I just added pmc to the allowed attachment file type list............. if you want to try attaching it again. I'm pretty sure it was added before as pcm. If computers are so smart I don't know why they don't know what we were trying to say.  ;D


ROFLMAO :)

Garbage in = garbage out.
Title: Re: Mach4 automatic ways oiler
Post by: jelle_bos on July 26, 2019, 06:37:02 AM
Guys, Here is the Pmc file for the ways oiler with english variables. The pump is enabled after 15 min controller enabled time. The oilpump will be activated for 1 minute.

Inside the Pmc file are two time on delays. The upper on determines the time interval that activates the oilpump and the lower one sets the time how long the oil pump is enabled.

Hope this helps some people out.
Title: Re: Mach4 automatic ways oiler
Post by: Ya-Nvr-No on July 26, 2019, 08:11:40 AM
Just a heads up on what I found on sharing, testing and using pmc files:

File names need to have no spaces, as function names are created on generating the Lua file.
During simulation I noticed NO update on outputs on diagnostics tab
also I had to edit the data for contacts and coils for Device and Object as they came up blank.
In live Simulation mode still have to use the space bar to update the simulation of ladder diagram.

thanks for following though and sharing as we all learn by experiences of others.

photos show comparisons of the original, my edited version and what I referenced.

and thanks to Chaoticone for adding PMC file uploads  ::)
Title: Re: Mach4 automatic ways oiler
Post by: jelle_bos on July 26, 2019, 08:21:48 AM
Thanks for the reply. I just edited the names to match somewhat in English. I use the csmio controller and io so maybe that's why the coils and contacts came up blank.

The csmio has an internal diagnostics and io monitoring window. The pcm does work with that diagnostic window from the csmio. I haven't tried it with the mach4 diagnostics because I use the internal csmio window.

Hope people can figure out the program for there setup otherwise feel free to post here.
Title: Re: Mach4 automatic ways oiler
Post by: mark4 on July 29, 2019, 11:04:26 PM
As I read one question comes to mind. how did the way oiler work to begin with. Do you have axes to an original manual that might tell you its interval or what Triggers it. On a Bridgeport knee mill the oilier was originally attached to the contactor for the spindle. I with some help wrote a program in the plc script to run the oiler timer whenever an axis is moved. Because we can do probing and that does not use the spindle. Luck
Title: Re: Mach4 automatic ways oiler
Post by: metlcutr55 on July 31, 2019, 08:45:52 PM
my cnc knee mill ran on a mectronix card 8+ hours a day for 10 yrs, and the folk who built it had the oiler run about 8x a day for about a minute.  this is a good discussion for making the software maintain a schedule you can decide on.  but I lived with the consequences of their 8 x 1 schedule which was excessive oil on the ways and on the motors and in the coolant.  when/if I get this thing running again on either mach or uccnc, my oiler system will be set to run once a day on turn on, and if it is a programming pita, I will leave it out, mount a spring loaded button on the oiler, and hold it down for 30 sec every morning I run.  yes the ways need oil.  most of these machines here could live with an oil wipe by rag every morning.  sometimes the best way to work is k.i.s.s.   jmho, ymmv.