Almost all CNC machines are equipped with central lubrication system and as all you know it serves to deliver small oil portions to specific locations at specific times. 

ikon-rar   MacroPump EN

There are many types of lubrication systems but we are not going to describe their operation here as it’s very wide topic. The majority of our customers retrofit machines equipped with original lubrication system or they build CNC machines in which they provide their own idea lubrication system. In both cases the system – an oil pump in fact – must be controlled some way. The oil pump control is just about activating it at specified time periods to lubricate oil in the lubrication area. We can control it through PLC or some easy timing systems but such a solution complicates machine construction or generates additional costs completely unnecessarily.

Here we have Mach3 software with its VB macros support, or more precisely – macropump.m1s. It’s a macro performed in constant loop and this way it can run unnoticed in the Mach3 background and for example control the oil pomp in the time.

To control the oil pump we need one digital output of CSMIO/IP motion controller.

I chose an output number 0 but you can use any other digital output for the pomp control, you only need to set the number in the macropump.m1s.

CSMIO/IP controller digital output should be connected coil pins of a relay which will enable the pomp power supply. If the relay’s coil doesn’t have a diode that eliminates over-voltages – you should connect it.  The diode and the entire pomp control system connection you can see in the pictures below: 

  Open PDF file with larger drawing details

CSMIO-IP-S-A kolumna


As you can see the pomp and the relay connection is simple and shouldn’t be difficult for anyone.


At this stage we have electrical installation is ready and all we need to do is to create a VB macro to control CSMIO/IP controller digital output. The picture below presents a ready macro:

smarowanie usa

Automatic lubrication macro is based on these three variables:

CurrentMs      – Current time from  GetTickCount( ) function

LastMs            – Last selected “Case” duration.

State               – Last selected “Case” duration number.


If we add another two constants then we get all needed data to create an algorithm  for a pomp control.

LubeTime        – Lubrication time is the time the pomp should supply the oil.

LubeWait        – Lubrication interval- the time in which the pomp doesn’t supply the oil.


The macro operation is about continuous time getting from GetTickCount( ) function and at „If” conditions – verifying if lubrication time came, if lubrication should be started or finished.  To make sure the „If” conditions weren’t verified at the wrong time they were placed in multiple „Case” choice conditions.When you realize that the macro works in continuous loop then you’ll see that the macro is easy and reliable.

 pętla usa

The Macropump that is macropump.m1s file should be placed in „C:\Mach3\macros\name of the file we use” folder, so it could start running we have to only activate „Config\Generlal Config\Run Macro Pump” function and restart Mach3.



Click one of our contacts below to chat on WhatsApp

× How can I help you?