Introduction: Smart Home Monitoring Using Edison

Picture of Smart Home Monitoring Using Edison

For frequent travellers and those who have multiple houses and those who have to switch between them frequently,Smart Home Profile is a Home Automation solution that solves his need to reiterate his personal preferences

Step 1: Managing Sensors Via Python

Picture of Managing Sensors Via Python

#!/usr/bin/env python

import mraa,json,urllib,time

sensors=["sensor_a","sensor_b","sensor_c"] sensor_a = mraa.Gpio(6) sensor_b = mraa.Gpio(7) sensor_c = mraa.Gpio(8)

sensor_a.dir(mraa.DIR_OUT) sensor_b.dir(mraa.DIR_OUT) sensor_c.dir(mraa.DIR_OUT)

user="bc-ef-f0-c5"

times=[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,00,1,2,3,4,]

for value in times: sensor_a.write(int(json.loads((urllib.urlopen('https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+a+'.json')).read()))) sensor_b.write(int(json.loads((urllib.urlopen('https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+b+'.json')).read()))) sensor_c.write(int(json.loads((urllib.urlopen('https://bc-ef-f0-c5.firebaseio.com/time/7:00/sensor_'+c+'.json')).read()))) time.sleep(3)

time.sleep(10)

Step 2: Connecting to Cloud

Picture of Connecting to Cloud

You can use Openshift for cloud based application.I made an Python application based on Flask.

and for database solution I used Firebase

I used MFRC522 for RFID tag for for edison

#include
#include

#define SS_PIN 10 #define RST_PIN 9 MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key;

// Init array that will store new NUID byte nuidPICC[3]; SoftwareSerial portOne(10, 11);

void setup() { Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only }

// Start each software serial port portOne.begin(9600); SPI.begin(); // Init SPI bus rfid.PCD_Init(); // Init MFRC522

for (byte i = 0; i < 6; i++) { key.keyByte[i] = 0xFF; }

//Serial.println(F("This code scan the MIFARE Classsic NUID.")); //Serial.print(F("Using the following key:")); //printHex(key.keyByte, MFRC522::MF_KEY_SIZE); } void loop() {

// Look for new cards if ( ! rfid.PICC_IsNewCardPresent()) return;

// Verify if the NUID has been readed if ( ! rfid.PICC_ReadCardSerial()) return;

//Serial.print(F("PICC type: ")); MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak); // Serial.println(rfid.PICC_GetTypeName(piccType));

// Check is the PICC of Classic MIFARE type if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI && piccType != MFRC522::PICC_TYPE_MIFARE_1K && piccType != MFRC522::PICC_TYPE_MIFARE_4K) { //Serial.println(F("Your tag is not of type MIFARE Classic.")); return; }

if (rfid.uid.uidByte[0] != nuidPICC[0] || rfid.uid.uidByte[1] != nuidPICC[1] || rfid.uid.uidByte[2] != nuidPICC[2] || rfid.uid.uidByte[3] != nuidPICC[3] ) { //Serial.println(F("A new card has been detected."));

// Store NUID into nuidPICC array for (byte i = 0; i < 4; i++) { nuidPICC[i] = rfid.uid.uidByte[i]; } Serial.println(F("The NUID tag is:")); //Serial.print(F("In hex: ")); printHex(rfid.uid.uidByte, rfid.uid.size); } else Serial.println(F("Card read previously."));

// Halt PICC rfid.PICC_HaltA();

// Stop encryption on PCD rfid.PCD_StopCrypto1(); }

void printHex(byte *buffer, byte bufferSize) { for (byte i = 0; i < bufferSize; i++) { Serial.print(buffer[i] < 0x10 ? " 0" : " "); Serial.print(buffer[i], HEX); portOne.write(2); //Serial.write(buffer[i] < 0x10 ? " 0" : " "); //Serial.write(buffer[i], HEX); } }

Comments

DIY Hacks and How Tos (author)2016-03-20

Cool Edison project.

About This Instructable

295views

1favorite

License:

More by sanjayj17:Smart Home Monitoring Using Edison
Add instructable to: