Sinchan0009
Published © GPL3+

Monitoring Temperature and Humidity Using Cayenne

In this project we will create temperature and humidity monitor using cayenne.

BeginnerShowcase (no instructions)1 hour5,248
Monitoring Temperature and Humidity Using Cayenne

Things used in this project

Hardware components

ESP8266 ESP-12E
Espressif ESP8266 ESP-12E
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Cayenne
myDevices Cayenne

Story

Read more

Schematics

DHT 22 SCHEMATIC.JPG

Code

DHT_Cayenne.ino

C/C++
#include "CayenneDefines.h"
#include "CayenneWiFi.h"
#include "CayenneWiFiClient.h"
#include <SimpleTimer.h>
#include "DHT.h"

#define CAYANNE_DEBUG
#define CAYANNE_PRINT Serial
#define DHTPIN 5
#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
// Change the value of token, ssid, and pwd to yours
char token[] = "xxxxxx";
char ssid[] = "xxxxxx";
char pwd[] = "xxxxx";
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Cayenne.begin(token, ssid, pwd);
  dht.begin();
}

CAYENNE_OUT(V0)
{
  float t = dht.readTemperature();
  Cayenne.virtualWrite(V0, t); //virtual pin
}

CAYENNE_OUT(V1)
{
  float h = dht.readHumidity();
  Cayenne.virtualWrite(V1, h); //virtual pin
}

void loop() {
  Cayenne.run();
}

Credits

Sinchan0009

Sinchan0009

5 projects • 5 followers

Comments