Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Dazzy17 authored Jun 8, 2021
1 parent 4f38dd9 commit ca266ff
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 2 deletions.
Binary file added 10707085-Group 21.docx
Binary file not shown.
Binary file added ARDUINO_APPs_with_HA (1).aia
Binary file not shown.
Binary file not shown.
Binary file added Home Automation - Light.mp4
Binary file not shown.
Binary file not shown.
3 changes: 1 addition & 2 deletions README.md
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 added Robotic Arm Controlled Via App.mp4
Binary file not shown.
77 changes: 77 additions & 0 deletions dht11.ino
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);
}
58 changes: 58 additions & 0 deletions home_automation_light_fan.ino
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
}
}
}

}

0 comments on commit ca266ff

Please sign in to comment.