# What if I use 230 ohm resistor with 5V input to Ground?

So I've build up a button like in this example but instead a 10k Ohm resistor I used a 230 Ohm one. The board run fine and the button example works correctly but I'm still worried if there will be any long-time consequences from this. I'm a total newbie at electronics.

Also when the button is pressed for a long time the resistor get a little hot (not like to hurt your skin but still).

The resistor is there to make sure that the pin is connected and pulled-down to ground as its default state. When you close the switch it receives 5V instead. However because your resistor value is so low, it is conducting a fair amount of current. This resistor is meant to limit the amount of current can flow to ground.

As current flows through the resistor it heats up, which is a good indication it should be removed for a larger one.

Or ditch the pull down and wire the switch from ground to the input and enable the internal pullup.

``````pinMode(pin, INPUT_PULLUP);
``````

The switch will read LOW when pushed.

'Internal pull-ups' is only three tutorials past 'button', you'd think they could put them together to teach about using one or the other. Rather than messing around with external ones first, then telling you there are better ways for simple projects.

If only the world was perfect. Then there would be no need for this forum. LOL

I think it is because people associate LOW with off and have a hard time with off being on.

Off subject: but once I applied for a job with Linear (sorta a small scale IBM) about 40 years ago. I knew TTL logic circuits (7400 series ). They gave me a written test, about logic ttl ckts. I failed it. Come to find out, their low was -5v, and their high was ground (I never had a clue). I guess it's all relative.

have a hard time with off being on.

That's understandable...

"but instead a 10k Ohm resistor I used a 230 Ohm one." That substitution may draw lots more power than needed, but It will not hurt anything. In most cases, a button is not held down for a long time, so if the button is only pressed for one second, then there is not much difference is current draw.

But, I suggest you pick up some more resistor values. Other circuits may not be so forgiving.

groundfungus: Or ditch the pull down and wire the switch from ground to the input and enable the internal pullup.

``````pinMode(pin, INPUT_PULLUP);
``````

The switch will read LOW when pushed.

What are the drawbacks of this method - it will consume more energy I guess?

Arduino GPIO pins have two modes (INPUT or OUTPUT). When configured as an INPUT, the pin becomes a high impedance (100 Mohms) input) If you are sensing a push button, the pin MUST be configured as an INPUT, therefore you can short it directly to 5V or GND without using any power to speak of . What you CAN'T do is connect the push button IN BETWEEN 5V and GND and then push the button because you will short your 5V power supply. Thus, ANY DISCUSSION OF POWER CONSUMPTION OF AN I/O PIN CONFIGURED AS AN INPUT is completely irrelevant and non valid. Such a discussion would only be appropriate for a pin configured as an OUTPUT .

Do you understand the significance of a input impedance of 100 Mohms ?

If you are discussing the power consumption of a 10k ohm pullup resistor, it depends on WHAT you connect that input pin to. By itself , an INPUT pin with a 10k pullup is part of a voltage divider with 10k in the upper position and 100 Mohms in the lower position. Any discussion of input pin power consumption would have to be based on the circuit that you connect to that input pin.

"What are the drawbacks of this method - it will consume more energy I guess?"

Depending on how often the button is pressed, and how long it is held down, is the processor run 24/7 ?

With the natural order of things, I think you would be right. But I still suggest getting a varity pack of resistors.

What are the drawbacks of this method - it will consume more energy I guess?

Less power... IIRC, the internal pull-up is 20k-50k Ohms.

Note that power is only consumed when the switch is on. (That's true with pull-ups or pull-downs.)

From Ohm's Law 5V/250 Ohms is 20mA, and that's about the same current as an LED. No big deal, but pull-ups or pull-downs are usually in the range of 1K to 10K.

As far as energy, power is calculated as Voltage x Current, so 250 Ohms is 1/10th of a Watt.

it will consume more energy I guess?"

How long do you plan to hold the button down ? (effectively connecting a 230 ohm resistor across 5V and GND.

I = V/R = 5V/230 ohms = 0.0217 A (21.7 mA) P = I x V = 0.0217 A x 5V = 0.1086 W = 109 mW (while the button is held down)

Can you spare 100 mW ? (for 1 second ?)

For the full lowdown on this question read this:- http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

"If you are sensing a push button, the pin MUST be configured as an INPUT, therefore you can short it directly to 5V or GND "

I beg to differ: If your switch will short it directly to 5V, then the other side of the coin is, " short it to GND, leave it floating, or use a small pull down resistor".

The default being shorted to ground, nor leave it floating will not be a functional option. So, use a small pull down resistor is the only viable option. I could be mistaken tho.

raschemmel: Arduino GPIO pins have two modes (INPUT or OUTPUT). When configured as an INPUT, the pin becomes a high impedance (100 Mohms) input) If you are sensing a push button, the pin MUST be configured as an INPUT, therefore you can short it directly to 5V or GND without using any power to speak of . What you CAN'T do is connect the push button IN BETWEEN 5V and GND and then push the button because you will short your 5V power supply. Thus, ANY DISCUSSION OF POWER CONSUMPTION OF AN I/O PIN CONFIGURED AS AN INPUT is completely irrelevant and non valid. Such a discussion would only be appropriate for a pin configured as an OUTPUT .

Do you understand the significance of a input impedance of 100 Mohms ?

If you are discussing the power consumption of a 10k ohm pullup resistor, it depends on WHAT you connect that input pin to. By itself , an INPUT pin with a 10k pullup is part of a voltage divider with 10k in the upper position and 100 Mohms in the lower position. Any discussion of input pin power consumption would have to be based on the circuit that you connect to that input pin.

So what are you saying is that I can directly connect the 5V through switch into the Input pin because it have high resistance?

But why is the example linked here so complicated then?

Also what will happen if I press the button before the 'setup' function executes or if I mistakenly don't configure the pin as INPUT?

bsld: Also what will happen if I press the button before the 'setup' function executes or if I mistakenly don't configure the pin as INPUT?

Arduino pins are defaulted to inputs, which is a safe state.

Consider wiring two inputs to each other. Nothing happens as both expect but don't receive. Consider wiring two outputs to each other. The pins are now trying to source current into each other which is bad.

Default inputs is safe.

Also if your pushing the button prior to the setup function, the pin will sink current, but nothing will happen. The MCU is safe and will wait for your code to tell it to do something with it's current pin state.

https://www.arduino.cc/en/Tutorial/DigitalPins

This explains further on pins and why pull-ups/pull-downs are necessary.

The default being shorted to ground, nor leave it floating will not be a functional option. So, use a small pull down resistor is the only viable option. I could be mistaken tho.

Think about it. The input pin represents a 100 Mohm resistor to ground. The pullup /pulldown resistor is out of the circuit UNLESS the button is pressed. This means the pullup/pulldown resistors are not conducting any current unless you press the button.

[u]CASE -A[/u] (230 ohm pullUP resistor) button open => no current button pressed => (230 ohm resistor across 5V and GND => 21mA/0.1W consumed

or use a small pull down resistor".

I think you mean use a LARGE pulldown resistor. (230 ohm is already way too SMALL) A pullup/pulldown resistor should be 10k >= optimum <= 50k

230 is a value NO ONE with any electronics experience would ever consider using unless it was LITERALLY the ONLY OTHER resistor they had available. PERIOD

[u]CASE-B[/u](230 pullDOWN resistor) button open => no current button pressed => (230 ohm resistor across 5V and GND => 21mA/0.1W consumed

Consider wiring two outputs to each other. The pins are now trying to source current into each other which is bad.

This topic is about an INPUT pin. The above comment is not relevant to this topic.

Also what will happen if I press the button before the 'setup' function executes or if I mistakenly don't configure the pin as INPUT?

That's EXACTLY WHY no one would ever consider using such a low value as a pullup/pulldown resistor.

raschemmel: Think about it. The input pin represents a 100 Mohm resistor to ground. The pullup /pulldown resistor is out of the circuit UNLESS the button is pressed. This means the pullup/pulldown resistors are not conducting any current unless you press the button.

[u]CASE -A[/u] (230 ohm pullUP resistor) button open => no current button pressed => (230 ohm resistor across 5V and GND => 21mA/0.1W consumed

I think you mean use a LARGE pulldown resistor. (230 ohm is already way too SMALL) A pullup/pulldown resistor should be 10k >= optimum <= 50k

230 is a value NO ONE with any electronics experience would ever consider using unless it was LITERALLY the ONLY OTHER resistor they had available. PERIOD

[u]CASE-B[/u](230 pullDOWN resistor) button open => no current button pressed => (230 ohm resistor across 5V and GND => 21mA/0.1W consumed

This topic is about an INPUT pin. The above comment is not relevant to this topic.

That's EXACTLY WHY no one would ever consider using such a low value as a pullup/pulldown resistor.

What about my first question - can I directly connect the 5V through switch into the Input pin and will it work that way?

Because you've said that the input pin have it's own resistors.