Why 10K resistor for a push button?


Most of the tutorials I’ve seen directed to use a 10K resistor for push button (Input) in arduino uno. But I don’t understand the concept behind that. i.e. whether ohms law is used.

For a led light I understand how to calculated the resistor value using ohms law.

I am Attaching the photo and also the tutorial.

I’ve also seen this circuit diagram and what i don’t understand is why this guy used 3 x 10k resistors (for Input signal )

The author probably only had 10k resistors for his voltage divider.

R1,2,3 are all connected in series between lightbulb and ground.

Each resistor has now 1/3 of the battery voltage across when the bulb is lit
(I hope there is a switch between batt and bulb).

1/3 of the bulb voltage is on R3, and that (~4volt) is connected to the Arduino input pin.


Most of the tutorials I've seen directed to use a 10K resistor for push button (Input) in arduino uno. But I don't understand the concept behind that. i.e. whether ohms law is used.

I don't know why you are mentioning a "push button" since the diagram you attached has nothing to do with a push button or the reason a button needs a pullup resistor.

For YOUR diagram, the circuit is taking the nominal 12 volts that appears across a lamp and dividing it by 3 to obtain around 4 volts which is a good, safe value for an Arduino input pin. It also takes into account that if the charging system of the vehicle raises the battery voltage ABOVE 12 volts (which it does... it can go as high as 14.1 volts or more), then the Arduino input pin will still be within specs (i.e. at 14.1 volts the Arduino input will see 4.7 volts - within spec).

If I were doing that I would add a small noise bypass capacitor from each Arduino input to ground (say 0.1 uF to 1.0 uF) to keep ignition noise out.

Now, talking about a PUSHBUTTON... when the Arduino pin is setup as an input, it's floating (that is, nothing defines it's value and it can drift anywhere between 0 and 5 volts). Using a pullup resistor (or the pinMode (INPUT_PULLUP) function) clearly defines the input pin at 5 volts. Then, pushing the button connects the pin to ground and the pin goes to 0 volts.

Each state (5 volts or 0 volts) can be read using the digitalRead() function and will tell you if the button is pressed or not.

Without a pullup, the pin could arbitrarily be at 5 volts, 0 volts or something in between. Then, the digitalRead() function would not work (that is, what it returned would not accurately reflect the state of the button).

Make sense?

Pull ups are commonly 10k on-board and lower values like 2k2 off-board.

The higher the value less power is wasted, but the noise pickup susceptibility is greater, any value from
100 ohms to 10M can work, but the rule of thumb is 10k is adequate to protect against noise on-board
(assuming a PCB with a ground plane). The pullup value must be >> switch’s on-resistance, and << inter-trace
leakage resistance (those are typically 0.1 ohm and 10^9 ohms, so there is a massive possible range for

For long-term reliability of switches you will sometimes see lower value pull-ups which are used to deliberately
select a higher current through the switch, which helps with prevention of corrosion build-up - enough current
is used to breakdown any oxide layer. Most metal oxides have appreciable resistance and would interfere
with the switch’s function if not broken down.

For micro-power circuits you’ll often see chips that have built-in current sources as pull-ups, perhaps only
10uA, in order to reduce power consumption.

Ohm's Law is always in use, whether you realize it, or not...
The technical answer to the switch question is: so your power supply does not go "Snap, Crackle, Pop".

10k is sort of the generic "Eh, whatever" value that's used when you aren't trying to do something particularly exotic. With the pullup on the same board as the chip, in a place with normal amounts of electrical noise, and running off a mains adapter, pretty much anything between 1k and 1meg will work. 10k is just a generic value that pretty much any everybody is going to have tons of.

The story changes though if you do have an unusual requirement.

  1. Electrical noise. Stronger (lower resistance) pullups are able to resist noise better since more power is necessary to change the pin voltage. If you are operating the circuit near a brushed DC motor or an internal combustion engine (spark plugs), those things radiate a ton of EMI that can overwhelm a weak pullup. Depending on how bad the noise is you might even need to go below 1k. If the button is mounted offboard, the wires can act as antennas, increasing noise pickup and potentially needing stronger pullups. That's why MarkT's post uses stronger pullups for offboard connections.

  2. Power consumption. Pullups waste current when the switch is closed, so if you're trying to be miserly and pinching coulombs, making them weaker (higher resistance) can save some power. This guy on the EEVBlog forum set himself quite a goal of ultra low power: under 1uA of operating current to run the microcontroller off of a small solar cell. He didn't quite make it, but in order to fit the pullup resistors into his power budget he had to use 10meg, far higher than most people usually do.

If you're running off of mains power this isn't an issue since the circuit has access to all of the power it could ever want. This only matters if you are restricted in the amount of energy you can use, either because your source has a limited total capacity (supercap or battery) or can only provide limited power output (solar cell or other "alternative energy" source like a turbine).

I thought I had a third thing, but apparently not.

Anyway, choosing the right pullup is an exercise in finding the correct balance between these two conflicting requirements.

Make sense?

Yes & Thanks for explaining the divider concept and also suggesting noise bypass capacitor. Now I am clear.

Anyway, choosing the right pullup is an exercise in finding the correct balance between these two conflicting requirements.

Thanks & Sure bro. I will learn it gradually. Thanks for information :slight_smile: