I want to make a programmable coolant system similar to spidercool dot com. I am thinking about making a coolant nozzle that will swivel using a servo, or stepper motor. I would like to be able to position the nozzle both manually, and automatically using the CNC control. I have a limited number of outputs from the control that will cycle a relay when the code is run in the machine. I am thinking I can use the relay cycling to position the nozzle from the cnc program. Can someone help me with this?
I want to make a programmable coolant system similar to spidercool dot com. I am thinking about making a coolant nozzle that will swivel using a servo, or stepper motor. I would like to be able to position the nozzle both manually, and automatically using the CNC control.
I'm following, so far.
I have a limited number of outputs from the control that will cycle a relay when the code is run in the machine.
Now, I'm lost. What control? What relay? What code? What code? What machine?
I am thinking I can use the relay cycling to position the nozzle from the cnc program.
What is the relay going to control? What instruction is going to be in the CNC program to activate the relay?
Now, I'm lost. What control? What relay? What code? What code? What machine?
The control on the CNC machine. I want to retrofit the servo control to an existing CNC. It has relays that can be opened and closed during the execution of a CNC program by inserting an "M-code" between blocks.
What is the relay going to control? What instruction is going to be in the CNC program to activate the relay?
What does this have to do with Arduino?
I want to open and close the relay to indicate to the Arduino how much I want the nozel to move. For example open and close the relay once--the nozzel moves 10 degrees. Open and close the relay twice--the nozzel moves 20 degrees. Open and close a second relay--the nozzle returns to zero.
Basically, you're going to want to wire each relay contacts up to the Arduino to digital inputs, and use code similar to the switch debounce examples to detect the open-close cycle of the relay contacts; the contacts would be connected between the digital i/o pin on the Arduino and either 5V or ground (with appropriate pull-up/down resistors as needed), depending on if you want to detect active highs or lows.
For simplicity sake, I would just connect the pin to one relay contact (NO), and the other contact to 5V, then connect a pull-down resistor from the pin to ground, and detect active highs. This way, you can do a "digitalRead(pin)" and if it is HIGH, then the relay is closed:
What you will want to do also is to debounce this relay close detect, you can find out how here (with a circuit that is basically what you need to use; just put the relay contacts where the switch is):
So - you'll now be monitoring two switches; after that, you need code. If you can keep the relay closed and opened for an "extended" length of time (say 100ms), then the Arduino will be able to detect it easily within a loop. If you need faster operation, you might have to use interrupts.
For one of the relays, you would essentially be incrementing a counter every time you detected it closed, and reseting that counter to "0" whenever you detected the other relay closed.
You would then take that count, multiply it by some factor (or just add the amount you need) to indicate the "angle" (degrees?), then pass it off to the Servo library to move the servo to that angle:
Note that depending on the weight of the line, the servo used, the coolant pressure, etc - the servo's "zero" position may drift; the easiest way to prevent this is to use a servo more powerful than needed, so that this drift is minimized or eliminated by virtue of the system not being able to be "back-driven" by torque caused by any of the mentioned issues. You will also probably want to use a servo designed for R/C boat usage, or set up a shaft extender or something through a rubber grommet/gland such that coolant can't enter the housing of the servo.
Otherwise, you could potentially use a stepper motor, and a potentiometer attached to the shaft (that you could monitor via the analog ports) to determine that the shaft has rotated to the proper angle, but understand that this will be a more difficult implementation (and one more prone to back-drive torque, unless you add your own gearbox to the stepper).
Hope this provides some help and inspiration; it sounds like a neat project, and something that home CNC enthusiasts could use.
Cr0sh,
Thanks for the direction. 100ms isn't a problem. I can dwell for full seconds between the open and close. I designed a whole billet aluminum assembly to hold the swivel mechanism and servo. The servo will stay bone dry in there. I am using a fairly large servo (1/4 scale, metal gear) and gear reduction to turn the swivel. Basically, I wanted to see how difficult this would be using the Arduino. I will have more questions once the mechanicals are finished.