Spindle Control with Adafruit Relay (Solved; Loose Ribbon Cable)

Hello community. I am at my wits end trying to get my Adafruit relay to auto control my Dewalt 611. I have worked with Inventables tech support and they were wonderful, going down every possible avenue to work out the problem. Unfortunately we couldn’t figure out the problem. I replaced by X Controller Power Control and Supply Interface board and have gotten a second relay from Adafruit. The wiring is good (see attached pictures). But nothing works. When I go through the set up menu in Easel and get to the point where you hit the “spindle on” button, nothing happens. The only thing I can think of is that the when I do hit the “spindle on” button in Easel, the “switch active” light does not light up on the Adafruit relay. Perhaps the signal is not getting to the relay to tell it to turn on the spindle? I dont know what to do to fix that, however. Thanks ahead of time to everyone.

1 Like

hello my name is johan and I want to help you as I can I have an x-controlle and use this relay for my router I have this installed ase 1 year and all function very well without using easel bone works for all the programs with what you run your x- controllet I recommend it to 100x100 if you have questions I can help you with videos or photos.

Some 1.0c grbl builds loaded into the X-controller have an anomaly that you may be running into.

If you do have an Inventables 1.0c in your X-controller try setting $30=1. (note the dot) and see if that fixes your problem.

This is only needed when using Easel, other senders do not have this issue.

1 Like

Double/triple check the ribbon cable from the power supply board to the main board. The locking clips will engage before the connector is fully seated. That could cause this behavior.

Additionally, do you have a DMM/volt meter? If so, check the voltage across the SPINDLE and GND connectors when you click the “SPINDLE ON” button in Easel.

Move the red wire on the X controller from the Spindle PWM output over to the Spindle 0-10V analog output.

That should solve your issue. Also make certain that $30=1 in GRBL (1.1f) so the spindle is either on or off.

The PWM output doesn’t have enough current to trip the IOT relay unless you set everything to max spindle speed.

1 Like

Yep, AlAmantea is correct, your red wire is in the wrong spot. :frowning:

The key is voltage not current. The output voltage is variable. And by setting $30 to 1 makes ANY value other than zero full value.

$30 - Max spindle speed, RPM

This sets the spindle speed for the maximum 5V PWM pin output. For example, if you want to set 10000rpm at 5V, program $30=10000. For 255rpm at 5V, program $30=255. If a program tries to set a higher spindle RPM greater than the $30 max spindle speed, Grbl will just output the max 5V, since it can’t go any faster. By default, Grbl linearly relates the max-min RPMs to 5V-0.02V PWM pin output in 255 equally spaced increments. When the PWM pin reads 0V, this indicates spindle disabled.

Do you know what the 0-10V output is? It’s an amplified version of PWM.

So even with the wrong speed settings for the M3 command, even the 0-10V might not be enough. Adafruit specs a minimum of 3V to control the relay.

If you have the right settings, the relay will work on either output. Mine is connected to the PWM and works perfectly.

Measure the output, check the internal ribbon cable.

