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.