======MQL - Minimum Quantity Lubrication====== {{youtube>0NRn-5vOnkU?large}} myCNC software allows the user to implement MQL, or Minimum Quantity Lubrication, on their machines. MQL is a process in which tiny drops of high-quality aerosol lubricant are sprayed over the cutting tool and the material, providing lubrication at extremely low rates of lubricant use. This allows for a greatly reduced fluid usage (with the workpiece being nearly dry throughout the lubrication process) as opposed to typical flood setups, resulting in a greener environmental impact and eliminating the need for fluid disposal. MQL is available in myCNC software by going into the Step/Dir Coolant control tab within User Settings, where you can set the coolant rate. {{:mycnc:mql-002-user-settings.png}} The fine-tuning is done through the built-in PLC procedures, with the setup described in detail in the [[mycnc:independent_pulse_generator|Independent Pulse Generator]] manual. In certain profiles (such as the X1366M4E), the MQL functionality is accessible via the main myCNC screen (in the Coordinates section): {{:mycnc:mql-002-main-screen-x1366m4e.png}} This on-screen element displays the current Flood Coolant Rate (global variable #8133). A series of hotkeys can also be assigned within the myCNC software to quickly control the flood rate. This can be done by going into Settings > Config > Panel/Pendant > Hotkeys, and assigning two new keyboard shortcuts with the following actions: cnc-gvariable-inc-8133 and cnc-gvariable-dec-8133 The following screenshot shows an example configuration of two key bindings to increase and decrease the flood rate: {{:mycnc:mql-003-hotkeys.png}} This will allow the user to quickly change the coolant flood rate from their keyboard. ====MQL Setup in myCNC software==== This section has been copied from the Independent Pulse Generator manual linked above. === Software PLC for MQL === The rate, ratio and acceleration can be set up in the Software PLC, as well as in the User Settings widget (the Step-Dir Coolant Control section). "HANDLER_INIT.plc" procedure is started just after the configuration is sent to the myCNC controller. A few lines to set up the Frequency generator can be added there. ++++ Show HANDLER_INIT code | main() { gvarset(60000,1);//run Servo ON procedure gvarset(8131, 8000); //set Frequency acceleration gvarset(8132, 1359); //set Ratio gvarset(8133, 0); //Off the Generator. exit(99); }; ++++ === Hardware PLC for MQL === In addition to the software HANDLER_INIT PLC, certain hardware PLC procedures must be changed for the Minimum Quantity Lubrication to be set up. Function ''coolant_motor_start()'' is added to the ''mill-func.h'' file: ++++ Show mill-func.h code | coolant_motor_start() { timer=10;do{timer--;}while(timer>0); gvarset(8131,1000000); //acceleration timer=10;do{timer--;}while(timer>0); x=gvarget(8133);//get the speed (frequency) k=gvarget(8132);//get the ratio x=x*k; //calculate the RAW frequency gvarset(8130,x); //send the raw frequency to the register timer=30;do{timer--;}while(timer>0); //wait a time for the frequency value to be delivered }; ++++ ''M08.plc'' procedure which starts the coolant motor would be the following (//note the inclusion of mill-func.h at the beginning of the code//): ++++ Show M08 code | #include pins.h #include mill-func.h main() { gvarset(7372,1); portset(OUTPUT_FLOOD); // coolant_motor_start(); exit(99); //normal exit }; ++++ A procedure ''M09.plc'' to stop a coolant motor is simpler - we simply need to write "0" to the raw frequency register. ++++ Show M09 code | #include pins.h main() { gvarset(7373,0); gvarset(7372,0); portclr(OUTPUT_FLOOD); portclr(OUTPUT_MIST); gvarset(8130,0); //stop the pulse generator timer=30;do{timer--;}while(timer>0); //wait a time for the frequency value to be delivered exit(99); //normal exit }; ++++ This concludes the software setup for MQL within the myCNC software.