Guillermo Alberto Pérez Guillen Automation Home
1. Introduction 2. Schematic Diagram 3. Electric Diagram 4. Hardware 5. Software INDEX
6. Photographs 7. Links This work is author s property, and has been registered on the Website http://www.safecreative.com with the registration code 1607058305393 and protected under the License Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
1. INTRODUCTION HISTORY Early home automation began with labor-saving machines. Self-contained electric or gas powered home appliances became viable in the 1900s with the introduction of electric power distribution and led to the introduction of washing machines (1904), water heaters (1889), refrigerators, sewing machines, dishwashers, and clothes dryers. In 1975, the first general purpose home automation network technology, X10, was developed. It is a communication protocol for electronic devices. It primarily uses electric power transmission wiring for signalling and control, where the signals involve brief radio frequency bursts of digital data, and remains the most widely available. By 1978, X10 products included a 16 channel command console, a lamp module, and an appliance module. According to Li et. al. (2016) there are three generations of home automation: 1) First generation: wireless technology with proxy server; 2) Second generation: artificial intelligence controls electrical devices; 3) Third generation: robot buddy who interacts with humans. BENEFITS OF SMART HOMES The benefits of the smart home are by no means limited to convenience, although this is a compelling feature. The automation of simple tasks saves us time time that could be spent on our families, our careers, or other passions, which is a strong selling proposition. Smart homes also have the potential to be greener and cheaper: water and energymonitoring tools, and programs to optimize energy consumption, could impel us to lower our water and energy usage, which could, in turn, lower our bills and reduce our carbon footprint. Automation and centralized control have serious benefits for family caregivers. By integrating home healthcare equipment, such as monitoring and diagnostic tools, smart homes could simplify the caregiving process for the hundreds of millions of adults worldwide who care for an elderly, ailing, or infirm parent or relative. For example, a smart home might allow you to monitor the movements of a relative suffering from dementia
PROJECT Design a Home Automation and using Arduino UNO and App Inventor. This project serves to control lamps or bulbs and other electrical or electronic devices proposed. Goals: 1. The home s lamp or light bulb is activated with a switch of the App. 2. The bedroom s lamp or light bulb is activated with a switch of the App. 3. The bathroom s lamp or light bulb is activated with a switch of the App. 4. The kitchen s lamp or light bulb is activated with a switch of the App. 5. The door s lock is controlled with a switch of the App and using a servo. 6. A fan activated with a switch of the App. 7. An alarm system is activated with a switch of the App and using a PIR motion sensor and a buzzer. 8. A light detection system is activated with a switch of the App and using a LDR sensor and 3 leds that can illuminate outdoors at night. 9. A humidity and temperature system and using a DHT11 sensor and print the values on the notifier of the App. 10. A gas detection system and using a MQ2 sensor when there s a gas leak the kitchen s lamp or light bulb is triggered and print a message on the App. 11. A voice-activated system and using speech recognizer and the microphone of the hads free and the cellular network or the wifi network.
2. SCHEMATIC DIAGRAM
3. ELECTRIC DIAGRAMA 4
4. HARDWARE The components used are as follows: Arduino UNO Bluetooth HC-05 DHT11 Sensor MQ2 Sensor PIR Motion Sensor LDR Sensor Servo Buzzer Fan Relay 5V Transistor NPN Resistances: 220, 330, 570, 1K, 10K, 100K LEDs Battery: 5 V, 3.3 V and 9V The schematic diagram and electrical diagram show me the physical and wireless connections to build this project. Arduino UNO is connected via wired to the devices: DHT11, MQ2, PIR, Buzzer, Fan, Servo, LDR, LED and HC-05. Arduino UNO board can communicates with the Smart Lights Smartphone application via wireless and using the Bluetooth HC-05. The Smart Lights Smartphone application communicates with the voice recognition system of Google via wireless through the wireless network or telephone network data. You can see the list of parts used in this project in the section Things. In the video where I show you my work you can see the tests with the hardware devices as switch on or turn off the four LEDS, door, fan, alarm and light detection system. It also shows me the values measured as humidity and temperature and gas leak alarms and flashing lamp.
5. SOFTWARE 1. Arduino program This program is developed with Arduino and is named Smart_Lights.ino, the program contains the comments of its operation and is registered in Safe Creative.
The operation of the Software, I divided into three parts: 1. Use of switches in the Smart Lights Smartphone application to control the following systems: light bulbs, door, fan, alarm and light detection. 2. Using voice commands to control the same devices shows in the part one. 3. Using the Arduino UNO board to control the DHT11 and the MQ2 sensors and sending data to the Smart Lights Smartphone application via Bluetooth. This code is author s property, and has been registered on the Website http://www.safecreative.com with the registration code 1607058305409 and protected under the License Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 You can get the link of source code on the chapter 7.
Arduino UNO - Smart Lights // AUTOMATION HOME //Author Guillermo Alberto Perez Guillen #include <Servo.h> #include DHT.h #define DHTPIN 2 #define DHTTYPE DHT11 DHT dht(dhtpin, DHTTYPE); // DHT11 pin Servo servomotor; // Name of servo int pos = 5; //Hall, Bedroom, Bathroom, Kitchen, Ventilator and Alarm pins int ledpin1= 13, ledpin2= 12, ledpin3= 11, ledpin4= 10, ledpin6= 8, ledpin7= 7; const int ledpin8 = 6; // LDR pin const int analoginpin = A0; // Analog input pin that the MQ-2 is connected int sensorvalue = 0; // value read from the sensor
void setup() { Serial.begin(9600); dht.begin(); pinmode(ledpin1, OUTPUT); pinmode(ledpin2, OUTPUT); pinmode(ledpin3, OUTPUT); pinmode(ledpin4, OUTPUT); pinmode(ledpin6, OUTPUT); pinmode(ledpin7, OUTPUT); pinmode(ledpin8, OUTPUT); servomotor.attach(9); servomotor.write(pos); delay(5); } // initialize serial communication: // Sets the digital pins as output // Set the pin 9 as servo void loop() { int h = dht.readhumidity(); int t = dht.readtemperature(); // Save DHT11 humidity // Save DHT11 temperature sensorvalue = analogread(analoginpin); // MQ-2 sensor reading if (sensorvalue >= 500) { Serial.println( GAS LEAK ); digitalwrite(ledpin4, HIGH); // Kitchen On delay(200); digitalwrite(ledpin4, LOW); // Kitchen Off } delay(5); if (isnan(t) isnan(h)) { Serial.println( Error in the DHT sensor ); //Message of error if there aren t numbers
} else { delay(5); Serial.print( Humidity= ); Serial.print(h); Serial.println( %\t ); Serial.print( Temperature= ); Serial.print(t); Serial.println( *C ); } // Humidity printing // Temperature printing if (Serial.available() > 0) { int inbyte = Serial.read(); switch (inbyte) { case a : // Hall On digitalwrite(ledpin1, HIGH); case b : // Hall Off digitalwrite(ledpin1, LOW); case c : // Bedroom On digitalwrite(ledpin2, HIGH); case d : // Bedroom Off digitalwrite(ledpin2, LOW); case e : // Bathroom On digitalwrite(ledpin3, HIGH); case f : // Bathroom Off digitalwrite(ledpin3, LOW); case g : // Kitchen On
digitalwrite(ledpin4, HIGH); case h : // Kitchen Off digitalwrite(ledpin4, LOW); case i : // Door Open for(pos = 5; pos < 180; pos += 5) { servomotor.write(pos); delay(10); } case j : // Door Close for(pos = 180; pos>=5; pos-=5) { servomotor.write(pos); delay(5); } case k : // Ventilator On digitalwrite(ledpin6, HIGH); case l : // Ventilator Off digitalwrite(ledpin6, LOW); case m : // Alarm On digitalwrite(ledpin7, HIGH); case n : // Alarm Off digitalwrite(ledpin7, LOW); case o : // LDR On
digitalwrite(ledpin8, HIGH); case p : // LDR Off digitalwrite(ledpin8, LOW); default: // Turn all the LEDs off for (int thispin = 2; thispin < 7; thispin++) { digitalwrite(thispin, LOW); } delay(200); } } }
2. App Inventor 2 Application This application is for a cell and is developed with App Inventor 2 and is called Smart Lights and the files that compose it are: Smart_Lights.aia and Smart_Lights.apk and are registered in Safe Creative.
This code is author s property, and has been registered on the Website http://www.safecreative.com with the registration code 1607058305386 and protected under the License Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
You can get the link of source code on the chapter 7. Button connect
Button Light example.
Button Spech Recognizer
The following photos show a test. 6. PHOTOGRAPHS
This is the first version of my project and I m pleased because I achieve my goals. It was not so easy to do it because there are several pressures, mainly get the necessary material and have the knowledge and enough time. As designer, this project leaves me good and interesting experiences such as: 1.- Voice-activated system depends on: a) The pronunciation of voice must be loud and clear, b) To reduce external noise, c) The signal quality of the wireless telephone network must be good, and d) We must use keywords to reduce errors, for example I used door open instead open the door 2.- Don t overload the Batteries, for example Arduino UNO only can give us 500 ma of current. 3.- Avoid doing complex program code because the microcontroller only has 8 bits and 20 MHz clock, otherwise the program would collapse or blocked.
7. LINKS The video of this project is on Youtube at the following link: https://youtu.be/f5n7nfmm8x4 This video shows us: The objectives The hardware used in this project. The software used to program the Arduino UNO. The software used to develop the application of the Smartphone, in this case I use App Inventor 2. Tests performed with switches and voice-activated system. The Tutorial project is located at the following link: http://hubpages.com/technology/automation-home-with-arduino-uno Arduino UNO Source code: https://drive.google.com/file/d/0b8xmvcdjvbbyu0xuejetrnkyn00/view? usp=sharing App Inventor 2 Source code: https://drive.google.com/file/d/0b8xmvcdjvbbycxhit2padfbtdle/view? usp=sharing Image of App Inventor 2 Source code: https://drive.google.com/file/d/0b8xmvcdjvbbyau5mcjbstexidhc/view? usp=sharing