Arduino weather station logger I made a program that uses the Adafruit pressure sensor, and the DHT22 temperature and humidity sensor to log pressure, temperature and humidity every 30 minutes. I left it outside my house overnight yesterday in the hopes that it would have logged all the data overnight but it had logged only once. I'm guessing it drained the whole 9V battery in 30 minutes due to some inefficiency in my program? The program works when the sampling rate is at 2 seconds or something small like that. Please tell me how to make the program more efficient so it can do the logging every 30 minutes successfully.

    #include "DHT.h"
    #define DHTPIN 3
    #define DHTTYPE 22

    DHT dht (DHTPIN,DHTTYPE);

#include &lt;SD.h&gt;
#include &lt;SPI.h&gt;

#include "Wire.h"
#include "Adafruit_BMP085.h"

Adafruit_BMP085 mySensor;
File myData;

int cs = 4;//chipSelect for SD reader/Writer
double tempC;//holds temperature reading (Celcius)
double pressure;//holds pressure reading (Pascals)
double humidity;
double DHTtemp;
double finalTemp;

void setup() {
  // put your setup code here, to run once:
  dht.begin();
  SD.begin(cs); //initialize cardReader/Writer
  mySensor.begin();//initialize pressure sensor
  pinMode(10,OUTPUT);//the SD library requires pin 10 to be reserved as OUTPUT and not to be used.

  myData=SD.open("PTDATA.txt",FILE_WRITE);
  myData.println("Logging start at  8:30PM, logging 30-minute intervals");
  myData.println("Time,Temperature,Pressure,Humidity");
  myData.close();


}

void loop() {
//   put your main code here, to run repeatedly:
  myData=SD.open("RLDATA.txt",FILE_WRITE);

  if(myData)
  {
  tempC=mySensor.readTemperature();//read Temperature
  pressure=mySensor.readPressure();//read Pressure
  humidity=dht.readHumidity();
  DHTtemp=dht.readTemperature();//read temp from DHT Sensor

  myData.print(tempC);
  myData.print(",");
  myData.print(pressure);
  myData.print(",");
  myData.println(humidity);
  myData.close();
  delay(1800000);//30 min delay;


  }

 }
Rather than use the Arduino delay feature, use a watchdog timer to turn the Arduino on/off to take readings.  The TI TPL5010 should serve well. http://www.digikey.com/product-detail/en/texas-instruments/TPL5010DDCT/296-38829-2-ND/5130142