5

I'm developing a low power project based on Atmega328p which among other things uses a DHT22 to measure air humidity. DHT22 spec says that it consumes 50uA when idle. This is too high for me (I'm aiming at sub 10uA consumption for the whole device when in sleep mode) so I've figured out that I'll just power it from one of Atmega328p pins. This will give me the ability to turn it off or on at software level. DHT22 consumes only 1.5mA during measurement so I should be fine (a single Atmega's pin can safely provide up to 20mA). I've set up a following test circuit:

schematic

The red wire powers DHT22, the blue one is for data transfer, the black one is GND and the 4.7k is a pull-up resistor.

My problem is that after I turn on the DHT22 using just:

digitalWrite(4, HIGH);

the Atmega either resets or hangs or... successfully turns on the DHT22 and keeps working, but that happens about 10% of the time. My suspicion is that there is some current spike in the moment of supplying power to the DHT22. Unfortunately I don't have an oscilloscope to confirm this.

I've added a 220 ohm resistor between VCC pin of DHT22 and the pin 4 on the Arduino and it solved the problem. My question is: will it work like this reliably? Are humidity readings reliable when voltage is not stabilized (but stays within 3.3-5.5V range as required by the datasheet)? I could of course use a transistor to turn it on/off, but I'd like to keep it as simple as possible.

Why DHT22's datasheet doesn't mention this current spike? Here it is for reference: http://www.adafruit.com/datasheets/Digital%20humidity%20and%20temperature%20sensor%20AM2302.pdf

5
  • This is probably due to a voltage drop when you start powering the DHT. Have you tried adding a decoupling cap between pin 4 and GND? Otherwise a MOSFET triggered by pin 4 and providing the supply to the DHT may be a good solution.
    – jfpoilpret
    Commented Feb 1, 2015 at 8:27
  • Please note that sub 10uA consumption when idle is very ambitious and I wonder how you'll be able to stay under this threshold with such a circuit.
    – jfpoilpret
    Commented Feb 1, 2015 at 8:32
  • The 220 resistor is a solution, but you probably want to add a capacitor after it, to smooth the voltage at the DHT. The datasheet already suggest adding a 100nF capacitor across the power of the sensor.
    – Gerben
    Commented Feb 1, 2015 at 13:26
  • pinMode(4, OUTPUT)? Commented Dec 29, 2015 at 11:32
  • I haven't ever had to use the cap even with 20 meter cable runs. (Maybe the cable does that for me.) With that long of a run I get a definite voltage drop so it barely takes any current yet provides accurate values. Never would I put a resistor across any of the pins, even if my cable is only 10cm long. But have you tried it?
    – SDsolar
    Commented May 7, 2017 at 2:41

3 Answers 3

2

The sensor is a large capacitive load. You need to improve decoupling of the CPU power supply.

A 10 uF between 5V and GND will help for the current spike and the resistor in series with the sensor will not be an issue (50 uA on 250 Ohm makes only 12.5 mV voltage drop once the sensor is started).

0
0

The previous answers regarding adding decoupling capacitors are good.
You don't have to be concerned about the voltage drop across your 220 ohm resistor. MAC's answer states that only 12.5mv drop at 50uA (when not measuring).
During measurement, 1.5mA will result in 0.33v drop across the 220 ohm resistor. This should be noted, but is not a problem. The DHT22 data sheet shows that it will accept any supply voltage between 3.3v and 6v.
Looks like you have a good design.

0

Decoupling capacitors do help, as mentioned in the other answers.

Also, to get a good reading, after powering up your digital pin 4, a delay of maybe 100-500ms may be required to allow the DHT22 to stabilize. For better results, you can also perform multiple readings (call delay(dht.getMinimumSamplingPeriod()) between the readings) and average them.

It looks like you are using an Arduino Uno. For further power savings, you might consider using a Pro Mini and performing some hardware modifications. For software power saving techniques, there is no better resource than Nick Gammon's Power saving techniques for microprocessors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.