minimizing button current draw

I am workning on a project wich is batery powered. I have a button which is getting the arduino back from sleep mode. I am using the internal pull-up resistor in the arduino, but the current draw is 0,13 mA when the button is pressed and when it isn't pressed it's almost 0,00 mA.

My question is, is there a way to minimize the current the button/pull-up resistor draws, so i can get a better power efficiency?

Does it really matter? How long are you going to be holding that button down?

But you could reduce the current by disabling the internal pull-up resistor and using an external resistor with a larger value. With R=1M the current (for 5V) would be about 5uA, not counting input leakage, which should be something like 1uA or less. The debounce time might get longer if you use a really big resistor.

Ok, thank you.

It matters because the button is a door sensor (magnetic reed switch) and the door is open and closed the same amount of time

  1. Use an external resistor so you can control the value.

  2. Or, disable the internal pull-up when the "button" is pressed. You will have to regularly enable the pull-up, wait at least two clock cycles, then test the current state. Somewhere on this forum @Udo Klein posted an example.

  3. Or, position the reed switch so it toggles when the door passes. You will have to be lucky or add a second sensor to reliably determine the direction.

[quote author=Coding Badly link=msg=2280882 date=1434593095]
2. Or, disable the internal pull-up when the "button" is pressed. You will have to regularly enable the pull-up, wait at least two clock cycles, then test the current state. Somewhere on this forum @Udo Klein posted an example.[/quote]

Here's that Udo Klein thread: Minimizing power consumption - Bar Sport - Arduino Forum

It's nice if it works because it reduces the part count by one resistor. But will it work? If the processor disables the internal pull-up and the button is released (or bounces) will it reliably "float" to the high state? I would be afraid to count on this. I have seen floating pins jitter between low and high. EDIT: I misread what you posted. Re-enabling the pull-up before each check makes sense.

Otherwise I found it an interesting thread to read. I am currently trying to do something very similar to what Udo was after.

For ngylling, if you haven't read through this yet, it's worth the time: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

If the processor disables the internal pull-up and the button is released (or bounces) will it reliably "float" to the high state?

No. Which is why it is necessary...

...when the "button" is pressed. You will have to regularly enable the pull-up, wait at least two clock cycles, then test the current state.

This looks like the post of interest...
http://forum.arduino.cc/index.php?topic=957.msg7486#msg7486

Thank you. I caught my mistake ~1 minute before you posted the correction. It's a good solution I think.

Could a SPDT reed switch be used instead?