1
\$\begingroup\$

A pull up resistor provides a constant voltage (and therefore some current) to an input pin on arduino. https://learn.sparkfun.com/tutorials/pull-up-resistors/all A pull down resistor connects an arduino pin to to ground so no current should be flowing through the pin.

When a button is used in a pull up circuit (see ref above) current flows through it only when the button is pressed resulting in a decreased voltage at the arduino pin. When the button is in its native state, the arduino pin sees 5v so more current is flowing through the pin of the arduino. I am simplifying an arduino and thinking of it as a resistor .

Since a button is normally in the open state and spends most of it time this way, if it is used in a pull up circuit, then current is always flowing through the arduino.

A button used in a pull down circuit allows voltage at the arduino pin only when it is pressed, so this seems less wasteful. But apparently, pull up circuits are much more common. why this desire to waste electricity?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ whether you pull up or down, some amount (even miniscule) amount of current has to flow. Without any pull up or down, a CMOS input floats and may cause significant current to flow due to the random switching action. If in doubt, it pays to measure. \$\endgroup\$
    – Kartman
    Commented Apr 24, 2022 at 12:36
  • \$\begingroup\$ Historically, pullups waste less. Now with CMOS logic, it makes no difference, but pullups are still sometimes preferentially used for backwards compatibility reasons. electronics.stackexchange.com/questions/50605/… \$\endgroup\$
    – user16324
    Commented Apr 24, 2022 at 12:49
  • \$\begingroup\$ Adding to what @user_1818839 said about history, back in the days when TTL ruled the Earth, one had to draw significant current from an input pin in order to pull it low, but the current required to pull it high was trivial by comparison. In fact, most TTL inputs would "float" high (but maybe not reliably) if not connected to anything. \$\endgroup\$ Commented Apr 24, 2022 at 14:39
  • \$\begingroup\$ why do you assume that the answer to your title question is yes? .... why this desire to waste electricity? \$\endgroup\$
    – jsotola
    Commented Apr 24, 2022 at 15:17
  • \$\begingroup\$ The problem arises through your simplification. An Ardiuno input pin is not well modeled as a simple resistor. \$\endgroup\$
    – brhans
    Commented Apr 24, 2022 at 18:42

3 Answers 3

3
\$\begingroup\$

Let's look at a simplified cmos input and an analogy. While the atmega in an arduino uses a more complicated non-inverting Schmitt trigger for the input circuit, the same would still apply.

enter image description here

It's a complementary pair of fets. One p-channel at the top one n-channel at the bottom. And they experience leakage through their gates just like any mosfet.

When you have a pull up, the input is at VDD, turns off the p-channel and turns on the n-channel. Current flows through the n-fet.

enter image description here

And of course the opposite happens when pulled to ground. Top fet is turned on and bottom is off.

enter image description here

Of course these are mosfets, so current barely flows unless you are switching the state, and where leakage occurs in different ways, drain-source leakage, gate and body leakage.

Generally, this means the pull up and the pull down will result in the same amount of leakage for a modern cmos input.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thank you. Clearly my intuition about an arduino is too simple. It is not just a resistor. After all, it IS connected to a power source. I would also like to acknowledge user_1818839 and Solomon Slow as their comments are helpful \$\endgroup\$ Commented Apr 25, 2022 at 14:14
1
\$\begingroup\$

You are mistaken that no current flows through a pulldown resistor. There is leakage current at the processor pin, regardless of whether it is pulled up or pulled down. With a pulldown resistor current will flow from the power supply, through the processor, out of the I/O pin, and through the pulldown to ground.

\$\endgroup\$
1
\$\begingroup\$

The current consumption does not depend by itself about there being pull-ups or pull-downs, because virtually no current flows into or out of an Arduino pin. Leakage current can be ignored as it is likely to be symmeteric, and assumption is that no internal pull-ups are used because obviously internal pull-ups do cause current to flow out if input is grounded.

Which setup wastes more current depends on if the actuator such as slide switch spends most of the time open or closed in which case current either flows via the resistor or not.

\$\endgroup\$

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.