Mitsubishi Electric
Published

Monitoring Time for Preventive Maintenance Tasks

Not all maintenance tasks should be performed based on a calendar date. You can use a custom macro to monitor your machines.

Share

Machine builders recommend preventive maintenance (PM) tasks that you should perform and the intervals at which you should perform them. Common tasks include CNC and encoder backup-battery replacement, air/oil filter replacement, way lube replenishment, hydraulic system oil replacement, coolant replenishment/replacement, and inspection and cleaning of key machine components, such as the spindle, way system and others.

It doesn’t make sense to perform certain PM tasks based on calendar dates since machines can often sit idle or be turned off for long periods of time. A more logical approach is to monitor certain PM issues on an individual basis, based upon specific criteria related to the machine function requiring maintenance. With spindle bearing inspection, for instance, spindle run time should be the determining factor.

Many modern CNCs do have comprehensive PM programs built in, and there are many software-based machine monitoring systems that can provide PM data. Some may allow you to specify intervals for the various tasks and even alert you when the interval has elapsed. However, with older FANUC or FANUC-compatible CNCs or if you want to take full control of a given PM issue, you can do so using custom macro.

Our example utilizes the custom macro presented in the May column. It makes an excellent way to monitor the passage of time, converting date and time into the number of hours since the beginning of 2019. Consider this command that calls the date/time converting custom macro:

  • G65 P9060 D#3011 T#3012 H531.0

The current time in hours since the beginning of 2019 will be placed in permanent common variable #531.

Here are the variables used to track the four PM tasks for our example, based upon four different criteria.

PM Task:

Interval:

Started:

Current Time:

Monitored by:

Battery change

#521

#531

#541

Total elapsed time

Change coolant

#522

#532

#542

Coolant on time

Inspect spindle bearing

#523

#533

#543

Spindle on time

Inspect way system

#524

#534

#544

Machine in-cycle time

 

Specifying intervals

This program can be run once to specify intervals for PM tasks based on machine builder recommendations:

  • O0032
  • #521=8736.0 (replace CNC battery)
  • #522=3000.0 (change coolant)
  • #523=6000.0 (inspect spindle bearings)
  • #524=5000.0 (inspect way system)
  • M30

Initializing

Another program is needed to initialize the system and to reset the monitoring variable for PM tasks when they have been completed. After performing maintenance, the operator must scan to the appropriate sequence number for the task to reset. N1: Battery replacement, N2: Coolant change, N3: Spindle bearing inspection, N4: Way system inspection.

  • %
  • O0033
  • N1 (Reset battery time)
  • G65 P9060 D#3011 T#3012 H531.0
  • #541=0
  • M30
  •  
  • N2 (Reset coolant change time)
  • G65 P9060 D#3011 T#3012 H532.0
  • #542=0
  • M30
  •  
  • N3 (Reset spindle bearing time)
  • G65 P9060 D#3011 T#3012 H533.0
  • #543=0
  • M30
  •  
  • N4 (Reset way system time)
  • G65 P9060 D#3011 T#3012 H534.0
  • #544=0
  • M30
  • %

Updating

Machine functions require different updating methods.

Battery change: We can update total elapse time every time a program is run by using a user-defined M code for the end of program word: M30.

Coolant change: We can update coolant-on time in user-defined M codes that turn the coolant on and off (M08/M09).

Spindle bearing inspection: We can update spindle-on time in user-defined M codes that turn the spindle on and off (M03/M04/M05/M19/M06).

Way system inspection: We can update in-cycle time in user-defined G or M codes that are executed only at the beginning and end of the program, like G20/G21 and M30.

User-defined G- and M-code programs

These programs will run when the designated G or M code is executed. A parameter specifies which G or M code is related to each program. With current FANUC CNCs, parameter 6071 specifies the value of the M code that will execute program O9001. If you set parameter 6071 to 30, for instance, the CNC will run program O9001 whenever an M30 is executed.

  • O9001 (M30)
  • G65 P9060 D#3011 T#3012 H141.0
  • #541=#141-#531 (Current total elapsed time)
  • #544=#544+[#141-#140]
  • M30
  • M99
  • O9011 (G20 or G21 at program start)
  • G65 P9060 D#3011 T#3012 H140.0
  • G20 (or G21)
  • M99
  • O9002 (Coolant start M08)
  • G65 P9060 D#3011 T#3012 H142.0
  • M08
  • M99
  • O9003(Coolant stop M09)
  • G65 P9060 D#3011 T#3012 H143.0
  • #542=#542+[#143-#142]
  • M09
  • M99
  • O9004 (Spindle start M03 or M04)
  • G65 P9060 D#3011 T#3012 H144.0
  • M03 (or M04)
  • M99
  • O9005(Spindle stop M05 or M19 or M06)
  • G65 P9060 D#3011 T#3012 H145.0
  • #544=#544+[#145-#144]
  • M19 (or M05 or M06)
  • M99

Monitoring and testing

Finally, there must be a way to alert maintenance personnel when a PM task is required. You could place the detection sequence in machining programs, but to keep from disrupting a production run, it may be better to create a separate program. The operator or a maintenance person will run the detection program when they want to find out if PM tasks are required.

  • O100 (Detection program)
  • IF[#541LE#521] GOTO 5
  • #3000=101(REPLACE BATTERY)
  • N5 [IF#542LE#522] GOTO 10
  • #3000=102(REPLACE COOLANT)
  • N10 IF[#543LE#523] GOTO 15
  • #3000=103(INSPECT SPINDLE BEARINGS)
  • N15 IF[#544LE#524] GOTO 20
  • #3000=104(INSPECT WAY SYSTEM)
  • N20 #3000=105(NO MAINTENANCE REQUIRED)
  • M30
Mitsubishi Electric
The Automated Shop Conference
High Accuracy Linear Encoders
DN Solutions
MMS Made in the USA
JTEKT
OASIS Inspection Systems
An ad for Formnext Chicago on April 8-10, 2025.
SolidCAM
Gardner Business Intelligence
Techspex
BIMU 2024

Related Content

Sponsored

Swiss-Type Control Uses CNC Data to Improve Efficiency

Advanced controls for Swiss-type CNC lathes uses machine data to prevent tool collisions, saving setup time and scrap costs.

Read More

5 Reasons Why You Should Know How to Write Custom Macros

Custom macros enhance what can be done in G-code programs, giving users the ability to code operations that were previously not possible.

Read More

Generating a Digital Twin in the CNC

New control technology captures critical data about a machining process and uses it to create a 3D graphical representation of the finished workpiece. This new type of digital twin helps relate machining results to machine performance, leading to better decisions on the shop floor.

Read More
Five-Axis

6 Machine Shop Essentials to Stay Competitive

If you want to streamline production and be competitive in the industry, you will need far more than a standard three-axis CNC mill or two-axis CNC lathe and a few measuring tools.

Read More

Read Next

Micromachining

A History of Precision: The Invention and Evolution of Swiss-Style Machining

In the late 1800s, a new technology — Swiss-type machines — emerged to serve Switzerland’s growing watchmaking industry. Today, Swiss-machined parts are ubiquitous, and there’s a good reason for that: No other machining technology can produce tiny, complex components more efficiently or at higher quality.

Read More

3 Mistakes That Cause CNC Programs to Fail

Despite enhancements to manufacturing technology, there are still issues today that can cause programs to fail. These failures can cause lost time, scrapped parts, damaged machines and even injured operators.

Read More
Mitsubishi Electric