Push Button Pull Up vs Pull Down weird behavior

I am running an Arduino in my vehicle. Using 12v+ from the OBDII port into a buck converter down to 5v.

I recently hooked up a very simple push button with a 10k resistor. It counts presses 1-5 in an integer and sends via serial to change pages on a display. It works pretty well.

However when I first wired it it it was as a pull down switch. Resistor to ground, when I pushed the button it pulled the digital pin high. In this setup my arduino would always crash periodically. Especially with multiple presses in a row. I also noticed that hitting the door lock button on the door handle would register as a button press and count up on my integer.

I swapped it to a pull up switch, resistor now on 5v and pushing the button pulls the pin low. I’m doing so it no longer crashes and counts presses flawlessly. However it still registers a button push when hitting the door lock button hard. Does it about 1 out of 3 times.

My assumption is hitting the door locks is stealing power from my circuit and causing it to glitch and register a button press? My little buck converter display always shows 5v out however and never drops.

Any thoughts as to why I am registering random button presses as the doors lock and unlock?

Also can anyone explain why the pulling the switch pin high always made my arduino crash yet pulling it low it never seems to crash? Trying to learn more about what’s really happening and why.

Door lock motors will produce huge amount of electrical noise in your wiring.

Removing current from an inductor causes high positive spikes.


  • You could make the pull-up a smaller resistor.
  • You could add kickback diodes across lock motors.
  • You could add a 1uF capacitor across the pull-up.
  • You could use a NC switch then look for a HIGH on a push.
  • You could add software glitch filtering when reading switches.
  • You experiment with this input conditioning cct.
    :thinking:

@jeff_5_7 Installation and Troubleshooting is for Problems with the Arduino itself NOT your project. It says so in the description of the section. Therefore I have moved your post here. Please be more careful where you post in future.

You may want to read this before you proceed:-
how to get the best out of this forum

I am from the old school and we were taught to run at least one milliamp through a switch and to switch ground, it reduces interference. Try using a 2K or something in that range.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.