Understanding how pull up resistors work with AP physics

Hi, I really need help understand how pull up resistors work with buttons. I want to truly understand how they work that way if I ever need to use them in a project I can know how to use them best, but I’m super confused. I’m taking AP physics 2 in high school right now and I’m trying to connect them but it seems like arduino and my physics class are saying opposite things.

So I believe I understand the basics of a pull up resistor (correct me if I’m wrong). The board sends out 5V which passes through the resistor, when the switch is open the voltage goes to the pin and is read as high. Then, when the switch is closed, electricity is then directed toward ground rather than the pin, and therefore the pin reads low. I believe it’s because the pin is now reading a low enough voltage to be considered low, or is it based off current?

Here is my main problem. According to what I’ve learned in class (again correct me if I’m wrong) voltage should be equal on both sides of a branch in a circuit, therefore even when the button is pressed there should be just as much voltage as when it isn’t pressed since 5V is on both sides of the branch. I don’t understand why the pin no longer reads 5V when my class told me that both branches should receive 5V and it is current that splits.

I would really appreciate if someone could help me with this. I’ve been so confused about it. I know it’s a pretty simple topic and is nothing major, but I really want to get into arduino and electrical engineering, and I feel like I should understand how this works if I want to do more complicated things. Thank you so much to whoever can help!

Electrical environments emit electrical disturbances (listen to your laptop power supply).

Unterminated wires are simple antennae which receive these electrical disturbances and reflect these disturbances up and down the unterminated wire. Imagine tying a rope to a wall and giving the rope a whip action. The wave would travel down the rope, hit the wall, invert, and travel back. This is a reflected wave.

Buttons and microcontrollers have unterminated wires when not in a circuit.

Tying (connecting) wires to ground through a resistor is one way to "terminate" a wire. In the example above, rather than the wave propagating to the end of the wire and reflecting back, the wave dissipates through the resistor to ground, as if the wire were infinitely long (no reflection without a wall).

Tying a pin of a button or microcontroller HIGH with a pullup resistor clamps (ties) that pin to the VCC/HIGH potential, stopping it from being an antenna. One side of a button should also be tied HIGH. The button should also be wired on the other side to provide a path to ground when pressed. This gives HIGH on the microcontroller pin when the button is not pressed, and LOW on the microcontroller pin when the button is pressed.

There are more and better explanations.

A digital input can be assumed to draw no current.

By Ohm's Law, the voltage drop across a resistor is zero if there is no current flow.

Therefore, when a (pullup) resistor is connected between Vcc (5V in your case) and an input pin, the pin voltage is 5V, and the logic state is HIGH.

If you use pinMode( pin, INPUT_PULLUP ), the AVR chip provides weak 5V (as through 20K to 50K resistor depending on pin) to the very pin that you read.

The weak current of the pin can be safely grounded and uses tiny power. So you can connect a switch between that pin and GND with no problem or need to add any resistor!

Read that pin with digitalRead() and if the switch is open (button UP) and the return is HIGH. Switch closed (button down) returns LOW --- the opposite of intuition where the switch lets 5V in to a pin moded INPUT. But.. so what? You read the electrical state, not the switch and the chip supplies the V internally!

Do this and you never get floating pin state and never need an external resistor.

Reading an input tales 1 microamp. I have filled a jumper with charge and loop-counted INPUT (LOW) reads to see how much it had when the transistor used to charge the wire was open a very short time to get rough analog reads from piezo disk taps.

Have fun with physics, I only got physics 1 in 1973!

Actually it is, but it's just a circular circuit. Assuming that the pin doesn't draw any current, it would be like this:

  • When switch is open (disconnected), the voltage between the pin and GND is 5V.
    In the other half of the circuit (the other branch) the voltage drop is: 5V of the battery + 0V of the resistor = 5V.

  • When the switch is closed (connected), the voltage between the pin and GND is 0V.
    In the other half of the circuit the voltage drop is: 5V of the battery - 5V of the resistor = 0V.

What you class is hiding from you are first of all the use of the proper words.
There are two types of circuit:-

  1. A series circuit where two or more components are in a chain, one connected to the other.
  2. A parallel circuit where each component, or indeed each series circuit, is connected to the same point in the circuit.

They are also hiding the exact electrical laws that describes it, known as Kirchhoff's law.

youre wrong. Voltage doesnt pass through.

Its not "electricity" . You need to be clear of the meanings of voltage and current.

Here is how pull-up resistors work

Look at it as a potential divider circuit. If the switch is closed Rsw is 0 so Vpin is 0V.
If the switch is open Rsw is "infinite" so Vpin is +Vcc (here 5V)

1 Like

Perhaps review your physics I chapters on electricity.

Note that electricity can be static or flowing. With pins or transistors you can stop current in a wire, still leaving charge in the wire which has voltage/potential. The wire can also be charged through induction and that charge can flow when connected to a conductor. It is half of a capacitor alone, has capacity and can influence other conductors without even touching.

If you heat a wire, it will become more negative. What voltage? is always relative to another.
Objects with charge have electrical fields, your body has one.

Take care to know where charge is flowing or not. Moving charge makes magnetic field... relative movement always! All of these things are related, all go to electrons and protons. You can reduce all electrical effects to charge, field, and relative movement.

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