Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to your code if you like #13

Closed
prahjister opened this issue Jan 25, 2017 · 1 comment
Closed

Add to your code if you like #13

prahjister opened this issue Jan 25, 2017 · 1 comment

Comments

@prahjister
Copy link

I have added a DHT11 sensor and ldr sensor to you code and it is working well. Add if you like.

The DHT.h library needs to be version 0.1.13. Doesnt compile right with latest

LDR is wired to A0 with a voltage divider....I used a variable resistor to tweak and did most of my testing on an uno to get max voltage below 1v. This Works very well surprisingly very sensitive. In a dark room i get 0 and the glow from laptop screen is picked up.

DHT11 is going to D6 GPIO12

//Extra Sensors Setup
//Light Reading**********************************************
unsigned long previousLightMillis = 0;
const int lightInterval = 120000;
//Temp Sensor************************************************
#include <dht.h>
dht DHT;
#define DHT11_PIN 12
int inPin = 12;

//Start Extra Sensors in main loop
extraSensor();

//More Sensors

void extraSensor() {

if (millis() - previousLightMillis >= lightInterval) {

//Read Analog Light Sensor
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
previousLightMillis = millis();
String lighttopic = "home/Light";
sendMQTT(lighttopic,String(sensorValue));
//Read DHT Sensor
int chk = DHT.read11(DHT11_PIN);
float temp = DHT.temperature;
Serial.print("Temperature = ");
Serial.println(1.8temp+32);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
String temptopic = "home/DHT/temp";
sendMQTT(temptopic,String(1.8
temp+32));
String humiditytopic = "home/DHT/humidity";
sendMQTT(humiditytopic,String(DHT.humidity));
}

}

@1technophile
Copy link
Owner

Added an addon for DHT
d70875c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants