Switches and buttons are common way of user interaction to embedded system. Normally we are used to connect pull-up (or pull-down) resistor for a switch and then check for its value. There is nothing wrong with such circuit, but speaking of power efficiency, this design can cause some problems. Since resistor is constantly connected to VCC while switch is closed, it constantly draws significant current. What if there are tens of switches – circuit starts drawing lots of current. For battery circuits this is in-acceptable.
One simple way would be to select higher pull-up resistor values. In many cases it might work well, but there is always a limit how much you can rise its value. First of all microcontroller input have its threshold current to work reliably. But most importantly due high resistor values and small currents noise signals can start triggering the inputs. Also keep in mind, that switches also require some minimal current ratings. So you should select pull-up resistor with common sense. Other option is to use smarter circuit. If microcontroller have enough pins, you can use I/O pin instead of VCC. This way you can apply “1” signal as VCC when ever you need. Simply turn it “on” when checking its value and then turn “off”. This method is called polling. IF you would use 10K resistor then checking every 10ms current consumption would be around 1.6uA. Comparing to hard VCC connection current consumption is 300uA. You will be amazed how much this ads once you implement this in your next battery powered project.