Almost. I would disagree that the analog out is an amplified version of the PWM. It may seem that way, but the analog signal is a constant but changing value. A PWM signal is not. It is an ON/OFF signal that has changing values for it’s on time and off time in a square wave fashion. (hence the “Pulse Width Modulated” name.

They can appear similar when read by a multimeter, because the MM will average the signal, but a PWM will show a “Hertz” or “Frequency value” where the analog will not.

This is also why I suggested setting the $30 value to 1, as any change from zero will turn on the IOT relay at a full 10 volts. Eliminating the issue of a wrong speed command. The speed of the DW611 is manually controlled anyway.

Using the PWM signal to run the IOT relay may work, but it can also create an EMF loop back as the signal gets modulated. This could cause flutter in the relay, and potential damage, and can also cause enough feedback into the X Controller to knock out the USB connection. I have experienced this result personally, as I utilize both the PWM signal, and the Analog signal in my setup to switch between my 6W OptLaser, and my DeWalt DW611 spindle.

When running the laser, I have to disconnect the IOT relay from the analog output, because it will flutter enough to crash my USB connection. This is due to the flutter effect mentioned earlier.

The circuit board schematic posted online says otherwise. That is a direct screen capture of the Xcontroller schematic posted by Inventables. How can you disagree with the board design? It clearly shows the SPINDLE_PWM connected to an OpAmp (after filtering/converting PWM to analog) with a gain of 2. That is definition signal amplification. When you take Signal X, run it through an amplifier, the output Y is an amplified version of X. Plain and simple. There are not 2 different outputs from the Arduino. They are the same output. Don’t believe me? Look at the GRBL wiki page:

There is no 0-10V output.

Granted, it’s not an exact copy of the signal, but it’s still an amplified version of the PWM output.

Yes, a PWM signal has a duty cycle associated with it. As you’ve said, the signal is just ON/OFF for different timing which sets the output “level” and allows for different RPMs. The actual output from the Arduino does not change from a 5V level. But, when you set GRBL to its max RPM or greater, it becomes a 100% duty cycle which is sufficient for triggering and keep the IOT relay turned on…a 100% duty cycle square wave, in a PWM sense, is a equivalent to a constant output (there is no switching off with 100% duty cycle!).

You’re completely ignoring the fact that the 0-10V output is the SAME Arduino output as the PWM output only that the 0-10V is run through an op amp. Once again, as I said above, the schematic capture is from the Xcontroller schematic. There is not a separate Arduino output that powers the 0-10V. The 0-10V output is also a PWM output. Because of this, I think what you might have seen was an over-draw of the Arduino output pin (since the PWM and 0-10V are both a shared source) which caused a shut down of another part of the system and it manifested as a USB connection drop out, especially on the Xcontroller where the 5V supply for the FTDI USB chip and the ATmega are shared and appear to be current limited to about 600 mA. If the system draws too much, 5V goes away so the USB connection drops and the ATmega resets.

It’s been well documented that the Arduino/ATmega pins are specced to only source 40 mA per pin and sometimes connecting too many devices (including multiple IOT relays) will cause problems.

I agree with you though that disconnecting the IOT relay when using a laser would be recommended due to the nature of laser needing a true PWM signal which may cause the relay to constantly trigger in addition that might be too much current draw on the output of the ATmega chipset.

You guys are over-complicating this. Just move the RED wire to the proper pin. Done.

This whole discussion is to show that both pins work. There is no singular “correct” pin. Both work.

If there’s a problem on the PWM signal, there’s a very high chance that there’s a problem with the 0-10V output since they’re the same source!

If the output pin level is too low, the amplifier will mask that there is an issue.

1 Like

A picture is worth 1000 words and I’m too tired to typed that much.

Top trace is 50 percent duty cycle PWM output.
Bottom trace is 0 - 10 volt output.

The variability in the 0 - 10 volt output is severely affected by the change to using 1000Hz PWM in grbl 1.1f. The 0 - 10 volt output works much better using grbl 1.0c which uses 8KHz PWM.

While I had it hooked up I got a picture of 1.0c

2 Likes

Amazing discussion by all, thanks guys. Somewhat embarrassingly I have to admit the problem was a loose ribbon cable. It must have been seated just enough to make some of the switches work (limit switches) but not seated enough to make the PWM work. Once I took apart the X Controller and reseated the ribbon cable, it worked like a charm.

3 Likes

Thanks Larry.

That 0-10V trace on 1.1f looks nasty. Maybe a change to the op amp or the low pass filter would clean it up?

Certainly that part of the design could use some help. I sent this information to Bart Dring when I first noticed it, but didn’t get a reply. He’s retired now and I don’t know who took over his position.

Just for giggles I put a 100uF electrolytic capacitor on the output and that smoothed it out, but raised the voltage above what the setting should be for a 50 percent duty cycle.

I bought one of the Chinese PWM to analog converters just to test it out, and it was worse than the X_controller…

Justin,

Thank you very much for that very informative correction. I did not realize the PWM and ANG were the same output. This clarifies a ot of things for me.

Larry,
Thanks for posting the waveforms. Also very informative. I did not realize there was that much of a difference between 1.0c and 1.1f.

So if I follow your thought there, I should be running 1.0c (your corrected version) instead of 1.1f, is that correct?

Also, do either of you know if there is a take off from the power supply inside the x controller to the outputs that can be used for powering the OptLasers 6W directly? I know it can handle the 24 volt supply without a problem according to the specs, but wanted to avoid modifying my controller case unless needed. If there is a need to do so, what would be a good way to do so?

1 Like

Not really. Due to most lasers supporting the 1KHz rate my version of 1.0c also uses 1KHz PWM as it’s main thrust was to get an updated grbl for laser users prior to fhe release of Sonny’s 1.1f.

An earlier version would switch back and forth from 1KHz for laser and 8KHz for spindle work.

[oops… looking back I see the OPT laser mentioned.}
If you don’t have a laser then your best bet to get a better functioning 0 - 10 volts would be to install the 1.0c from the Inventables firmware location.

[another edit]

use this circuit for controlling your spindle and laser (X-controller PWM would hook to D11 in the drawing and X-controller ground would hook to Arduino ground)

PWM_switch_example

2 Likes

Thanks for the help.

What is the purpose of the 1k resistor in the circuit mentioned?

One of the switch positions will always be open. That allows the control line on the open position to float. Since a lot of devices have weak pull ups on floating inputs you would get a signal for the device on the open switch position to turn on. This is a bad thing.

The 1K resistor is a pull down resistor and forces the signal on the open switch position to be a low (device off). The value of the resistor is such that when the logic signal is actually there, the logic signal can push enough current to make the signal a high to turn the selected device on.

So, the short answer is that the pull down resistors force the device not selected to be off, but allows that device to turn on when it is selected.

1 Like

Thanks! #themoreyouknow