# Multiple buttons on 1 analog VS one digital per button:Power Consumption

i kinda need to add some buttons onto the watch and power efficiency is really important in this project. So im wonder which method consumes less power? Multiple buttons on 1 analogRead like here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267115381 or 1 digitalRead for each button

1 DigitalRead per button: Cons: each Pulldown resistor will always be spending power even while the button is not pressed. Pros: no hardtime tweaking pwm interval

Multiple buttons on 1 analog: Cons: each button pwm has to be defined. Pros: Less power consumption "i think"...

im not very good with electronics... please guide me which method i should use to add buttons onto my watch Thanks smiley

I think you may be misunderstanding the post. That post has no where on it that it talks about PWM, rather it is talking about reading in the voltage across the voltage divider. Here is the schematic that is in one of the posts:

 Analog pin 5
|
Ground--1K--|--------|--------|-------|-------|
|        |        |       |       |
btn1     btn2     btn3    btn4    btn5
|        |        |       |       |
220 Ohm  390 Ohm  680 Ohm   2.2K    4.7K
|--------|--------|-------|-------|-- +5V


There is still always a pull down resistor to ground regardless of button presses.

Now, it is true that if you switch to the digital method you will have more pull down resistors since you will need one per switch instead of one total, however the amount of power you are talking about is very minimal, and for some one who doesn't have much electronics experience, the power may be practically 0. Also they are using a 1k pull down for the analog method, you could easily get away with 10k and larger for the digital method and be just fine.

If power is still a concern for you, then you will need to learn more about your microcontroller. Many times micros will have internal pull up resistors meaning you don't even have to have a single resistor on your switch. It also may be the case that going with a pull up rather than a pull down will be more energy efficient, but even then this is microcontroller specific.

Overall I would say to go with a pull up that is say 10K or larger and move on with life. If you find that it really is pulling too much power then you can consider looking into it more.

You want digital with a pull-up. Most microcontrollers can provide the pull-up internally, but you can also choose for an external resistor if you want a higher resistance value, for instance. Not that this value matters much because there won't flow any current if the button isn't pressed. Only for the short time the button is pressed there will be a small current; if you use 100k$\Omega$ pull-ups you'll have a few tens of $\mu$A with a duty cycle probably as low as 0.001%.
A pull-down instead of pull-up is also possible, but is less common. If you use it, be sure to switch the internal pull-ups off.

Especially for tact switches which aren't operated often a 100nF capacitor parallel to the contacts is a good idea. The capacitor will be shorted when the button is pressed, and the small current peak will keep the contacts clean.

As a rule of thumb analog subsystems draw a lot of power, more than digital subsystems. So if the analog solution requires you to enable an A/D converter that would otherwise be off, that alone might make it loose.

If your project is power-critical, are you cyclic your application (active .. asleep)? If so, the active/sleep ratio will be very important for the average power use. Most A/D's are slow, so that might also make it loose.

As for current consumed by digital pull ups: they draw current only when the button is pressed, which is probably an insignificant percentage of time. You can minimise it even further by connecting them to an I/O pin that is pulled high only during reading.

• In most systems, buttons will only be pressed a very small percentage of the time. If a button spends 99.9% of the time not being pushed, saving 1mA during the time the button is pushed would only reduce the overall power consumption by 1uA. It's possible to design analog as well as digital subsystems with essentially zero quiescent current. If one doesn't have enough wakeup-on-change inputs to implement a zero-quiescent-current keyboard wakeup, an analog keyboard may end up using less current than a digital one. – supercat Aug 29 '11 at 16:33
• The "Current Consumption of Peripheral Units" section of the ATMega324p tells us that the ADC uses approximately 250 microamps at 1MHz. This guy will almost certainly be better off disabling the ADC entirely. The pin change interrupts allow an AVR to wakeup-on-change on all its IO pins. – joeforker Aug 29 '11 at 19:09

Unless buttons are going to be held for an extended period of time, the amount of current required to read analog-coded or digital button inputs is unlikely to be a significant factor in overall energy usage. There are, however, some advantages and disadvantages to each approach:

-1- Many processors can sleep until a digital input switches. While such techniques may be usable with some wiring methods for analog-coded buttons, using such techniques with analog buttons will often add some complexity.

-2- When using analog buttons, great care must be taken to prevent button pushes from being misread. Pushing and releasing buttons at just the right time may cause the input to be sampled at an incorrect value, and--depending upon switch design--lightly pushing a button may cause it to connect with significant resistance. For example, pushing the button tied to a 2.2K resistor in such a way that the button has 1K of resistance may cause it to be misidentified as the button connected to the 3.3K resistor.

-3- It may be possible to connect a group of analog buttons with fewer wires than a group of digital buttons.

The approach I would recommend for analog buttons would be to have a resistor string connect between a digital I/O ports and ground, and have the buttons connect various spots on that string to an analog input which has a very large pull-up resistor and digital-wake-up functionality. When the unit is idle, the digital I/O ports should be set low, and the code should wait for the input to go low. Pushing any button will cause the input voltage to drop to nearly zero volts. At that time, drive the digital I/O port high and read the analog voltage a few times until it seems to be stable. The voltage read will be nearly independent of switch resistance, but the amount of power consumed by the circuit while it's idle will be essentially nil.