Reinis Veips (fest)'s blog

Posted C  06 marts 2014

Combating endstop noise on a RepRap

While assembling my new toy - a larger, RepRap-based 3D printer, I experienced strong noise on endstop inputs.

Endstops on my machine are pure mechanical switches, and the wires to endstops are in the same cable where wires to stepper motor are (unshielded, of course).

I wasn't surprised to see some noise, but when I hooked up oscilloscope to endstop input line on microcontroller (Arduino Mega + RAMPS 1.4 shield), I was surprised to see a noise of such magnitude (ignore CH2- I was planning to hook it up to motor wire but didn't quite get to it):

Endstop noise

This trace show the moment, when stepper motor, which shares the cable with probed endstop input is engaged. More than 4 volts of noise. Ouch.

I also wasn't too much surprised, to see that noise consists of mostly 50kHz frequency component- the same frequency stepper motor drivers (Allegro A4988 based) chop their outputs.

Initially I wanted to place ferrite rings on endstop signal lines, but couldn't find a suitable ferrites in my lab, so I tried a simple low-pass RC filter instead:

Low-pass filter

This resulted in much better waveform (captured while the same motor was running):

Low-pass filter waveform

I didn't like the time it took for signal to rise after switch was deactivated though- it rose too slow for my liking:

Low-pass filter waveform while homing

The waveform above shows what happens when axis goes to home position- first the endstop is triggered, and after some delay axis backs up, until the endstop no longer is triggered. Since that is considered the 0 position for that axis, I wanted the signal to rise faster.

To achieve that, I placed a 3.3kOhm pullup resistor:

Low-pass filter with pullup

This resulted in a waveform which I found a lot better:

Low-pass filter waveform while homing

There is significant bouncing while the switch is being closed, but I don't think it does affect anything, since there is a delay after the falling edge, and axis backs up only after the signal is stable.

That's it for now, off to fix a broken Z-probe servo :(

Category: misc

Comments