Using Gammon's excellent site on controlling power consumption I set up a standaloe ATmega328 as standalone.
Using sketch H on 3.3V it consumes 4uA.
When I connect a nRF24 consumption jumps to 20uA.
Further adding a DHT22 it jumps to 70uA.
I thought I'd go ahead and limit the the consumption of the DHT by only reading it in a loop such as:
The idea was to make sure relevant output pins was set to low when not being utilized. It doesn't seem to affect power consumption as much as expected.
I am aware that a OUTPUT pin on LOW isn't entirely off.
But, for the sake of the example, how could I go about limiting power consumption during sleep in mentioned setup?
It is the consumption during sleep. I would imagine being able to attach hardware without any extra power consumption when the attached hardware is on LOW pins only.
I never tried it but I would think having pin LOW and connecting "anything" between it and GND should make no difference. Your code shows you are powering the device up and using it. You are not? Do you have the pin really LOW or is it floating?
Matti:
The idea was to make sure relevant output pins was set to low when not being utilized. It doesn't seem to affect power consumption as much as expected.
I am aware that a OUTPUT pin on LOW isn't entirely off.
But, for the sake of the example, how could I go about limiting power consumption during sleep in mentioned setup?
Best,
mathias
The other devices mentioned would require a sleep mode as well for this to work.
Only thing i can think of is to use an output pin of arduino to control a fet to remove the power to the devices when not required.
The data sheet for the nrf indicates a low power mode of 22 uA as you have measured.
There is another mode which is about 1uA listed.
Why do you think it makes a difference if your pin is sinking current (loop VCC - MCU OUTPUT - MCU GND-pin - GND) or sourcing current (loop VCC - VCC-pin of MCU - MCU OUTPUT - GND)?
Especially with a DHT sensor it seems to be a particularly bad idea to set the pin to low, because those sensors have a pull-up on the data line. Setting your data pin LOW constantly consumes power according to the pull-up resistor. the recommented(?) 4.7kOhm results in 700uA alone.
In this particular case, it seems to me that the best solution is to switch the pin to INPUT. It will not float due to the external pull-up, but it will be high-impedance and not send any relevant current over the pull-up. MarkT's INPUT_PULLUP should also work in this case, but if the sensor would require a pull-down, then you would get a constant current again.
MarkT´s respone is also a good solution, as the external device will always be on common ground, even when switched off.
A MOSFET is like a mechanical switch (on/off) if the gate voltages are in the correct range. The internal impedance is usually below 0.1 Ohms if the gate voltage is above a certain level.
I just bought DMG3415's recently. They're spec'ed to work at awesomely low gate voltage (71 milliohms @ 1.8V gate, 2A drain current) with an ESD protected gate. I soldered 10 on them to breakout boards and didn't destroy a single one.
Wait, did I just say breakout boards? Yeah, the only come in SOT23. That might dampen your enthusiasm a bit.
Datasheet for the comparable N-channel is also attached.