-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.06 MB
Home Automation - Testing and Validation of the Sensor Data Reading.mp4
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# IOT-Project1 | ||
IOT - Home Automation and Robotic Arm | ||
# Robotic-Arm-Elderly-Support-System |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
#include <FirebaseESP8266.h> | ||
#include <ESP8266WiFi.h> | ||
#include <DHT.h> | ||
|
||
#define DHTPIN 5 | ||
#define DHTTYPE DHT11 | ||
DHT dht(DHTPIN, DHTTYPE); | ||
|
||
#define FIREBASE_HOST "https://dht22-370b1-default-rtdb.firebaseio.com/" | ||
#define FIREBASE_AUTH "DDh1wJOdgNYidNBEnulEeCpPEZ5rgHgDsSyyqzM7" | ||
#define WIFI_SSID "SamrasingheWifi" | ||
#define WIFI_PASSWORD "19570617" | ||
|
||
|
||
FirebaseData firebaseData; | ||
|
||
void setup() { | ||
|
||
Serial.begin(9600); | ||
|
||
dht.begin(); | ||
|
||
|
||
WiFi.begin(WIFI_SSID, WIFI_PASSWORD); | ||
Serial.print("connecting"); | ||
while (WiFi.status() != WL_CONNECTED) { | ||
Serial.print("."); | ||
delay(500); | ||
} | ||
Serial.println(); | ||
Serial.print("Connected with IP: "); | ||
Serial.println(WiFi.localIP()); | ||
Serial.println(); | ||
|
||
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); | ||
} | ||
|
||
void loop(){ | ||
|
||
|
||
float t = dht.readTemperature(); | ||
float h = dht.readHumidity(); | ||
|
||
|
||
if (isnan(t) || isnan(h)) { | ||
Serial.println("Failed to read from DHT11 Sensor"); | ||
return; | ||
} | ||
|
||
|
||
Serial.print("Temperature :"); | ||
Serial.print(t); | ||
Serial.println(" *C"); | ||
Serial.print("Humidity: "); | ||
Serial.print(h); | ||
Serial.println(" %"); | ||
Serial.println(); | ||
|
||
|
||
if (Firebase.setFloat(firebaseData, "/Result_Reading/temperature", t)){ | ||
Serial.println("Temperature sent"); | ||
} else{ | ||
Serial.println("Undeliverable temperature"); | ||
Serial.println("Error: " + firebaseData.errorReason()); | ||
} | ||
|
||
if (Firebase.setFloat(firebaseData, "/Result_Reading/humidity", h)){ | ||
Serial.println("Humidity sent"); | ||
Serial.println(); | ||
} else{ | ||
Serial.println("Undeliverable humidity"); | ||
Serial.println("Error: " + firebaseData.errorReason()); | ||
} | ||
|
||
delay(1000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
#include <FirebaseESP8266.h> | ||
#include <ESP8266WiFi.h> | ||
|
||
#define ssid "SamrasingheWifi" //WiFi SSID | ||
#define password "19570617" //WiFi Password | ||
#define FIREBASE_HOST "https://dht22-370b1-default-rtdb.firebaseio.com/" //Firebase Project URL Remove "https:" , "\" and "/" | ||
#define FIREBASE_AUTH "DDh1wJOdgNYidNBEnulEeCpPEZ5rgHgDsSyyqzM7" //Firebase Auth Token | ||
|
||
FirebaseData firebaseData; | ||
|
||
int Device_1 = D1; //initialize D1 Pin | ||
int Device_2 = D2;//itialize D2 Pin | ||
|
||
|
||
|
||
void setup() { | ||
|
||
Serial.begin(9600); | ||
WiFi.begin (ssid, password); | ||
while (WiFi.status() != WL_CONNECTED) { | ||
delay(500); | ||
Serial.print("."); | ||
} | ||
Serial.println (""); | ||
Serial.println ("WiFi Connected!"); | ||
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); | ||
pinMode(Device_1, OUTPUT); //initialize the Device OUTPUT | ||
pinMode(Device_2, OUTPUT); //initialize the Device OUTPUT | ||
|
||
} | ||
|
||
void loop() { | ||
|
||
if (Firebase.get(firebaseData, "/D1")) { | ||
if (firebaseData.dataType() == "string") { | ||
String De1 = firebaseData.stringData(); | ||
if (De1 == "1") { | ||
digitalWrite(Device_1, LOW); //Device1 is ON | ||
} | ||
else if (De1 == "0") { | ||
digitalWrite(Device_2, HIGH); //Device1 if OFF | ||
} | ||
} | ||
} | ||
if (Firebase.get(firebaseData, "/D2")) { | ||
if (firebaseData.dataType() == "string") { | ||
String De1 = firebaseData.stringData(); | ||
if (De1 == "1") { | ||
digitalWrite(Device_1, LOW); //Device1 is ON | ||
} | ||
else if (De1 == "0") { | ||
digitalWrite(Device_1, HIGH); //Device1 if OFF | ||
} | ||
} | ||
} | ||
|
||
} |