So I have my DIY CNC running with a G540. I installed limit switches and immediately started getting false triggers. I wired and grounded everything to best practice standards but the 1617 Router is just spiking too much noise. I removed the Z axis switch and the problem went away entirely so I know it is isolated there.

I am running UCCNC with a UC100 so unfortunately I cannot use the debounce setting that is built into UCCNC. That leaves me with having to install a hardware filter. Right now my plan is to install a 2kOhm resistor and a 0.1uF capacity to try and filter out these noise spikes. Is my thinking correct and would I wire them in series like shown in the drawing I attached?