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.
Use an external resistor so you can control the value.
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.
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]
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.