About This Project
Hello, this is my first finished cayenne project. It works perfect im using it everyday. It have two DHT22 sensors one for inside temp second for outside temp and hum. I added rain sensor so i know when its raining outside. One of biggest reasons for creating this project was my problem with too high humidity inside my appartment so LED indicate me when its too high so i can open windows for lower it.
I used RGB LED … one color for high inside humidity, second color for rain, third color for both of them in same time.
Cutout for LCD is made by CNC…but to be honest i measure bad thick of that box so cut is wrong as you can see on photos…my bad (sorry for my bad english)
What’s Connected
- ESP8266
- 2x DHT22
- rain sensor
- RGB LED
- LCD 5110
- box from china, 2x3.5mm jack(M/F),hot glue,cables
Triggers & Alerts
- i use to try rain alert by email but i was constantly spammed whole time when there was raining so i turn it off. If anyone have solution for this let me know, im ok if it notifi me once per hour for example.
Scheduling
no scheduling
Dashboard Screenshots
Photos of the Project
action!)Code
#include "CayenneDefines.h" //wifi
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
#include <SPI.h> //LCD
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
char token[] = "6cghdqvbxf";
char ssid[] = "SSID";
char password[] = "password";
#include <DHT.h> //senzor
#define DHTPIN 4
#define DHTPINB 0
#define DHTTYPE DHT22
Adafruit_PCD8544 display = Adafruit_PCD8544(15, 13, 12, 5, 16); //LCD
DHT dht(DHTPIN, DHTTYPE);
DHT dhtb(DHTPINB, DHTTYPE);
int led = 2;
int sensorPin = A0;
int sensorValue = 0;
float hum, temp;
float humB, tempB;
void setup(void)
{
Serial.begin(115200);
display.begin();
display.clearDisplay(); // clears the screen and buffer
display.display();
dht.begin();
Cayenne.begin(token, ssid, password); //Cayenne
pinMode(led, OUTPUT);;
}
void loop(){
Cayenne.run();
display.clearDisplay();
display.setContrast(40);
{
display.setCursor(0, 0);
display.setTextSize(2);
display.println(temp, 1);
}
{
display.setTextSize(1);
display.setCursor(48, -2);
display.print((char)111);
}
{
display.setTextSize(2);
display.setCursor(58, 0);
display.println(hum, 0);
}
{
display.setCursor(0, 20);
display.setTextSize(2);
display.println(tempB, 1);
}
{
display.setTextSize(1);
display.setCursor(48, 18);
display.print((char)111);
}
{
display.setCursor(58, 20);
display.setTextSize(2);
display.println(humB, 0);
}
{
display.setCursor(0, 40);
display.setTextSize(1);
display.println(analogRead(A0*100/1024), 1);
}
{
display.setCursor(20, 40);
display.setTextSize(1);
display.println("% dážď");
}
// display.command( PCD8544_FUNCTIONSET | PCD8544_POWERDOWN);
hum = dht.readHumidity();
temp = dht.readTemperature();
humB = dhtb.readHumidity();
tempB = dhtb.readTemperature();
delay(500);
if (hum > 50){ //ledka svieti ked je +50% hum1
digitalWrite(led, HIGH);
}
else {
digitalWrite(led, LOW);
}
}
CAYENNE_OUT(V0)
{
Cayenne.virtualWrite(V0, dht.readTemperature(true));
}
CAYENNE_OUT(V1)
{
Cayenne.virtualWrite(V1, dht.readHumidity());
}
CAYENNE_OUT(V2)
{
Cayenne.virtualWrite(V2, dhtb.readTemperature(true));
}
CAYENNE_OUT(V3)
{
Cayenne.virtualWrite(V3, dhtb.readHumidity());
}
CAYENNE_OUT(V5)
{
int sensorValue = analogRead(A0); //svetelny LDR
Cayenne.virtualWrite(V5, sensorValue);
}