1 An-Najah National University Faculty of Engineering and Information Technology Computer Engineering Department Graduation Project II “Hybrid Smart Home “ Prepared by: Hala Shehada & Yana Besher Supervised by: Dr. Hanal Abu Zanat Date:27/5/2023 Presented in partial fulfillment of the requirements for bachelor’s degree in computer engineering. 2 Acknowledgment First of all, we thank God for what we have achieved and for this achievement. And for the benefits that we obtained in this project, which will benefit us in the rest of our lives. In addition, we would like to extend our gratitude to everyone who contributed to this project. It would not have been possible if it weren't for their assistance and support. I sincerely appreciate Dr. Hanal Abu Zanat he helped us finish the project with his direction and strict oversight. Sincere gratitude and appreciation are extended to our dear Drs in the department of computer engineering, who deserve all the credit for helping us get this far and for whom we will be eternally grateful, as well as to our families for their support throughout this stressful experience, our colleagues who provided moral and technical support, and the people who helped out willingly. 3 Disclaimer This report was written by Hala Shehada and Yana Besher at the Computer Engineering Department, Faculty of Engineering, An-Najah National University. It has not been altered or corrected, other than editorial corrections, because of the assessment and it may contain language as well as content errors. The views expressed in it together with any outcomes and recommendations are solely those of the students. An-Najah National University accepts no responsibility or liability for the consequences of this report being used for a purpose other than the purpose for which it was Commissioned. 4 Contents Acknowledgment .................................................................................................................................... 2 Disclaimer ............................................................................................................................................... 3 Table of Figure ........................................................................................................................................ 6 Abstract .................................................................................................................................................. 7 1 Introduction ......................................................................................................................................... 8 1.1 The problem: ........................................................................................................................... 8 1.2 Significance: ................................................................................................................................... 9 1.3 Objectives and Scope ..................................................................................................................... 9 Report Organization .............................................................................................................................. 10 2. Constraints and Earlier Coursework ................................................................................................... 11 2.1 Constraints .................................................................................................................................. 11 2.1.1 Inexperience ......................................................................................................................... 11 2.1.2 Lack of funds ......................................................................................................................... 11 2.1.3 Lack of Time .......................................................................................................................... 11 2.2 Earlier coursework ....................................................................................................................... 12 2.2.1 Microcontrollers and PIC ....................................................................................................... 12 2.2.2 Micro-Processor: ................................................................................................................... 12 2.2.3 CPU Lap: ............................................................................................................................... 12 2.2.4 Micro controllers Lab: ........................................................................................................... 12 2.2.5 Wireless & Communication Lab: ............................................................................................ 12 2.2.6 Critical Thinking and Research Skills ...................................................................................... 12 3. Literature Review .............................................................................................................................. 13 4. Methodology ..................................................................................................................................... 13 4.1 Overview of The System ......................................................................................................... 13 4.2 Hardware Components ................................................................................................................ 14 4.2.1 wireless parts ........................................................................................................................ 14 4.2.2 Arduino ................................................................................................................................. 15 5. Discussions and Results ................................................................................................................. 23 6. Conclusion ..................................................................................................................................... 23 6.1 Summery ................................................................................................................................ 24 6.2 Things we learned ................................................................................................................. 24 6.3 Learning curve ....................................................................................................................... 13 5 6.4 Future worke ......................................................................................................................... 13 7 References ............................................................................................................................. 13 6 Table of Figure Figure 1 :Wireless Fig. .......................................................................................... 14 Figure 2 : Wired circuits ............................................ Error! Bookmark not defined. Figure 3 : Wired part ............................................................................................ 16 file:///C:/Users/aya92/Desktop/report/report2.docx%23_Toc112327766 7 Abstract Houses typically have separate electrical systems and gadgets for each purpose, each of which must be handled differently and operates independently of the others, so we need a smart home that makes use of a variety of technologies to outfit home components for more intelligent monitoring and remote control as well as to enable them for influential harmonic interaction, so that daily household chores and activities are automated without user intervention or under the user’s remote control in a simpler, more practical, more efficient, safer, and more affordable manner. Smart homes have the potential to increase energy efficiency, comfort, and convenience in the house. Additionally, it offers secure conditions for persons who are elderly or have disabilities. Our smart home technology can be categorized into two main types, wired system and wireless system, The wireless makes the system more scalable and expandable. The features that the system provide: 1. RFID door lock system. 2. It is possible to control the lighting, the heating and cooling system, an umbrella to protect from rain, and closing the gate by using a Bluetooth. 3. Keypad to secure the house from thieves. 4. Warning system with different sounds in cases of fire, theft and gas in the house.it sends SMS messages in these cases and print on the screen. 5. Moisture sensor and irrigation system so your plants stay healthy. 8 1 Introduction 1.1 The problem: There is a lot going on in their minds about what is modern technology and what are the advantages of a smart home, and how is it designed and equipped at home? A smart home is where anywhere can be digitally controlled. Opening the door, your home security, heating and water... Everything can be controlled Even the process of turning on your home lights you can monitor and control remotely through technology. The absence of smart homes can result in a few challenges for homeowners. Here are some common issues faced when homes are not equipped with smart technologies: 1. Lack of Convenience 2. Energy Inefficiency 3. Limited Security Measures 4. Safety Concerns 5. limitations in mobility and accessibility 6. Limited Entertainment Options 7. Home Management Inefficiencies So, we decided to design a smart home that uses the wired and wireless system. 9 1.2 Significance: Building a smart home that incorporates both wired and wireless systems offer several advantages. Here are some reasons why this hybrid approach is important: 1. Scalability and Expandability: Hybrid smart homes allow for easy scalability and expandability. You can start with a wired infrastructure for essential components and gradually incorporate wireless devices as your needs evolve. This enables the seamless integration of new devices without extensive rewiring or infrastructure changes. 2. Enhanced Security: Wired connections are generally more secure than wireless networks, as they are less vulnerable to hacking or unauthorized access. By using wired connections for sensitive devices and data transmission, we can enhance the security of our smart home system. This is particularly important for devices like smart lock. 3. Integration of Legacy Devices: Wired connections are suitable for integrating legacy devices that may not have wireless capabilities. This allows you to bring older appliances or systems into your smart home setup and control them through a centralized automation system. 4. Cost Efficiency: Hybrid smart home allows for a balance between infrastructure costs and convenience. 1.3 Objectives and Scope The purpose of a hybrid smart home is to leverage the advantages of both wired and wireless technologies to create a flexible, expandable, reliable, and efficient home system. The hybrid approach aims to address the limitations of each technology and provide an optimal solution for different smart home applications. 10 Report Organization • The report starts with the [First Chapter, Introduction,] which provides a background on the research. • Second chapter: In this chapter, [Limitations and Earlier Coursework,] which demonstrates how limitations were overcome and solutions identified, and Earlier courses that helped with the creation of this project. • Third chapter: The earlier works that have been published and are conceptually comparable to ours are listed in the literature review chapter. We talk about their strengths and weaknesses as well as how we differ from them. • Fourth chapter (Methodology): Along with the features we provide and the technology used, we also discussed the mindset with which we designed the project. • Fifth and final chapter: We discussed the outcomes, as well as the project's lessons learned and potential future advancements. 11 2. Constraints and Earlier Coursework 2.1 Constraints 2.1.1 Inexperience To make sure that the concept we are going for is attainable, we created a variety of straightforward demonstrations and testing. However, all of these tests required time that we could have used for other activities. 2.1.2 Lack of funds Some alternatives required more funding to be created, which would have made the project too costly and unaffordable, especially on a small scale. 2.1.3 Lack of Time The most important element of every task is time. A modest amount of time is needed for such things as research, communication, testing, development, understanding requirements, planning, time lost due to inexperience, in addition to time lost due to barriers, strike, and due to changing the idea of the project and starting work after approval in the ninth week of semester. 12 2.2 Earlier coursework 2.2.1 Microcontrollers and PIC All the basics of the Arduino like basic serial communication were taken in these courses. 2.2.2 Micro-Processor: gave a background on the current and voltage dealing with of ICs and modules. 2.2.3 CPU Lap: contributed to the wiring, welding, and debugging of the hardware components. 2.2.4 Micro controllers Lab: Brought theoretical knowledge into practice in dealing with I/O, serial communication, motors. 2.2.5 Wireless & Communication Lab: one of the most important courses we got a benefit from it, we use wireless communication between three sender and one receiver, we took advantage of the Bluetooth in the Wireless course, where we designed a project using Bluetooth. 2.2.6 Critical Thinking and Research Skills One of the few non-technical courses that is also lifetime taught both the research and report writing in this course. 13 3. Literature Review  The purpose of this paper was to discuss how to understand wired and wireless smart homes and know when to use each type,” The decision between choosing a wired or wireless smart home system ultimately depends on what works best for your lifestyle and budget.” [1].  To find out what applications can be implemented in the smart home, we reviewed a paper “SMART HOME SYSTEMS”.[2].  About ESP32: ESP-NOW and how they work we read this site.[3] that helped us understand what ESP-NOW is and how it can be used. 4. Methodology In this chapter, we'll explore the system's concept, the components that were utilized to make it happen, the development process that led to it, and the final product. 4.1 Overview of The System In this research, a hybrid smart home was developed to creating a comfortable living space. To achieve such results Esp32 and Arduino were used as controllers. The project's ultimate output was created by the integration of hardware. our goal is to design a system that offer greater flexibility and compatibility with existing infrastructure and devices. They can work with a combination of wired and wireless technologies, allowing users to incorporate a wider range of devices into their smart home setup. This flexibility enables users to leverage their current devices and gradually upgrade or expand their smart home capabilities. 14 4.2 Hardware Components This section discusses the design and tools used in the development of the hybrid smart home in order to illustrate the full development process. 4.2.1 wireless parts Item Name Item Image Quantity ESP32 4 Wireless Fig. The ESP32 is a powerful microcontroller module, in our project we used a multi-to-one setup with ESP32 with ESP-NOW communication protocol, it typically involves establishing a communication network where multiple ESP32 modules send data to a centralized ESP32 module. Multiple ESP32 Modules: Each individual ESP32 module is programmed to perform specific tasks in our smart home system. For example, one ESP32 module control the lighting and movement system, another handle temperature and humidity, and the last one control the flame and gaz. Centralized ESP32 Module: One ESP32 module is designated as the central or main module that acts as a hub or gateway for receiving data from all the other ESP32 modules distributed across the smart home. It aggregates the data and sends it to Arduino via serial3. Establish communication between the senders and receiver by registering them using their unique MAC addresses.  The 4 modules connected to 5V, 2.5A and ground united with the Arduino. 15 Sender1: Sender2: Sender3: Receiver: wired Circuits  We connected the Dht11 sensor to the esp1 wired.  We connected the LDR sensor module and PIR sensor to the esp2 wired.  We connected the flam sensor module and mq05 sensor to the esp3 wired.  3 senders communicate wireless with the receiver.  The receiver wired with Arduino on pins 14,15[serial3]. 4.2.2 Arduino In our project, we chose to deal with Arduino Mega for several reasons, The computing abilities and advanced features offered by the Arduino Mega make it a highly favored option within the expansive range of available Arduino development boards. We have identified certain factors that make the Arduino Mega a standout device for use: 1. Experience exceptional flexibility in handling an extensive range of sensors, actuators and external devices via the remarkable capabilities provided by the Arduino Maga’s superior number of digital and analog input/ output pins. Enterprisingly featuring fifty- four digital I/O Pins (the pins from 2-13 are PWM (256 -> 8 bit)) 16 and sixteen fixed-analog input Pins, this highly effective device proves distinguished in implementation within our practical application scenario. 2. Our impressive mega panel offers an array of innovative communication interfaces, moreover it entails several UART device ports devised as serial peripherals facilitating seamless information exchange between diverse gadgets. To exemplify this point in practice: we employed the first available serial port to interact specifically with GSM technology while reserving another one (serial port no 2) for compatibility with Bluetooth; port #3-to interface with ESP-32 (receiver) 4.2.2.1 wired parts Item Name Item Image Quantity Arduino Mega 2560 1 Servo motor 2 DC pump 6v 1 Reed switch 3 Rfid 522 1 17 Variable resistor 2 Buzzer 1 LCD 16*2 1 H-bridge 1 HC-05 Bluetooth module 1 Soil humidity sensor 1 Rain sensor 1 LDR sensor 1 18 PIR sensor 1 Flam sensor 1 MQ05 sensor 1 DHT11 sensor 1 Keypad 8*8 1 GSM SIM800L 1 DC motor 1 led 5 fan 1 19  access control system [RFID-RC522] The MFR 522 chip-based RFID-RC522 is a well-liked module for RFID reading. Through radio frequency identification, we employed it effectively as an access control mechanism on our gate. The proper functioning of the module relies on having an appropriate power supply with a recommended value of typically 3.3V(we provided it directly by the Arduino). An integrated antenna that transmits and receives radio waves is part of the module. This antenna is in charge of interacting with RFID tags. We have two tags one is authorized and the other is unauthorized. If it is authorized to open the gate, otherwise it will be printed on the screen that it is unauthorized and the gate remains closed.  Home security[keypad] It has 16 buttons connected, with Arduino pins[A0-A7], The house is secured by placing a secret password using the keyboard after the word is placed, the lighting in the house and the cooling and heating system are turned off, and if there is a case of theft, fire or gas, the warning device is turned on and an appropriate message is sent to the owner of the house according to the situation and it is printed on the home screen.  Bluetooth Hc05 Bluetooth is connected to the Arduino on serial port No. 2. it connects Tx with Rx and Rx with TX. Through Bluetooth, a ready- made Android application from the store was used to control the lighting, cooling and heating system, the umbrella to protect against Rain, open and close the gate and irrigation system. 20 App.Fig.  Rain sensor & Soil humidity sensor Rain sensor is a raindrop detection sensor that operates based on conductivity principle. When it senses the presence of rain, it closes the umbrella connected to the servo motor, which determines the angle at which the umbrella moves through the PWM coming from the Arduino, and the servo motor was supplied with power by H- bridge because it needs high power. The angle of its movement [ 10(open) to 90 (closed)]. Soil humidity sensor is a device used to measure the moisture content in soil. It works based on the principle of electrical conductivity. The conductivity between the probes is impacted by the soil's moisture content. Dry soil has a higher resistance while moist soil is more conductive. based on this, the pump is working or not, and it is connected to the h-bridge, where it supplies it with energy and determines the direction of its movement. 21  Cooling and heating system In Normal mode that is, if you are inside the house, the screen will display the temperature and humidity of the house and the required temperature, which is set through a variable resistance, if the required temperature is lower than the temperature of the house, the fan is turned on, and if the temperature is higher, the heating is turned on.  Reed switch An electrical switch relies on the magnetic field to function. We used it to see if someone was trying to get into the house, where it was placed on the doors and windows, these switches were connected in series to provide the use of Arduino pins, if there is an attempt to enter (at least one window or door is opened), the alarm is triggered and a message is sent and printed on the home screen. the bin number 7 from Arduino decide what happens, If the value of it is 1 that means there are closed, if 0 that means there is a window or door was opened.  H-bridge An H-bridge is a type of electrical circuit layout that is frequently used to control a motor's direction and speed. By managing the current flowing through the motor's windings, the H-bridge enables the motor to revolve both forward and backward. We used it to power the servo motors and to determine the direction and speed of both the fan (dc motor) and the pump, it is powered by an external 12V, 3A dc power supply. 22  Servo motor an electromechanical device. The angular location, velocity, and acceleration may all be controlled precisely with this device. Applications where accuracy, stability, and repeatability are crucial frequently use servo motors. We used two of them, one to move the gate and the other for the umbrella, they were supplied with 5V from the h-bridge as mentioned earlier and to determine the angle through the Arduino PWM on the pins 5 and 6. It moves at a very accurate angle from 0 to 180 depending on the pulse width adjustment. At the door it moves at an angle of 23 (closing) to 75 (opening). In the parachute it moves at an angle of 10 (open) to 90 (closed). We have an open-source library to define the angle.  GSM SIM800L wireless communication module utilized in a variety of applications. It enables devices to connect to the GSM (Global System for Mobile Communications) network and communicate via phone calls, SMS, and GPRS data transmission. the module makes it possible to send and receive SMS messages. We supplied it with 5V power and communication interface (serial 1) to communicate with microcontroller.  Buzzer It is turned on when the house is secured and one of the following events occurs: a theft [window or door opened], gas and fire.  LDR sensor module It senses that there is darkness in the place, so it turns on the lights in the house, it connected with the ESP wired. 23  PIR sensor He senses that there is movement in the place.it connected with the ESP wired.  flam sensor It senses the presence of a flame in the place.  MQ05 sensor It senses the presence of a gas (Co2) in the place.  DC motor When I inverse the positive and negative it reverses the direction of rotation. It used in the project as a fan. It operates to cool when the temperature is higher than the required temperature. 5. Discussions and Results  The biggest obstacle for us was to supply the pieces with energy, but we overcame it through experience, for example, Arduino, we were able to find out the necessary power through the intensity of the lcd lighting.  Several sources can be used to power the Arduino Mega. With a regulated 5V power supply, the Arduino Mega's 5V pin can be utilized to power the board, we have employed this technique.  All the pieces connected with the Arduino operate on 5V, except for RFID, where you need 3.3V, and H-BRIDGE were supplied with power from an external power supply 12V and 3A, as for the four pieces of the ESP they are supplied with power through an external power supply 5V and 2.5A. Figur e 1 : A988 Driver Circui t 24 The end result is a fantastic project that succeeds in all the objectives we set out to accomplish and performs effectively in the majority of the scenarios we tested. 6. Conclusion 6.1 Summery We have completed the construction of a working hybrid smart home that can easily respond to variables in a short time, may require some improvements, which we could not implement due to lack of time, resources or even knowledge. 6.2 Things we learned • How to use ESP-NOW communication protocol (many-to-one configuration). • Understanding how to use servo motor • How to use RFID. • How to use GSM send messages. 6.3 Learning Curve The learning process was made easier by a great set of manuals, a wealth of online lessons, and helpful community members despite feeling initially like a difficult obstacle. Such a project required us to learn about new hardware elements that we were not familiar with 6.4 Future Work Future work will involve the use of image processing in order to find out the person coming to the house and, accordingly, perform certain tasks. 25 7. References [1] https://smarthomefly.com/smart-home-wired-or-wireless/ [2] https://ec.europa.eu/programmes/erasmus-plus/project-result- content/4df4e928-8958-4552-80da- 146977e666b9/Smart_Home_systems_FINAL.pdf [3] https://randomnerdtutorials.com/esp32-esp-now-wi-fi-web-server/ https://smarthomefly.com/smart-home-wired-or-wireless/ https://ec.europa.eu/programmes/erasmus-plus/project-result-content/4df4e928-8958-4552-80da-146977e666b9/Smart_Home_systems_FINAL.pdf https://ec.europa.eu/programmes/erasmus-plus/project-result-content/4df4e928-8958-4552-80da-146977e666b9/Smart_Home_systems_FINAL.pdf https://ec.europa.eu/programmes/erasmus-plus/project-result-content/4df4e928-8958-4552-80da-146977e666b9/Smart_Home_systems_FINAL.pdf https://randomnerdtutorials.com/esp32-esp-now-wi-fi-web-server/ Acknowledgment Disclaimer Table of Figure Abstract 1 Introduction 1.1 The problem: 1.2 Significance: 1.3 Objectives and Scope Report Organization 2. Constraints and Earlier Coursework 2.1 Constraints 2.1.1 Inexperience 2.1.2 Lack of funds 2.1.3 Lack of Time 2.2 Earlier coursework 2.2.1 Microcontrollers and PIC 2.2.2 Micro-Processor: 2.2.3 CPU Lap: 2.2.4 Micro controllers Lab: 2.2.5 Wireless & Communication Lab: 2.2.6 Critical Thinking and Research Skills 3. Literature Review  About ESP32: ESP-NOW and how they work we read this site.[3] that helped us understand what ESP-NOW is and how it can be used. 4. Methodology 4.1 Overview of The System 4.2 Hardware Components This section discusses the design and tools used in the development of the hybrid smart home in order to illustrate the full development process. 4.2.1 wireless parts 4.2.2 Arduino 4.2.2.1 wired parts  access control system [RFID-RC522] 5. Discussions and Results 6.1 Summery • How to use ESP-NOW communication protocol (many-to-one configuration). • Understanding how to use servo motor