1
\$\begingroup\$

I have an Arduino project where a pin is kept high until a momentary button press connects the signal directly to ground, so the code is expecting the button to be high until the press takes it low.

Everything works after I solder it together for at least a couple of hours, but I noticed the next day (both times I've tried this) the device acts as if it's being pressed constantly.

I measured the resistance of the momentary button and it is around 4.7 kΩ between the button studs (while still soldered to the PCB (I have not desoldered it yet, but anticipate doing so for testing it when I can clear a space to run a heat gun) when the button is not pressed.

I'm fairly certain I tested that button to have no connection between the studs and tested between the through holes on the PCB with the same result.

I tested another button from the same batch just now and confirmed that I got no connection without pressing the button.

This is the second time this has happened, so I'm beginning to suspect that these buttons just eventually start leaking current. I don't believe I am pushing too much current through it either. It's just the 5 V line from the Arduino routed through a 4.7 kΩ resistor prior to reaching the button (which, by the way, if I measure resistance from the 5 V to the supposedly unconnected stud on the button, I get around 10 kΩ resistance), then the press routes the signal to ground. Any thoughts?

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Measure the voltage at the gpio with the switch pressed and not pressed. What do you get? \$\endgroup\$
    – Kartman
    Sep 29, 2022 at 2:22
  • \$\begingroup\$ This is weird - without pressing the button, the voltage sits at around 33 mV for a few seconds before surging to nearly 2V (I caught 1.79V on camera with a slow polling multimeter), then dips to about 0, then settles back to around 33 mV. When the button is pressed, it sits around 0.0 to 0.2 mV. \$\endgroup\$
    – mredig
    Sep 29, 2022 at 2:58
  • \$\begingroup\$ There is no reason I can think of for the random variance it's displaying. It's coming from the straight 5V pin through a 4.7k resistor, through the switch, then to ground. \$\endgroup\$
    – mredig
    Sep 29, 2022 at 3:00
  • 1
    \$\begingroup\$ If you measured the button in-circuit, you are not measuring the button, you are measuring the circuit. So if the button circuit has a 4k7 resistor, it should not be a surprise that your meter shows approximately a 4k7 resistance. If the circuit is powered on, you would again get a different resistance measurement. If the button sticks, maybe it's damaged by heat or has some flux inside it? \$\endgroup\$
    – Justme
    Sep 29, 2022 at 3:58
  • 3
    \$\begingroup\$ Kindly update your question with a photo, and a schematic of everything connected to that button (resistors and capacitors on the same line, at the very least). Also, is this behavior only on one button, or multiple? \$\endgroup\$
    – Anas Malas
    Sep 29, 2022 at 5:41

3 Answers 3

1
\$\begingroup\$

that varying voltage sounds like a software problem as-if some part of the software has defined that pin as an output.

\$\endgroup\$
0
\$\begingroup\$

Make sure you are only using electronic grade solder.

Plumbing solder not only has a higher melting point but incorporates an corrosive acid flux core that is very conducive and can cause this kind of issue.

If you did use the wrong kind you can try to clean it with an old toothbrush and 99% isopropanol.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I'm 99% certain that what I have and use is electronic solder. I've used it in many other situations and haven't had this problem, either. Tho I have always wondered what the difference was and this is useful information! \$\endgroup\$
    – mredig
    Sep 30, 2022 at 18:02
0
\$\begingroup\$

Do momentary push buttons commonly deteriorate?

Not in normal use. They have a current rating you should check, but it is very unlikely that you are exceeding that in any normal use. Excess current can cause contacts to weld shut but that is unlikely to be the case unless your circuit is unusual.

It's just the 5 V line from the Arduino routed through a 4.7 kΩ resistor prior to reaching the button

That doesn't read like the usual way to connect momentary buttons to an Arduino. Usually you'd use INPUT_PULLUP to enable the internal pullup feature in a GPIO pin and then externally connect that pin to ground through the button. You wouldn't need an external 4.7K resistor or any extra connections to a 5V line.

\$\endgroup\$
2
  • \$\begingroup\$ That's a perfectly valid way. Even if a MCU has an internal pull-up, it does not mean you can't use an external pull-up. \$\endgroup\$
    – Justme
    Sep 29, 2022 at 10:00
  • \$\begingroup\$ @Justme - I agree it is valid. But it is not usual in these specific circumstances. It is also wasteful to add extra external components unless you have some specific reason. \$\endgroup\$ Sep 29, 2022 at 10:02

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.