0 Replies - 508 Views - Last Post: 11 July 2017 - 04:35 PM Rate Topic: -----

#1 ryanbrown204  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-July 17

Saving, Exporting and encrpyting DHT11/22 Arduino Data

Posted 11 July 2017 - 04:35 PM

I am trying to do a personal project and I want to save the data that is being collected from my DHT 11/22 arduino sensor to either a .TXT or a .excel file. I want to be able to encrypt said data and be able to give the user an encryption key to un-encrypt it.

Could you point me in the right direction if this is possible? Below is the code that I have thus far.
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <LiquidCrystal.h>
#include <DHT.h>
#include "DHT.h"
#include <SimpleTimer.h>
#define DHTPIN A0     // what pin we're connected to
#define DHTTYPE DHT11   // we are using the DHT11 sensor

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
DHT dht(DHTPIN, DHTTYPE);
int redled = 13;
int greenled = 7;
int clearled = 10;


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxx";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;
void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
   Blynk.begin(auth, "ssid", "password!"); //insert here your SSID and password
 
  // Setup a function to be called every second
timer.setInterval(1000L, sendUptime);
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(clearled, OUTPUT);
Serial.begin(9600);
lcd.begin(16,2);  //16 by 2 character display
dht.begin();
lcd.print("Hello");
lcd.setCursor(5,1);
lcd.print("I.R.N");// User will have to hard code this in order to change the name/ greeting
delay (1000);
lcd.clear();
delay (200);
}

void sendUptime()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  //Read the Temp and Humidity from DHT
    float h = dht.readHumidity();
  float t = dht.readTemperature(true);  // Read temperature as Feh (Cel is the default)
  Blynk.virtualWrite(18, t); // virtual pin 
  Blynk.virtualWrite(19, h); // virtual pin 
  
}
void loop()
{

  Blynk.run();
  timer.run();
  delay(1000);
  // Reading temperature or humidity takes about 250 milliseconds!

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(t);  //printing temperarture to the LCD display
  lcd.print("'F");
  lcd.setCursor(0,1);
  lcd.print("Humid: ");
  lcd.print(h);  //printing humidity to the LCD display
  lcd.print("%");
 delay (60*3*10);
  lcd.clear();
if (t <= 60)
{
 lcd.print("Its COLD");
   digitalWrite(greenled, HIGH);  
  delay(80);                      
  digitalWrite(greenled, LOW);
}
else if (t >= 74)
{
  lcd.print("Its WARM");
   digitalWrite(redled, HIGH); 
  delay(80);                      
  digitalWrite(redled, LOW);
}
else
{
  lcd.print("Its perfect in ");
  lcd.setCursor(0,1);
  lcd.print("here");
    digitalWrite(clearled, HIGH);   
  delay(80);                      
  digitalWrite(clearled, LOW);
}
  lcd.clear();

if (h <= 20)
{
 lcd.print("Its dry in ");
 lcd.setCursor(0,1);
 lcd.print("here");
 delay(80);                      
}
else if (h >= 74)
{
  lcd.print("Its dewy in ");
  lcd.setCursor(0,1);
  lcd.print("here");
  delay(80);                      
}
else
{
  lcd.print("Its perfect in ");
  lcd.setCursor(0,1);
  lcd.print("here");
  delay(80);                      
}
}







Is This A Good Question/Topic? 0
  • +

Page 1 of 1