double dewPoint(double celsius, double humidity)
{
// (1) Saturation Vapor Pressure = ESGG(T)
double RATIO = 373.15 / (273.15 + celsius);
double RHS = -7.90298 * (RATIO - 1);
RHS += 5.02808 * log10(RATIO);
RHS += -1.3816e-7 * (pow(10, (11.344 * (1 - 1 / RATIO ))) - 1) ;
RHS += 8.1328e-3 * (pow(10, (-3.49149 * (RATIO - 1))) - 1) ;
RHS += log10(1013.246);
// factor -3 is to adjust units - Vapor Pressure SVP * humidity
double VP = pow(10, RHS - 3) * humidity;
// (2) DEWPOINT = F(Vapor Pressure)
double T = log(VP / 0.61078); // temp var
return (241.88 * T) / (17.558 - T);
}
#include "DHT.h"
#include <DS3231.h>
#include <SD.h>
#include "Adafruit_BMP085.h"
Adafruit_BMP085 bmp;
#define DHTPIN 2
#define DHTTYPE DHT22
const int chipSelect = 4;
DHT sensor(DHTPIN, DHTTYPE);
DS3231 rtc(SDA, SCL);
void setup()
{
Serial.begin(2000000);
rtc.begin();
rtc.setTime(12, 0, 0);
rtc.setDate(1, 1, 2014);
sensor.begin();
SD.begin(chipSelect);
bmp.begin();
}
void loop()
{
float humidity = sensor.readHumidity();
float S_C = sensor.readTemperature();
float S_F = sensor.readTemperature(true);
float I_F = sensor.computeHeatIndex(S_F, humidity);
float I_C = sensor.convertFtoC(I_F);
float p = bmp.readPressure();
float y = bmp.readAltitude();
File sdcard_file = SD.open("veri.txt", FILE_WRITE);
if (sdcard_file) {
sdcard_file.print(rtc.getDateStr());
sdcard_file.print(" ");
sdcard_file.print(rtc.getTimeStr());
sdcard_file.print(" Sıcaklık C:");
sdcard_file.print(S_C);
sdcard_file.print(" Nem:%");
sdcard_file.print(humidity);
sdcard_file.print(" Isı C: ");
sdcard_file.print(I_C);
sdcard_file.print(" Çığ Devrilme Noktası(*C):");
sdcard_file.print(dewPoint(S_C, humidity));
sdcard_file.print(" Basınç = ");
sdcard_file.print(p);
sdcard_file.print(" Pa");
sdcard_file.print(" Yükseklik = ");
sdcard_file.print(y);
sdcard_file.println(" metre ");
sdcard_file.close();
Serial.print(rtc.getDateStr());
Serial.print(" ");
Serial.print(rtc.getTimeStr());
Serial.print(" Sıcaklık C:");
Serial.print(S_C);
Serial.print(" Nem:%");
Serial.print(humidity);
Serial.print(" Isı C: ");
Serial.print(I_C);
Serial.print(" Çığ Devrilme Noktası(*C):");
Serial.print(dewPoint(S_C, humidity));
Serial.print(" Basınç = ");
Serial.print(p);
Serial.print(" Pa");
Serial.print(" Yükseklik = ");
Serial.print(y);
Serial.println(" metre ");
delay(10);
}
}