Spindle controller Noise issues when Spindle is on

Greetings,

My original thread is here for the PCB Linked

Everything is working great... except when i actually plug in the motor and it turns on the Nois-a-gedon. This is for a spindle controller that is run with a Nano Arduino that talks to a CNC controller which is a ramps compatible Mega Arduino. I have a kill switch that is normally high with a pull-up resistor that both the nano and the Mega have as a digital input see (KILL in schematic). For some reason there is lots of noise in it for the Mega when the spindle turns on.

Over view:

I am sure I am getting noise from the motor back to the controller. The nano itself is holding out but the KILL line is causing the CNC machine to stop randomly.

I have three thoughts on where my design has problems:

1.) (Noise in the PCB) I have a hall sensor to the jumper J9 Nano Pin. Even without the spindle attached I see a RPM misread as soon as the relay and PWM engage. The RPM drops back to zero after the transient spike. The relay module came with an arduino kit and has a Diode and transistor which seems to be sufficient for the schematics I see. Could the relay noise still be making it back to the Nano maybe through the +5V and ground?

2.) (Noise through the Power Line) The power is supplied to the nano from 12v PSU (Supplies the CNC) --> BuckDown --> Nano (AMS1117v5). My thinking was the 12v was too much for the AMS1117v5 with LCD current load so I bucked it down to 8V. I thought this many switching and PSUs should have enough chokes and Caps to keep the voltage stable and chop up any noise. I realize now the step down might be increasing the noise. When spindle off my voltage readings are 7.97V Vin and 4.89V 5V. When the spindle turns on 7.78V Vin and 4.79V 5V (Which is 10 mV under the AMS1117 spec, but cheap multi meter...) I do find it odd that the spindle is dropping the voltage, but it is only 3%. I am suppriesd that the AMS1117 isn't holding more steady though...

3.) This is an oversight on PCB I had the ground plane seperated because the tracess on the left are from the spindle PSU which is non-isolated. I control the PSU speed through a PC817 opto at U1. Is my spindle traces too close to the ground plane which is common?

My solutions are to possibly add decoupling caps. Am i on the right track or am I way off base.

1.) For the relay I was thinking a 47uF across the Ground and 5v line on the relay module (or should i use a 0.1uf?). Possibly add it to the KILL line as well since i dont see anything on a multi-meter.
2.) For the VIN I was thinking of adding a 47uF right at the Vin PCB and a 470uF on the outputs of the buck converter. My thought being the spindle motor noises are somehow getting back from the Spindle PSU to line voltage to the 12v PSU to the buck down 8v to the AMS1117v5 5v rail, but that seems crazy to me.
3.) ???

I don't know how the spindle is getting into the nano and Mega since the CNC and Spindle PS are separate. I learned the hard way to not to connect their commons since the Spindle PSU is a cheap and dangerous non-isolated bastard. Cases are grounded, the spindle wires do not lay next to the motor and end-stops wires in the track but are not shielded so EMF could get to ground. The CNC controller is not firing any end-stop issues I also think they have caps on those to filter signal noise but i will shield the wire next.

Sorry for the long post. Trying to learn.

Hi,
Normally a KILL SWITCH is closed to GND, and opened when you want to KILL.
What you are experiencing is a reason why KILL switches are Normally Closed.

This way you have fail safe system, so if the switch leads get cut or unplugged the system will KILL.

A KILL or E-STOP should REMOVE ALL power from the motor and controller not be an input relying on a controller to stop the system.

I would say with your arrangement, if you unplug the KILL switches the motor will still run.

Tom... :slight_smile:

Greetings Tom,

Yes this is a "soft" kill. I have a real kill that cuts the line power to everything. (Power strip mounted on the front.) The "soft" kill stops the spindle, kills the program, and keeps the CNC motors engaged so the position is not lost. I should call it program stop. The spindle does shut off because its in the fail-safe configuration on the NC side of the kill switch.

I did it this way because the emergency stop button i am using has an NC and NO. The NC has the spindle (non-isolated spindle PSU) wire running in series with the relay so if that wire is open the spindle PSU stops power to the spindle. (Fail-safe on the important part) I cant mix the two because the spindle PSU is non-isolated and noisy...

I thought the best use of the NO side since the spindle would be fail-safe would be to have it drop voltage similar to a push button so pull-up resistor at R4 with the NO connected to J3 that when pushed drops the KILL line to 0V.

The KILL really just needs to tell the CNC to stop the program since the spindle is already off, but now i just removed it and disabled it in the firmware until i can get it to stop misfiring...

You actually got me thinking about ways to make it less fail-safe and not trigger on noise...lol I could use the internal pull-up resistor on the Mega to maybe keep the line always hi so as you said even if its unplugged or gets a noisy 5v from the nano it still runs... then it really only fires when the line is shorted to ground.

I realize that I am not fail-safe on the controller side, but nothing really is if the switch is a NO... I always have the Hard kill if it doesn't stop-stop and drags a non operational spindle around. I guess i should try to find a kill switch that has NC/NC not NC/NO. I thought it was odd the saftey switch even had a NO.

I think i am just going to start adding filter caps to see if I can stop the misfire, since i don't have a scope. I just realized the Nano doesn't even have a cap on the Vin pin.

Thanks

Use an external 1K pull up resistor on the kill switch. The internal pull ups are way too weak to cope with the level of interference you are getting.

Greetings,

Just added a capacitor to the fly diode on the relay. That seemed to stop the noise.
I also pulled up the Mega board as well that way it has to be a real GRD on the line before the STOP happens.

Seems when in doubt put in a filter cap and pull it up harder.

BTW thanks for the guides Mike this newbie has been using them.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Take care.

Yes, the internal pullups are so weak they are only useful within a single pcb close to the microcontroller.

Go with 1k pullup and 10nF or so cap to ground on the kill switch input, that should quell the interference
massively.

The motor may be lacking RF suppression capacitor too - this is normally something like 1nF ceramic
disc capacitor mounted on the motor terminals direct to short out RF interference from the arcing of the
commutator at source. If the capacitor can be mounted internal to the motor, that's even better, and
good motors come with such suppression built in.