Spindle power control

What do you guys/gals think of this:

At 12A, it seems like an easy/safe way to have the dewalt spindle being turned on by the gcode. More specifically, turned off when the cutting is done. It probably also has enough current for the vac as well.

Added bonus, if cutting the power to the ramps board also cuts input to this relay (which it should), then I can wire an EStop button on the 12VDC power of the ramps, and be able to turn off the motors, and spindle with one, low voltage connection. I’ve got this EStop ready to go, but I don’t feel comfortable wiring it into the 120VAC of the DeWalt. It just doesn’t seem physically sturdy enough.

Another option I’ve been thinking about, but I need to think about some more, is using a fast switching solid state relay. I think I could actually replace the HF speed control with a PWM’ed solid state relay, which would essentially be doing a triac, but I could control it from the arduino. I might have a hard time finding a premade board with a fast switching 10A SSR on it though. And of course, if it costs $100, I’m out. Any thoughts?

2 Likes

That is a cool gadget for the price and would probably work well for on off control of all the equipment you mentioned. In assuming you’ll hardwire the E-stop but how would you implement the spindle and vac on/off, with an M42 code?

I use an SSR on my homemade arduino reflow oven and i think it only cost a few dollars but I doubt it could switch fast enough for pwm. I think the on/off control is a good idea but i find that i only set speed when i start a job or after a tool change so not sure I’d make much use of pwm spindle speed control.

1 Like

M42, or just use the fan control, M106/M107.

I also keep thinking of this thing:

I wasn’t thinking of changing the speed on the fly, I just want to be able to set it in the gcode and get consistent spindle speed day to day.

Lol. That’s pretty cool. Reminds me of the stereo receivers in the 90s that had volume knobs that physically rotated when you adjusted with the remote:)

Just ordered the power strip from the first post, will update when I get it figured out.

Imagine a 42 year old dude bouncing around like a little girl with kittens…


Add in a M106 to Repetier in the start scripts, and a M107 to end and kill.
You get this!

3 Likes

That is awesome!

For speed control, I went redneck.

vacuum and spindle are powered by a … less than NEC-approved gang box, behind the router. 2x 20A relays, wired to digital outputs, each relay feeds one of the plugs.

With my servo solution, you have to add M280 P0 S0 (max speed) or M280 P0 S180 (min speed) with the stock firmware, and M42 P57/58 S0/1 (A3/A4 on AUX-1) to control the relays.

As an electronics engineer, I’ve significantly modified Marlin on my ramps, adding the appropriate M3/M5 and M10/M11 commands. in Marlin_main.cpp, around line 6500, add the appropriate case blocks for the commands you want to add, then add them higher in the file… here is my M3/M5, for example:

  inline void gcode_M3() {
    OUT_WRITE(SPINDLE_ENABLE, HIGH);
    int servo_index = code_seen('P') ? code_value_short() : 0;
    int servo_position = 0;
    if (code_seen('S')) {
      servo_position = code_value_short();
      if (servo_index >= 0 && servo_index < NUM_SERVOS)
        servo[servo_index].move(servo_position);
      else {
        SERIAL_ERROR_START;
        SERIAL_ERROR("Servo ");
        SERIAL_ERROR(servo_index);
        SERIAL_ERRORLN(" out of range");
      }
    }
  }
  
  inline void gcode_M5() {
    OUT_WRITE(SPINDLE_ENABLE, LOW);
  }

EDIT 1: and the code lower, in the switch (I put it right after M81):

      case 3: // M3: Turn on SPINDLE_ENABLE relay, P=servo number (defaults 0), S=servo setting (180-0)
        gcode_M3();
        break;

      case 5: // M5: Turn off SPINDLE_ENABLE relay
        gcode_M5();
        break;

edit 2- don’t forget to define SPINDLE_ENABLE somewhere (like your pins.h file), to identify which pin the relay is on

edit 3- most SSR relays can not switch fast enough, and will BBQ if you hook them up to PWM. The highest reasonable rate to cycle a SSR is about 10Hz (10 times per second), and even that will burn it up quickly (within a few months)

V/r,
Mike

Very cool. I’m definitely jealous now.

Ordered one last night (saturday) and it just showed up this morning (sunday).

Excited to hook it up when I expand my machine to fit a part I’m making. Just waiting on the new belt to show up so that it can reach the slightly longer span.

I have my shop vac attached to the normally off circuit now as well. Still trying to figure out how to mount a dust foot to the new mount. I think I’m going to have to make a new part for that. Right now I have a crevice tool bungied to the side of the router, which helps a little.

Naturally, after I bought the one linked in the first post Amazon recommended its little brother for a little more than half the cost.

Edit: Whoops, didn’t look at that nearly closely enough. But if you didn’t mind hard wiring in a chord or an outlet its not a bad option.

That one sensed the input AC and uses that as a switch. Which can’t just be connected to the D9 pins.

Another good point against it. The post is too old for me to edit/delete though.

oh my god! Where are you been all my life!?

1 Like

I finally took some of my own medicine and bought one of these, and installed it. It works fine. I am using a grbl board, and I connected it to the “spindle speed” control output, but it definitely will not control speed, but with M103 S1000 and M105 commands I can turn it on and off from the GCODE. So that’s a success. Thanks for testing it Barry.

Another little trick for those interested… I was using D9 for my fans on RAMPS to keep the stepper drivers cool (my post uses “M106” to bring up fan speed at the start, and “M106 S150” to slow it down but keep it running at the end). I tried using the ATX power control for the spindle (M80/M81, after changing the firmware PS_DEFAULT_OFF) but I wasn’t happy with the risk of having the spindle accidentally power up (such as when using Repetier Host which automatically issues the M80 command when it connects).

So instead I went with using D10 (the extruder heater) to control the spindle (and using “M104 T0 S0” to turn off and “M104 T0 S100” to turn on). However, that causes a problem because the firmware is looking for the extruder to heat up (and for the thermistor to respond, which won’t happen since it is a hard resister!) - which in turn shuts down the firmware after a small wait. But a simple edit to the firmware fixes this … just change the Configuration.h file and comment out the “#define THERMAL_PROTECTION_HOTENDS” - which will tell it to ignore the thermistors. The result is being able to control fan speed on D9, and have spindle on/off on D10.

1 Like

Just curious where is the best place(software) to insert the M106/M107 commands? I’ve tested in both Estlcam and Repetier and both work. In Estlcam I actually have the following tool change script and the commands should give me more flexibility then Repetier:

G0 Z0 ; Move Z to material surface
M84 S0 ; Keep motors on forever
M18 Z ; Release Z
M107 ; Stop DW660
M00 ; Pause for user
M106 ; Restart DW660

I have not tested the stop/pause/restart script so I’m wondering if it will work. The start/stop commands work.

Z

I like to stop spindle prior to release Z motor to avoid vibration to “move” the height.

1 Like

Thanks for the tip Martin. I added a few line since I was getting tired of spinning the pineapple up/down to change the tools. I only have to spin it back down to the surface now.

G0 Z0 ; Move Z to material surface
M84 S0 ; Keep motors on forever
M107 ; Stop DW660
G0 Z35 ; Raise spindle for tool change
G92 Z0 ; Reset Z to zero
M18 Z ; Release Z
M00 ; Pause for user
M106 ; Restart DW660

On a side note, I’m running the gcode through Repetier on a PC. After the the pause I usually hit the button on the LCD display to resume the cut (the PC display is sleeping by then). Is there a way to resume from inside Repetier? If so, I may add another pause and lower spindle commands to automate it even more. I don’t trust myself not to double tap the button on the LCD screen.

Z