I am still quite new to electronics and I have a question I imagine being quite simple for you guys. I made a simple circuit with a bunch of pushbuttons buttons and potentiometers (see the image below). I want to make the most efficient version of this circuit as I am planning to run this circuit off of a battery(pack) and make it communicate via bluetooth (using these sweet new Nano 33 BLE boards ) to another Nano 33 BLE board.
I have heard that as you go higher with resistance the circuit becomes more efficient. But can the resistance be too big? For now I am using 10K ohm resistor values for these buttons and 10K ohm linear potentiometers. Can I go up to 1M ohm? 10M ohm?
You can use 1 or 10 Meg pots, but you should add a 10 nF capacitor from the pot wiper tap to ground, as the ADC expects a low impedance (10K Ohms maximum) input.
You may also be able to retain the 10k potentiometers and instead of connecting them directly to the 3.3 volt rail, connect them to an mcu pin. Switch the pin high when you want to measure the analog values and low when the device is inactive or in sleep mode.
You can do the same trick with pushbuttons if you expect them to be pressed for a long time (turn the button off when you notice it is pressed and turn it on only for a moment to check if it is still pressed). I think in most of applications the extra current consumption from the button is negligible - the other parts such as blinking LEDs or BLE transmission triggered by the button press needs much more current.
Button consumes current only when pressed while a pot constantly
Long pressed button... sounds like a switch.
Come to think of it, a toggle switch is the most energy efficient of them all. Connect the input pin to either Vcc or GND. No resistors needed, no leaking of current.
Pots - you could go to 1MΩ but indeed will need a small cap. 1-10nF is fine, smaller for faster reaction if needed (1 nF gives millisecond reaction times). You're losing 3.3µA at 3.3V, 10 µA between the three of them. Whether that's significant depends on the rest of the project.
Wawa:
You don't have to use resistors at all for buttons if you use internal pull up.
Enable internal pull up with pinMode, and wire the button between pin and ground.
pinMode(buttonPin, INPUT_PULLUP); // button between pin and ground, NO external resistors
Inverted logic.
The pin is now normally HIGH, and LOW when the button is pressed.
Leo..
Will this be more efficient however? To me this results in the same effect as external resistors right?
Is there a difference in the efficiency of between pull up and pull down resistors? If I'd had to guess pull down is more efficient as there will be no current flowing from GND as opposed to pull up where there might be current flowing through the resistor to the digital pin??
TheAliw1:
Will this be more efficient however? To me this results in the same effect as external resistors right?
No, because you can turn the internal pull-ups on and off in code.
Now there is a concern about excess current consumption when an input is floating, but if you have buttons - and nothing else - connected between pins and ground, then while you are not reading the button using pinMode of INTERNAL_PULLUP, you write it LOW and ( then) make it an OUTPUT.
TheAliw1:
Is there a difference in the efficiency of between pull up and pull down resistors? If I'd had to guess pull down is more efficient as there will be no current flowing from GND as opposed to pull up where there might be current flowing through the resistor to the digital pin??
100k pots are probably a reasonable compromise (and actually readily obtainable). 33µA per pot.
A good rule of thumb is that 10µA or lower consumption and the battery will be self-discharging faster
than the circuit drains it, ie that's about as low power consumption as you need to go for something
permanently wired in.
450mAh cell at 10µA drain takes 5 years to discharge (most battery chemistries self-discharge much
faster).
For something that's powered up sporadically much higher standing currents are acceptible, a few mA is reasonable.