Power consumption of hardware

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:

int readTemp(int tempVar) {
  dht.begin();
  pinMode(PIN_VCC_DHT, OUTPUT);
  digitalWrite(PIN_VCC_DHT, HIGH);
  tempVar = (int)dht.readTemperature();
  digitalWrite(PIN_VCC_DHT, LOW);
  return tempVar;
}

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

If you are "doing something" your power consumption will increase. Why so you think the increase is too high?

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.

Perhaps you are switching the wrong pins.

For low power operation all unused pins should be INPUT_PULLUP or OUTPUT mode, so they don't draw
lots of power. Basically leave no pin floating.

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.

External devices are independant

Usually the power consumption of devices is independant of other chips when the power-to-ground voltage does not change.

If your ATmega goes into sleep mode other devices do not care. There are some chips that have a sleep mode . The DTH22 does not support this.

You can simulate a sleep mode by using a logic level N-MOSFET between ground and your sensor.

Though often it is more convenient to switch Vcc with a p-FET, then ground continuity is not affected.

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.

Do you know of a suitable P FET for this please.
Small less than 100mA.

My usual sites are unavailable at present.

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.

DMG3415 - P-Channel MOSFET.pdf (529 KB)

DMG6968 - N-Channel MOSFET.pdf (184 KB)

Jiggy-Ninja:
Wait, did I just say breakout boards? Yeah, the only come in SOT23. That might dampen your enthusiasm a bit.

Yes , i want something i can plug into a breadboard.

Boardburner2:
Yes , i want something i can plug into a breadboard.

I mentioned breakout boards, didn't I? It takes a small amount of practice (my first one totally sucked), but they're doable by hand.