I have a Unist cool lube Jr. MQL system on order for my HDM and I am hoping there is a way to have the carbide control board trigger a relay board connected to a 1/2" 12v air solenoid when the spindle is running so I don’t have to babysit the air valve.
Can anyone point me in the right direction? I already have a 12v solenoid valve and Meanwell power supply from a previous project but I will buy a 110v valve if I have to. I am hoping it won’t require custom gcode and that the spindle PWM signal wire can be spliced with a Y connector and used to trigger a relay board and still control the VFD. I am not 100% sure how to do this so I thought I’d ask those with electrical engineering knowledge so I don’t risk any damage to my new machine or void my warranty.
Maybe someone will pop in with a better solution but all I can come up with for what you asked is to make an adapter that consumes the PWM signal, outputs the PWM signal again and also outputs a relay signal.
To do it nicely with screw/push terminals would require manufacturing a custom PCB, which is a bit of a learning curve but not actually that hard these days.
The alternative would need some capacitor magic that I don’t understand, along with a MOSFET or something to turn a logic signal into a suitable voltage/current for a solenoid.
But I’d take a look at the VFD manual. My VFDs have a bunch of smart I/O ports that can be triggered by, for example, the spindle being enabled. If yours has such a feature you might be able to hook it up that way, which would be much easier.
Hopefully Luke or Winston will chime in when they have a moment with a simple and affordable solution. A good friend ordered the MQL for me as a Thank you other wise I’d be using my Amazon special spit cannon. With the Cool lube being $90.00 a gallon I want to make sure only exactly what is needed is being sprayed.
The fundamentals here are: the PWM output from the controller is a 3.3v (maybe 5v) pulse-width modulated signal and not directly suitable to drive a relay. Something that ‘recognises’ the pulses and above a certain threshold creates a relay-suitable (high-ish current) control signal is needed.
BitRunner is exactly such a device, but as noted it contains the relay and provides AC/110 output which means your 12v valve will not be suited. I don’t know if it also outputs a low voltage signal that could drive your solenoid valve or not - I don’t have a BitRunner to look at.
There are two other signals inherent to the GRBL control software - Mist and Flood. I don’t know if these signals are available on the ShapeOKO/HDM controller board, they are on my 3rd party control board (I changed it so I could have a rotary axis in addition to XYYZ). I also don’t know if CC and CM support Mist and Flood, but other senders do and the GRBL command language does support this if CC can. Fusion 360 does, unsure of others.
The only thing to watch out for in RC controllers is that their PWM is not the linear proportional PWM used by GRBL/CM, rather it is a centred PWM where shorter or longer than centre pulse width is considered positive or negative mechanical movement and the core frequency is pretty much a standard. If the ShapeOKO PWM frequency falls somewhere near, then this may work but would need a closer look to be sure.
EDIT: RC servo control ports typically operate on a 1000uS - 2000uS pulse width, repeated in a 20mS cycle (50Hz). GRBL as typically found on Arduino Uno operates a 7.8KHz cycle (128uS) and PWM for 255 steps is therefore 500nS step size. These aren’t going to be compatible.
I believe the best bet will be a ‘relay turns on in the presence of some PWM’ relay or MOSFET module, as @Moded1952 observed. What defines ‘some PWM’ then remains the question.
I’m curious about this ‘eavesdrop the PWM line’ to provide a switch for an external system (such as a solenoid valve) and have some bits coming to experiment with making such a ‘switch’. Looking at using an ATTiny85 to synch (poor man’s PLL) onto the rising and secondly the falling edges of the PWM signal so such a solution could work universally with the two standard GRBL PWM frequencies (1.0KHz and 7.8KHz), and possibly also with the standard RC frequency (50Hz). Using the ATTiny would also permit a ‘up/down’ button user ability to choose which PWM threshold above which to ‘switch on’. It’s a bit of fun, but others may find the solution of interest…
I have a prototype of this PWM eavesdropping switch up and working, using an ATTiny85 to positively identify the 2 standard (7.8KHz GRBL1.1, 1KHz GRBL >1.1f 32-bit) and 1 less-common (RC 50Hz) PWM frequencies, switching thresholds, and some safety rules around switching on an isolated relay contact (safety first…).
Now to test on my machine (3XL/HDZ) with other electrical equipment powering on and off to establish robustness/electrical noise tolerance, and will then work up a ‘you can make this too’ post.
Bench testing of this PWM to Relay switching device shows it is solid and reliable. Now to spin up on the machine and ensure ‘real world’ EMC/noise doesn’t change that. Will then publish what I have and see where it goes from there.
Update: My PWM sensing relay has been running on my S3XL/HDZ with VFD for several significant jobs now, and has not missed a beat. It always switches on the moment a PWM signal above 0% appears, whether 7.8KHz (8-bit generation controllers, GRBL pre-1.1f) or 1KHz (seems the norm on the newer 32-bit controllers), and it will also, I believe, respond to a Remote Control 50Hz signal appearing.
Simple, few parts, uncomplicated software, inherently safe (if you count automated switching of whatever you connect to the relays in your view of ‘safe’).
When I get a chance I will document the project and upload it here. It needs a degree of electronics knowledge/skills, and familiarity with uploading Arduino/Atmel/ATTiny85 code. Nothing in it is rocket-science, but as someone once said ‘winning the lottery is easy if you know the numbers to use’.