I’m trying to control a solenoid valve that moves the Z-axis on a CNC engraver using an arduino Nano GRBL 1.1. The solenoid valve in effect replaces the Z-axis stepper motor. My first attempt was to drive it from the Z-axis DIR signal, which goes HIGH when the cutter advances into the workpiece. Unfortunately, it stays HIGH at end of travel, so if the spindle is lifted and then lowers to mid-point and stops the DIR signal will still be HIGH.
So I tried using just the DIR signal, but it doesn’t stay static - even while performing a fixed depth cut, the DIR signal is constantly changing.
So my thought is the SPINDLE ENABLE signal might be useable if ANDed with the DIR signal - if the spindle is enabled, AND the Z-axis is moving down, then power the solenoid. Or I could use one of the output signals, but I can’t figure out how to sense the conditions I need - spindle running, Z-axis lowered into the workpiece.
I know I could do this by editing the G-code, but that’s a bit tedious on a workpiece with hundreds of movements.
Any ideas? Or is there a different controller that allows for a on/off signal to move the Z-axis?
This post is missing some important information included in your earlier post (EstlCAM Arduino Spindel Question). Am I correct in saying that you are using a pneumatic cylinder to move a spindle to a fixed depth and that you want the spindle to turn on when it reaches that depth and to turn off before it retracts? Are you only using the machine for fixed depth/width on-the-line engraving? If so, using the Estlcam firmware, the v12 laser tool for the spindle on/off/rpm and an output pin for the solenoid (via a 5v relay) will work… GRBL should be doable with the appropriate PP Texts, e.g. solenoid on would be M07 or M08 and off would be M09
You are correct, I am trying to replicate the functionality of an old PC-based engraving machine using current software. This machine will only be used for line engraving, fixed depth of cut.
The old machine has stepper motors on X and Z axis, a variable speed rotating spindle, and raising or lowering the Z-axis is handled by a spring-return pneumatic cylinder. The beauty of the pneumatic cylinder Z-axis is the depth of cut can be adjusted both for maximum depth, as well as the amount of downwards force on the cutter.
I don’t know if you’re familiar with the pantograph or computer engravers. They typically use a rotating spindle that moves vertically into the workpiece. The cutting tool depth is controlled by a micrometer-adjustment that sets the tool bit projection past the spindle nose. In operation, the spindle nose lightly contacts the workpiece, restricting the depth of cut. This maintains the same depth of cut regardless of workpiece surface irregularities or curvature.
Here’s a photo of a typical spindle nose: https: www-dot-gravotech-dot-com/sites/default/files/styles/ultrawide_product_gallery/public/import/mac-a-im3-plaque-2.jpg?h=5a22e328&itok=fDjC88oE
Because the pneumatic cylinder is spring-loaded, and the air supply volume and pressure can be adjusted, it’s possible to fine-tune how much force is applied to the cutter feed and also the speed of advancement into the workpiece.
I can’t see any mechanism to compensate for irregular workpiece on ESTLCAM, or any other simple CNC router software. I can use a surface probe if the workpiece is conductive, but much of my engraving work is done on acrylic or non-conductive materials. That’s why I’d like to try to implement the pneumatic control for spindle downfeed. I’m just stuck on how to supply the control signal to the solenoid valve, and the Estlcam software doesn’t provide much handholding. My Arduino controller has pin 13 identified as , but I’m unsure how to configure this in V12. Ideally, this pin should go HIGH whenever making a cut. Same as a laser head, but because I’m using a rotating spindle I need both a PWM signal for the spindle motor, and an on/off signal for the pneumatic cylinder.
Thanks for the additional information. It sounds like you can leave the spindle on (typical M03 at the start of the program and an M05 at the end) and only need the pneumatic cylinder to extend/retract at the start/end of the cut. For GRBL firmware it looks like you need to replace my solenoid on/off bits with M07/M09 and use pin A3 for the solenoid relay.
Estlcam firmware/pinout/PP
Output: pin, 5v on/0v off
1: 03, M08/M09 or name (e.g. solenoid) on/off
2: 02, M10/M11 or name on/off
3: 04, M03/M05 (spindle)
5v PWM: 05
Sometime I use a probe wire clipped to aluminum tape (10 x .05mm) for touch-offs. While I have yet to use the surface scan function it seems like strips spaced on a scan grid of non conductive material might work.
Thanks, got it. Here’s a simple engraving, just a bunch of short lines. I set up my logic analyser to watch the Arduino pins 7, 8, 11, 13, and A3 and it’s clear that I can connect to pins 7 and 13 to operate a relay. The screen shot shows pin 7 toggling as the CNC program runs, and pin 13 toggles at the start and end of the G-code.
That last image changes things. To get that image you have to have installed the Estlcam firmware which means you are not using GRBL. Since you also said you are using a Nano (my bad for not noticing that earlier), there is no reason to use anything GRBL. The only reason to use the GRBL compatible pinout is if you are using GRBL hardware that does not allow you to use the Estlcam Arduino pinout. The only reason to use the GRBL presets for Settings Basic and PP is if you are generating GRBL compatible G-code for GRBL firmware. When using GRBL presets with Estlcam firmware you get things like that G94 Invalid Command because Estlcam firmware doesn’t need/use G94, G21, G90, etc.
If you do not want to rewire your Nano to the Estlcam pinout, you should at least change your Settings Basic and PP to Estlcam presets. When using the GRBL compatible pinout you only have one available Output (Estlcam pinout has two Outputs, pins 02 and 03) and that is pin A3/Output 1 (Controller : Outputs). You can name that output solenoid and use solenoid on/off commands (per above image) or M08/M09 (…clicking that bottom-right spigot icon will also turn it on/off).
The easiest way to use that output to pneumatically extend/retract the spindle at the start/end of the cut is to define/use a Laser tool (bottom right tool) and add your on/off commands to Controller : Texts Laser before/after Z down/up (per above image)… The only Laser tool settings that matter (for center-of-the-line Engraving) are depth per pass, feedrate’s and spindle RPM. Nothing else matters, e.g. Tool diameter can be whatever you want, it has zero effect on the G-code… The importance of the Z settings depends on how fast the pneumatic Z is, i.e. does the spindle reach the set depth before the cut starts or is a slower feedrate needed to slow the program down/give Z more time… example G-code: