I have a circuit that appears to have some noise problems related to stepper motors I'm driving. When I changed some switches to use pull up instead of pull down resistors, I get better results. Why?

I'm using a PCF8574 digital IO expander for some limit switches. It has an interrupt pin that goes LOW on any transition from the limit switches. The limit switches are mounted on an aluminum frame with no more than 3' of wire. Several of the limit switches are within 1 inch next to a stepper motor, being driven at no more than 2.2A. Digital inputs are pulled low via 10Kohm, and the limit switches connect digital signals to 3.3V. Logic voltage does not seem to be a problem. The stepper motor and limit switch lines are sometimes ran next to each other (no cable shielding).

When I power my stepper motors, the interrupt pin goes nuts (my uC resets interrupt via a read request). As in, the IO expander detects high->low and/or low->high transitions when none of the limit switches are being pressed. Limit switch state is correctly transmitted if I'm not powering the motors. Problem is only when motors are on. Stepper motor drivers have adequate capacitors (470uF), and all digital logic have small caps nearby.

When I change from a pull down to a pull up resistor on the digital inputs, the interrupt does not go crazy. Why do pullup resistors work better for my limit switches?

  • 5
    \$\begingroup\$ Schematic please. \$\endgroup\$
    – Andy aka
    Jan 12, 2021 at 17:53
  • 1
    \$\begingroup\$ Digital inputs have three zones. Guaranteed low, guaranteed high and indeterminate. For example, maybe anything below 0.8V is guaranteed low. Anything over 2.4V is guaranteed high. Anything in between may be recognized as either high or low, so is unsafe. Maybe your particular input recognizes anything over 1V as high, so deviations down from VCC are well tolerated. But deviations up from ground cause problems. In either case, a low value capacitor will help a lot. Say 22pF close to the input (and vary cap as needed to achieve good results). \$\endgroup\$
    – user57037
    Jan 12, 2021 at 18:00
  • \$\begingroup\$ It's not the pullup or pulldown resistor, it's the input it's connected to. See electronics.stackexchange.com/questions/50605/… and electronics.stackexchange.com/questions/208060/… \$\endgroup\$
    – user16324
    Jan 12, 2021 at 18:01
  • 1
    \$\begingroup\$ I think more info is needed. The PCF8574 is a bit odd choise for an IO expander as it has what NXP calls quasi-bidirectional IO pins. There is a strong output high pulse when output is written high. And output must be written high to be an input. 10k is also very weak impedance, while contact bounce can still cause high dv/dt and thus high di/dt. In addition to motor wiring EMI. Yes, I think we need schematics. \$\endgroup\$
    – Justme
    Jan 12, 2021 at 18:14

1 Answer 1


PCF8574 I/O already has pull-ups in it, in the form of a 'weak 100 µA current source'.

enter image description here

If you try to pull the input down with 10 kΩ then the 100 μA internal pullup current flowing through your pull-down resistor will raise the open-circuit input voltage by 1 volt, reducing your noise margin.

With a 10k pull-up you are improving the noise margin because your resistor and the internal pull-up are working together instead of fighting each other.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.