Smart Home/Space Monitor
by Geeve George in Workshop > Home Improvement
2856 Views, 52 Favorites, 0 Comments
Smart Home/Space Monitor
ABOUT THIS PROJECT :
Artificial Intelligence is the future of computing. A artificial intelligence system understands and performs action in a intelligent way. My project aims to build a artificially intelligence home automation system that can monitor the surroundings and notify the user in an interactive way. Current Home Automation systems have remained the same for years , to bring a change to this I have created a new method for a home automation system that can contribute to the development of the 5th generation of computing and also towards Home Automation. Speech Recognition is one of the earliest forms of 5th generation computing , thus I wrote a program in the Arduino IDE with unique algorithms to monitor and interact with the user and provide an intelligent voice assistant service.
How Is It Intelligent?
1) Interactive Voice Assistant
2) Collects Data and represents the data for weather forecast in a interactive way.
3) Algorithms makes the program independent and analyses the users speech for appropriate actions.
Required Components :
1) Arduino Uno R3
2) 1Sheeld ( For wireless interaction via Bluetooth using your smartphone )
3) Grove Base Shield
4) 4 Pin Jumpers
5) LED
6) Light Sensor ( LDR/Photoresistor )
7) Temperature Sensor 8) Buzzer ( Optional )
* You can buy all the above components online , this is an cheap , fast , easy and interactive home automation system.
Hardware Setup
1) Using the 4 pin jumpers , connect the temperature sensor to Analog Pin 0 and Light Sensor to the Analog Pin 1 in the Grove Base Shield.
Coding!
The code shown below can be used in the Arduino ide.
To get the 1sheeld libraries working you need to follow the official 1sheeld getting started tutorial here
The code has been uploaded to my Github page :
// Project By Geeve George
#define CUSTOM_SETTINGS #define INCLUDE_TEXT_TO_SPEECH_SHIELD #define INCLUDE_VOICE_RECOGNIZER_SHIELD #define CUSTOM_SETTINGS #define INCLUDE_MIC_SHIELD #define INCLUDE_SMS_SHIELD
/* Include 1Sheeld library. */ #include
int ledPin = 13; float sinVal;
int toneVal;
/* A command which will be compared. */
const char firstCommand[]="what is the temperature now";
/* A command which will be compared. */ const char secondCommand[]="how is the weather today";
/* A command which will be compared. */ const char thirdCommand[]="did i leave the lights on";
const char fourthCommand[]="lights on";
const char fifthCommand[]="lights off";
const int pinTemp = A0; // pin of temperature sensor
float temperature; int B=3975; float resistance;
/* A name for the LED on pin 13. */
int pinLight = A1;
void setup() { /* Start communication. */ OneSheeld.begin(); /* Set the LED pin as output. */ pinMode(ledPin,OUTPUT); pinMode(8, OUTPUT); }
void loop() { /* Always check if a new voice command received. */ if(VoiceRecognition.isNewCommandReceived()) { /* Check if the voice command is the desired one. */ if(!strcmp(firstCommand,VoiceRecognition.getLastCommand())) { int val = analogRead(pinTemp); // get analog value resistance=(float)(1023-val)*10000/val; // get resistance temperature=1/(log(resistance/10000)/B+1/298.15)-273.15; int n= temperature ; String stringMsg="The Temperature is :"; stringMsg += String(n); stringMsg +="degree celcius sir";
//Convert our message to a character array so as to tweet it to twitter char msg[140]; stringMsg.toCharArray(msg, 140); TextToSpeech.say(msg); } /* Check if the voice command is the desired one. */ else if(!strcmp(secondCommand,VoiceRecognition.getLastCommand())) { int val = analogRead(pinTemp); // get analog value resistance=(float)(1023-val)*10000/val; // get resistance temperature=1/(log(resistance/10000)/B+1/298.15)-273.15; int n= temperature ; String stringMsg="The Temperature is :"; stringMsg += String(n); stringMsg +="degree celcius sir";
//Convert our message to a character array so as to tweet it to twitter char msg[140]; stringMsg.toCharArray(msg, 140); if(n >= 40) { /* 1Sheeld responds using text-to-speech. */ TextToSpeech.say("the weather is pretty harsh sir"); } else if(n >= 30 && n <= 39) { TextToSpeech.say("it is pretty hot outside sir"); } else if(n >= 27 && n <= 29) { TextToSpeech.say("The weather is pretty warm sir"); } else if(n >= 23 && n <= 26) { TextToSpeech.say("The weather is good sir"); } else if(n >= 18 && n <= 22) { TextToSpeech.say("The weather is moderate sir"); } else if(n >= 14 && n <= 17) { TextToSpeech.say("It is a mild weather sir"); } else if(n >= 10 && n <= 13) { TextToSpeech.say("It is a pretty cool weather sir"); } else if(n >= 6 && n <= 9) { TextToSpeech.say("It is a cold weather sir"); } else if(n >= 0 && n <= 5) { TextToSpeech.say("It is a very cold weather sir"); } } /* Check if the voice command is the desired one. */ else if(!strcmp(thirdCommand,VoiceRecognition.getLastCommand())) { if(analogRead(1)>500) { TextToSpeech.say("yes sir you have left the lights on"); } else if(analogRead(1)<500) { TextToSpeech.say("no sir the lights are turned off"); } }
} else if(!strcmp(fourthCommand,VoiceRecognition.getLastCommand())) { digitalWrite(13, HIGH); } else if(!strcmp(fifthCommand,VoiceRecognition.getLastCommand())) { digitalWrite(13, LOW); } }
You can download the repo here : https://github.com/GeeveGeorge/AIHomeAutomation/blob/master/ai.ino
The Future!
In the future I envision my project to work alongside the artificial intelligent machines like prosthetic limbs & robots.
I also wish to improve the current implemented algorithm and make a safe and interactive artificial intelligent home automation system.
This project can evolve into a safe and interactive Artificial Intelligence Home Automation System!