galoebn
Published © LGPL

Log temperature and humidity without SD-card

On most Arduino boards there is an EEPROM where data can be saved permanently. In this project we use that to store weather data.

IntermediateFull instructions provided2,097
Log temperature and humidity without SD-card

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
Any other Arduino board should also work
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1

Story

Read more

Schematics

Schematics

Code

temerature_logger

Arduino
#include <dht11.h>
#include <EEPROM.h>

#define DHT11PIN 4

dht11 DHT11;
unsigned int address = 0; //variable to iterate through the addresses of the EEPROM
unsigned int delaytime = 1; //delay between readings in seconds

void setup(){
  delay(1000);
  Serial.begin(9600);

  unsigned int i = 0;
  while(EEPROM.read(1023) >= i){   //this loop prints the saved data from the EEPROM
    Serial.print("Time: ");
    Serial.print((i * delaytime/2)/60);
    Serial.println(" min.");
    Serial.print("Temperature: ");
    Serial.println(EEPROM.read(i));
    ++i;
    Serial.print("Humidity: ");
    Serial.print(EEPROM.read(i));
    Serial.println("%");
    ++i;
    Serial.println();

    delay(100);
  }

//  while(EEPROM.read(1023) >= i){   //this loop plots the saved data from the EEPROM
//    Serial.print(EEPROM.read(i));
//    Serial.print(" ");
//    Serial.println(EEPROM.read(i+1));
//    ++i;
//    ++i;
//
//    delay(100);
//  }

  delay(20000); //this delay will give you 20 seconds before the new data is written to the EEPROM
                //if you want to keep the old data you have to reset the board before the delay is over
}



void loop(){
  delay(delaytime*1000 - 10); //delay between the readings
  
  int chk = DHT11.read(DHT11PIN);
  EEPROM.update(address, DHT11.temperature); //the temperature reading is written to the EEPROM
  ++address;
  delay(10);
  EEPROM.update(address, DHT11.humidity); //the humidity reading is written to the EEPROM
  ++address;

  EEPROM.write(1023, address);
}

Credits

galoebn
9 projects • 5 followers
Contact

Comments

Please log in or sign up to comment.