Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
vilaswkhade
Published © GPL3+

Temperature, Humidity data logger- IoT controled LED

Simple Temperature, Humidity data logger with Time-Stamp and control LED over internet.

BeginnerProtip2,713
Temperature, Humidity data logger- IoT controled LED

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
5 mm LED: Red
5 mm LED: Red
×1

Story

Read more

Schematics

data-logger connections

Temperature ,Humidity logger with Time Stamp.

Code

data-logger.ino

C/C++
Stores data in SPIFF in CSV format.
#include <DHT.h> // library of DHT11 temperature and humidity sensor
#include <CavyIoTdevelopmentBoard.h>

//----------------------DHT11 connection------------------------------------
DHT dht(8, DHT11);
//--------------------------------------------------------------------------

//---------------For communication with DevBoard ----------------------------
#define rx 10
#define tx 11
#define rst 13
//---------------------------------------------------------------------------
CavyIoT myIoTdevice;       //Create instance of CavyIoT Object.
//---------------------------------------------------------------------------
//--------------------- Sensor Variables ------------------------------------
float temp;
float hum;

//--------------------------------------------------------------------------
void setup()
  {
   Serial.begin(9600);
   myIoTdevice.SetPort(rx,tx,rst);
   dht.begin();
  
//--------------------- Button Labels----------------------------------------   
 
  Serial.println("Wait for a while to connect!");
  /*------To start Device replace your own credentials here-----------------------------*/ 
  myIoTdevice.StartDevice
  /*Your Wi-Fi router->*/("WiFi-SSID","WiFi-password",
   /* CavyIoT------>*/"Username","password","Device");//
 //--------------------------------------------------------------------------
   }

void loop()
  {
                                   
    myIoTdevice.loop();  //Updates the Status variable.                           
  
   Serial.println("Device Status:-"+myIoTdevice.Status);
   
   //---------Read values from sensor ---------------------
  
   temp=dht.readTemperature();
   hum=dht.readHumidity(); 
  
   //----------------Sending data to server----------------------------------
   myIoTdevice.UpdateSensorData
      ( "Temperature",String(temp),  "C",
         "humidity",  String(hum),   "Rh"
      );

}//End of loop

Credits

vilaswkhade

vilaswkhade

3 projects • 15 followers

Comments