DHT 11

Will a 9v battery be able to power a DHT11 (with the programming below) through an arduino uno for 24 hours? :confused:

#include <dht.h>

dht DHT;

#define DHT11_PIN 7

void setup(){
Serial.begin(9600);
}

void loop()
{
int chk = DHT.read11(DHT11_PIN);
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
delay(180000);
}

No.
An Uno draws a about 50mA on it's own.
A 9volt battery might last 2-8 hours, depending on battery quality.
Leo..

Thanks

A single 9V gets you around 500mAh.
As a point of reference, a single AAA battery has roughly double that, depending on the brand.
And a single AA has roughly 5 times the capacity of the 9V. You'd need 6 of them to get up to the 9V voltage, which is kind of a waste if you're going to regulate it down to 5V anyway.

Instead of that delay(180000) use a sleep function, to put your Arduino to sleep.
Use a Pro Mini (rip off the power LED) or completely barebones processor and get rid of most of that 50 mA of the Uno - which is largely peripherals.
Run on 3xAA batteries (about 4.5V) without regulator or so. Plenty of voltage for an ATmega.
That way you can probably last weeks on a set of batteries, if not months.