FACULTY OF INTERNATIONAL EDUCATIONGRADUATION PROJECT BÙI TUẤN ĐẠT Student ID: 19119039 TRẦN PHAN BẢO KHANG Student ID: 19119059 Major: COMPUTER ENGINEERING TECHNOLOGY Advisor: TRƯƠNG QU
INTRODUCTION
Overview
In the era of information technology explosion, mass media is increasingly developing, with the most powerful development being the Internet With its outstanding advantages, the Internet has played a crucial role in societal life, influencing every aspect and field Almost every industry utilizes the Internet, and in computer engineering, the concept of the "Internet of Things" (IoT) stands out
Simply put, IoT is the idea that everything can be connected through the Internet
We can control our belongings remotely using a smart device such as a smartphone, tablet, PC, or even a small smartwatch on our wrist To gain a deeper understanding and practical application of IoT in our lives, it is essential to conduct further research
Parallel to the development of society and technological progress, devices like smart refrigerators, smartphones, and similar gadgets are gradually becoming a part of our daily lives Smart homes represent a future development trend, designed to help users save time in management and control, creating the best environment for them
Pursuing research in processors and components not only solidifies foundational understanding in computer engineering but also unveils avenues to refine practical application skills This enables the effective translation of theoretical knowledge into tangible solutions, equipping individuals with a comprehensive grasp of the field.
Therefore, I have chosen the topic of "Design and Implementation for a Smart Home" for my thesis to overcome the limitations of previous topics such as system latency and data accuracy and develop many other functions of the smart home system, such as warnings via phone messages when the door is opened incorrectly, and a warning will be issued.
Objectives
With a modern and convenient approach, our smart home project features a mobile application and website that offer effortless remote control over home devices This user-centric offering aims to enhance safety and ease of living, creating a seamless and truly smart home experience.
For convenience, users can easily interact with the system through the mobile app or website, managing devices like lights and air conditioning flexibly
In terms of safety, we integrate a gas and flame sensor system to warn users of potential fire hazards In case of emergencies, the system will automatically trigger alarms and send emergency notifications to users and rescue units
Regarding security, we utilize an identification card sensor system for secure locking If any suspicious activity is detected, the system will warn users and send timely SMS notifications to keep them informed
Additionally, we integrate a linking feature with fire safety systems by monitoring and detecting fire hazards promptly suitable.
Limitation
Our system model is designed with a small size, focusing on using tech modules to ensure responsiveness to system requirements However, during construction, we faced some important limitations
The small size reduces device diversity in the design, which might impact disparities compared to implementing the system on an actual scale
We use a SIM module to send warning messages, and the reliance on the physical SIM signal connectivity in this module may limit the system's quick responsiveness, especially in environments with unstable network signals
Sensor modules like temperature-humidity, gas, and RFID are integrated to provide environmental info and access control Nevertheless, limitations in accuracy and range of these sensors may affect responsiveness in real-world environments
These limitations have been carefully considered to ensure the project still meets user needs and expectations effectively and can adapt to diverse and dynamic environments.
Research Method
To solve the problem, we use the following research method:
- Survey existing systems and topics
- Analyze and synthesize relevant theories such as programming languages C, Java, HTML, CSS,
- Seek opinions and suggestions from the advisor, colleagues, and those who have worked on related topics
- Evaluate and analyze system functions before hardware selection
Study object
To achieve our project goals, our team delved into extensive research on web programming languages, such as HTML, CSS, and JavaScript, to understand their operational principles as well as design mobile phone app Concurrently, we thoroughly grasped the intricacies of the ESP32 kit's structure and functionality
In addition to this, we referred to documentation outlining the operational principles our project, seamlessly combining web programming, APP, and hardware integration with the ESP32 KIT.
Scope of object
After discussions and extensive research, our team has successfully established communication and control for the devices used in the project, enabling data transmission between the web using HTML, CSS, and Java, the app using Android Studio to design, and the ESP32 hardware.
Research content
During the implementation of the graduation project with the topic "Design and Implementation of Smart Homes," we worked on these descriptions and implemented their contents:
Content 1 Analyze the challenges of the project
Content 2 Choose and design block diagrams to select devices
Content 3 Learn about the technical specifications, guiding thoughts, and theoretical basis of the hardware components, such as the ESP32 microcontroller and sensor
Content 4 Discover the communication protocols used by ESP32 modules when interacting with sensors, mobile applications, and websites
Content 5 Design system on proteus
Content 6 Code for ESP32 in 3 rooms
Content 7 Design of an App Using Android Studio
Content 8 Design of the website
Content 9 Implement the PCB printed circuit board and all modules
Content 10 Test, run, check, evaluate, and adjust the system
Outline
This report will be organized into the following 5 chapters below:
Chapter 1 Introduction: This chapter gives a brief introduction to system research
Chapter 2 Background: This chapter introduces the theoretical basics of the components and techniques used to build the system in the project Chapter 3 Design and Implementation: This section is about the block diagram of the system, system requirements, and design of hardware and software
Chapter 4 Results: Presenting the results of hardware and evaluating their operation and system image after construction
Chapter 5 Conclusions and Future Work: Presenting conclusions for the final project, and suggestions that can be improved in the future.
BACKGROUND
IoT Model Application in Smart Home
A smart home refers to a dwelling that incorporates intelligent technologies to improve convenience, comfort, safety, and energy efficiency within the living space Utilizing Internet of Things (IoT) technology, smart homes connect devices through the Internet, allowing for remote control, automation of household tasks, and monitoring of activities within the residence It can be asserted that IoT has played a crucial role in advancing and enhancing the evolution of modern smart homes, as described in Figure 2.1
Figure 2.1 IoT model applied in Smart Home
The incorporation of IoT into smart homes has improved the entire household system, automating management tasks and device control with advantages such as:
- Remote Management: Most devices within an IoT-enabled smart home can be managed through smart devices
- Automation: Systems can be programmed to execute specific functions automatically based on preset configurations or schedules
- Energy Efficiency: Energy conservation is achieved by powering off devices according to user requirements
- Security: monitoring the home remotely and receiving notifications in the event of anomalies
- Health Monitoring: Keeping track of air quality and humidity or issuing warnings for smoke or hazardous chemicals
- Virtual Assistants: Many IoT smart home systems integrate virtual assistants like Google Assistant, Amazon Alexa, or Siri, providing voice-controlled functionalities.
Communication standards in IoT
MQTT, which stands for Message Queuing Telemetry Transport, is a publish/subscribe protocol intended for Internet of Things devices It is known for its low bandwidth utilization, high reliability, and adaptability to unstable network conditions
The overarching structure of MQTT comprises two primary components: the broker and the clients
- The broker functions as the central hub, serving as the connecting point for all client connections Its primary task involves receiving messages from publishers, organizing them in a queue, and directing them to a specific address The secondary roles of the broker may encompass additional communication-related functionalities such as ensuring message security, managing message storage, and maintaining logs
- Clients are categorized into two groups: publishers and subscribers Operating as software components on edge devices, clients are designed to be flexible and lightweight They undertake at least one of the following tasks: publishing messages to a designated topic or subscribing to a specific topic to receive messages from it
In a system using the MQTT protocol, multiple station nodes (referred to as MQTT clients, abbreviated as clients) connect to an MQTT server (referred to as a broker) Each client will subscribe to several channels (topics), such as "/client1/channel1" and
There are three Quality of Service (QoS) options when "publishing" and
- QoS0: The broker/client sends data exactly once, and the sending process is confirmed only by the TCP/IP protocol, like a one-time market transaction
- QoS1: The broker/client sends data with at least one acknowledgment from the other end, meaning there may be more than one acknowledgment of receiving the data
- QoS2: The broker/client ensures that when sending data, the receiving end only receives it once, and this process must go through a 4-step handshake
The Wi-Fi standard in [2], based on IEEE 802.11 and developed by IEEE in 1997 with a maximum speed of 2 Mbps, has rapidly progressed into newer standards for contemporary IoT applications:
- 802.11n or Wi-Fi 4: Utilizing both the 5 GHz and 2.4 GHz frequencies, it delivers a maximum speed of 600 Mbps
- 802.11ac or Wi-Fi 5: Operating on the 5 GHz frequency, it provides a maximum speed exceeding 1 Gbps
- 802.11ax or Wi-Fi 6: Using both the 5 GHz and 2.4 GHz frequencies, it offers speeds of up to 10 Gbps
Wi-Fi incorporates several crucial features:
- Transmission Speed: Data can be transmitted at high speeds
- Range: Wi-Fi operates within a range of 20–100 m, depending on the environment and devices, making it suitable for numerous current IoT applications
- Security: It provides various security options like WEP, WPA, etc
- Compatibility and Multi Device Support: Wi-Fi widely supports most smart devices, including Micro Controller Units (MCUs), allowing multiple devices to connect simultaneously to a network
Bluetooth, introduced by Ericsson in 1994 as a short-range communication protocol, has become a pivotal element in the IoT industry [3]
Bluetooth boasts several improvements that offer advantages for IoT applications:
- Reduced Energy Consumption: Bluetooth Low Energy (BLE) now utilizes less energy compared to its predecessors, making it a viable solution for energy- constrained systems
- Limited Range: Bluetooth typically operates within a relatively short range, often less than 100m
- Enhanced Speed: BLE currently provides ample speed for transmitting data from various sensors commonly used in IoT
- Moreover, Bluetooth enjoys widespread support across a variety of smart devices
Ethernet plays a significant role as a communication protocol on the Internet of Things (IoT), despite the common use of wireless networks like Wi-Fi or Bluetooth in IoT applications [4]
- Reliable and swift connectivity: Ethernet is a beneficial choice for systems that demand low latency and high reliability
- Network Security Measures: Ethernet incorporates multiple security mechanisms, such as virtual LANs (VLANs) and access control lists (ACLs), to ensure network security
- Compatibility with the TCP/IP Protocol: Ethernet is compatible with the TCP/IP transmission protocol
- Expansion of Network Infrastructure: It allows for the extension of a robust and extensive network infrastructure using switches and hubs to interconnect numerous devices
RS-485 is extensively utilized in industrial IoT and demanding environments where there is a need for high-speed transmission, long-distance connectivity, and resilience against noise interference [5]
Key attributes of the RS-485 standard include:
- Data Transmission Speed: reaching speeds of up to 10 Mbps, enabling rapid data transfer among IoT devices, which is especially beneficial in systems dealing with substantial data loads
- Communication Range: Ranging from a few hundred meters to 1 km
- Noise Resistance: Specifically designed to withstand electromagnetic and similar noise, it enhances its robustness in challenging conditions
- Reliability: It possesses the ability to detect errors, recover data, and minimize data loss, ensuring a dependable data transmission process.
Data Transmission Protocols
I2C (Inter-Integrated Circuit) is a peripheral communication standard that enables electronic devices to communicate with each other It was developed by Philips Semiconductor (now NXP Semiconductors) and was first introduced in I2C or Inter- Integrated Circuit, a standardized communication protocol that facilitates communication among electronic devices Originally developed by Philips Semiconductor (now NXP Semiconductors) and introduced in 1982, I2C has become widely adopted for linking various components like sensors, memory modules, microcontrollers, and other control circuits on an electronic board
In the I2C architecture, there is a master device, responsible for control, and one or more slave devices, which are under the master's command The master manages the data transmission process, while the slaves send and receive data based on the master's instructions I2C employs two communication lines: SCL (Serial Clock Line) for synchronization and SDA (Serial Data Line) for actual data transmission as shown in Figure 2.3
I2C operates as a synchronous communication protocol, meaning that all devices involved synchronize their data transmission based on a shared clock signal generated by the master [6]
Figure 2.3 I2C Master-Slave communication diagram
I2C communication is organized into messages, and each message consists of multiple data frames Each data frame includes a start condition, a stop condition, read/write bits, and acknowledgment (ACK)/non-acknowledgment (NACK) bits, as illustrated in Figure 2.4
Figure 2.4 Frame transfer in I2C protocol
To transmit data, the master device (the controlling device) initializes the I2C bus by setting the SCL and SDA lines to a high logic level Subsequently, the master device sends a START signal by lowering the logic level of the SDA line from "1" to "0" while the SCL line is at "1" After the START signal, the master confirms the address of the slave it wishes to exchange data with The slave address, consisting of 7 bits, is transmitted over the SDA line from the most significant bit to the least significant bit The final bit determines whether it is in a transmission (write) or reception (read) state Once the slave device is selected, data exchange can begin [6]
Data is transmitted over the SDA line from the least significant bit to the most significant bit or received from the most significant bit to the least significant bit Both the master and slave devices adhere to the signals on the SCL line to synchronize data transmission and reception After each byte of data is transmitted or received, the receiving side sends an acknowledgment (ACK) or non-acknowledgment (NACK) signal over the SDA line ACK is a low logic level on the SDA line, confirming the successful transmission NACK is a high logic level on the SDA line, indicating that the receiving device cannot accept and process the data After completing the data transmission or reception, the master sends a STOP signal by raising the logic level of the SDA line from
"0" to "1" while the SCL line is at "1" This signals the end of the transmission process [6]
Universal Asynchronous Receiver-Transmitter (UART) is a widely used serial data communication protocol It is employed for communication between devices such as microcontrollers, processors, communication modules, peripherals, computers, and various other devices The operational principle of UART is based on asynchronous communication, meaning there is no shared clock signal between the transmitting and receiving devices UART consists of two communication lines: the TX (transmit) line and the RX (receive) line for transmitting and receiving data, as illustrated in Figure 2.5 [7]
Figure 2.5 UART communication connection diagram Here is some basic theory about the UART protocol:
- Baud Rate: It is the data transmission speed, measured by the number of state transitions on the communication line in one second Common baud rates include
- Frame: A frame is a block of data transmitted via UART It includes elements such as the start bit, data bits, parity bit, and stop bit, as illustrated in Figure 2.6
- Start Bit: It is the initial bit of a data frame Typically, it is a low logic (0) bit
- Data Bits: These are the data bits Usually, UART supports 5, 6, 7, or 8 data bits The size of the data is determined by the number of data bits
- Parity Bit: The parity bit is an additional bit added to the data frame to check for transmission errors There are three types of parity bits: none (no parity bit), odd parity, and even parity
- Stop Bit: The stop bit marks the completion of transmitting a data frame It usually has a high logic value of "1", and the timing of the stop bit allows UART devices to prepare for the next frame
Figure 2.6 UART data transmission frame
To transmit a UART frame, first, to signal the receiving end that data is about to be sent, the UART line, which is in a high logic state (1), pulls the Start bit down to logic low (0), marking the beginning of a transmission frame and synchronizing the receiving device After the start bit, the data bits are transmitted sequentially from the least significant bit to the most significant bit If configured, after the data bits have been transmitted, a bit for error checking may appear Finally, one or more stop bits will be sent; these are bits with a high logic value of 1, marking the end of the frame and preparing for the next data frame [7]
The Serial Peripheral Interface (SPI) is a synchronous serial standard designed for full-duplex data transmission, enabling both transmission and reception processes to occur simultaneously It operates as a master-slave protocol, offering a straightforward and cost-effective interface between a controlling device (the master) and its peripheral devices (the slaves)
Figure 2.7 SPI communication SPI communication shown in Figure 2.7:
- MOSI (Master Out, Slave In): the line for the master to send data to the slave
- MISO (Master In Slave Out) - the line for the slave to send data to the master
- SCLK (Serial Clock): the line for the clock signal
- SS/CS (Slave Select/Chip Select): the line for the master to choose which slave to send signals to
SPI can be set up to function with either a solitary master and a lone slave or with multiple slaves under the control of a single master When connecting multiple slaves to a master, there are two approaches In the first scenario, if the master incorporates multiple slaves select pins, the slaves can be interconnected in parallel, as shown in Figure 2.8
Figure 2.8 SPI communication in case of multiple Slave pins
If there is only one slave select pin, the slaves can be connected as shown in Figure 2.9
Figure 2.9 SPI communication in case there is 1 Slave pin SPI Data Transmission Steps:
1 The master generates the clock signal (SCLK)
2 The master sets the SS/CS pin to a low-voltage state, activating the slave
3 The master sends data, one bit at a time, to the slave along the MOSI line The slave interprets and processes the received bits in real-time as it receives them
4 If feedback is required, the slave returns data, one bit at a time, to the master along the MISO line The master reads and interprets the bits in real time as it receives them.
Hardware
The ESP32, developed by Espressif Systems, is an affordable System-on-Chip (SoC) that succeeds the ESP8266 SoC Featuring the Xtensa LX6 processor from Tensilica, it offers single-core and dual-core variants with integrated Wi-Fi and Bluetooth capabilities.
The ESP32 NodeMCU LuaNode32 38-pin Wi-Fi BLE development kit is a versatile platform for wireless communication, integrating Wi-Fi and Bluetooth capabilities based on the ESP32 System-on-Chip (SoC) and the robust CP2102 communication chip It is designed for applications requiring connectivity, data acquisition, and remote control via Wi-Fi and Bluetooth, particularly in Internet of Things (IoT) applications The kit features the latest ESP32-WROOM-32 module with a dual-core processor
Figure 2.11 ESP-WROOM-32 pinout Technical specifications:
- Type: Wi-Fi + Bluetooth Module
- Power Supply Voltage (USB): 5V DC
- Power Consumption: 5μA in sleep mode
- Wi-Fi: 802.11 B/g/n/E/I (802.11N @ 2.4 GHz up to 150 Mbit/s)
- Bluetooth: 4.2 BR/EDR BLE with 2 control modes
- Memory: 448 Kbyte ROM, 520 Kbyte SRAM, 6 Kbyte SRAM on RTC, and QSPI Flash/SRAM chip support
- Digital GPIO: 24 pins (some pins serve only as inputs)
- Analog Digital: 12-bit SAR ADC, supports measurements on up to 18 channels; some pins support an amplifier with programmable gain
- Security: IEEE 802.11, including WFA, WPA/WPA2, and WAPI
- Hardware Acceleration for Cryptography: AES, SHA-2, RSA, Elliptic Curve Cryptography (ECC), Random Number Generator (RNG)
2.4.2 LM2596 DC Voltage Regulator Step-Down Buck Converter Module
The LM2596 DC voltage regulator module as shown in Figure 2.12 is a circuit capable of reducing voltage from 35V to 1.5V while maintaining a high efficiency (92%)
It is suitable for applications involving power distribution and voltage reduction for devices such as motors and cameras
Figure 2.13 Schematic Diagram of the LM2596 DC Voltage Regulator Module Specifications [8]:
- Output Voltage: Adjustable in the range of 1.5 VDC ~ 35 VDC
The SIM800L module is used for remotely controlling devices or sending warnings through the mobile network, enabling functionalities such as making calls, sending text messages, and utilizing GPRS It easily interfaces with various microcontrollers, such as Pic, 8051, AVR, and Arduino
The SIM800L module has widespread applications not only in real-world scenarios but also in smart rooms, smart homes, and IoT (Internet of Things) projects It allows for
Controlling the module is facilitated through a set of AT commands, making it easy to interface with different microcontrollers The SIM800L module is extensively used in projects beyond practical applications, including smart homes and IoT projects
The AT command set enables effortless control over the module, minimizing power consumption This advantageous feature aligns with projects reliant on battery or accumulator power sources As a result, the module is ideally suited for initiatives that necessitate the use of batteries or accumulators, providing flexibility and energy efficiency.
Figure 2.14 Pin Functions of the SIM800L Module Shown in Figure 2.14:
- NET: pin for connecting to an external antenna
- VCC: power supply pin for the SIM800L module with a voltage range from 3.7V to 4.2V
- SIM Slot: Micro SIM card slot
- RST (Reset): Pin used for resetting the module Connecting the reset pin to low for 100ms will reset the entire module
- RxD (receiver): pin used for UART connection
- TxD (transmitter): pin used for UART connection
- GND: The ground connection needs to be connected to the common ground with Arduino
- Ring Pin: Functions like a telephone bell It is often used for external interruptions in Arduino Its default state is high and is pulled down to low for 120ms when a call is received Additionally, it can be configured to generate a pulse when receiving an SMS
- DTR Pin: Activates/deactivates sleep mode Setting this pin to HIGH puts the module to sleep, disabling UART communication Pulling the pin down to LOW will wake up the module
- MIC±: Two connections for a microphone
- SPK±: Two connections for a speaker
- Power supply: 3.7 VDC ~ 4.2 VDC; it is recommended to use a power source with a current of at least 1.0 A for stable operation
- Active current consumption: from 100 mA to 1 A
- Supports four common frequency bands
Some functions of the SIM800L Module:
- Make phone calls and receive incoming calls
- Send, receive, read, or delete text messages
- GPRS (General Packet Radio Service)
Survey of AT instruction set of SIM Module 800L
The AT command set, commonly known as the Attention command, is a standardized set of commands supported by most mobile devices, such as mobile phones and GSM modems, that have capabilities for sending and receiving Short Message Service (SMS) messages and controlling calls
AT commands are primarily used for configuring modems and establishing network connections However, AT commands also support accessing information and system status, which is crucial for troubleshooting and debugging applications
Table 2-1 General command of Sim800l module
AT Check the response of Module Sim; if it returns OK, then the Module is working
ATEx Echo mode is the mode to respond to incoming data from the SIM module x = 1 enables echo mode; x = 0 disables echo mode
AT+IPR=[baud rate] When setting data communication speed with the Sim Module, only the following speeds can be set baud rate
Table 2-2 Call command of Sim800l module
ATD[Phone_number] The command to make a call has been set
ATH Command to end the call or hang up when a call comes in Table 2-3 Message command of Sim800l module
AT+CMGF=1 The command to set SMS mode to text is necessary for sending and receiving text messages
AT+CMGS=”Phone_number” Send a message to the phone number
AT+CMGR=x Read messages at save location x
AT+CMGD=x Delete messages saved at location x
AT+CNMI=2.2 Display message content as soon as a message arrives
Figure 2.15 RC522 NFC 13.56 MHz RFID Description:
The RFID RC522 module, depicted in Figure 2.15, utilizes the MFRC522 integrated circuit from Philips Designed for reading and writing data to NFC cards operating at 13.56 MHz, this module stands out as a cost-effective and compact solution for RFID card applications.
- Operating Distance: 0 to 60mm (Mifare1 card)
- Data Transfer Speed: Up to 10 MB/s
- Supported RFID Card Types: Mifare 1 S50, Mifare 1 S70, Mifare UltraLight, Mifare Pro, and Mifare Desfire
Used in robot designs, model airplanes
The SG90 Servo Motor as shown in 2.16 (available in two types: 360° rotation and 180° rotation) is a common servo used in small and simple control models, such as robot arms The motor has a fast response speed and comes with an integrated motor control
Figure 2.17 Infrared Obstacle Sensor Technical specifications [12]:
- Convenient 3mm screw holes for easy mounting
Figure 2.18 Green 16×2 LCD screen Description:
The green LCD1602 as shown in Figure 2.18 text display screen utilizes the HD44780 driver, capable of displaying 2 lines with 16 characters on each line Known for its high durability, widespread use, abundance of sample codes, and user-friendly interface, it is suitable for beginners and project enthusiasts [13]
- Black characters on a green background
- Convenient 0.1-inch spacing between connecting pins for easy breadboard connection
- Pin names are labeled on the back of the LCD screen, aiding in connection and wiring
- The backlight's LED brightness can be adjusted using a potentiometer or PWM for power efficiency
- Can be controlled with six signal wires
- The built-in character set supports English and Japanese Refer to the HD44780 data sheet for more details
2.4.8 LCD to I2C communication conversion circuit
Figure 2.19 I2C Interface Conversion Circuit for LCD Description:
To use LCDs with the HD44780 driver (such as LCD 1602, LCD 2004, etc.), at least 6 MCU pins need to be connected to the RS, EN, D7, D6, D5, and D4 pins for communication with the LCD However, with the I2C LCD interface module in Figure 2.19, only 2 MCU pins (SDA and SCL) need to be connected to the module's 2 pins (SDA and SCL) to display information on the LCD Additionally, contrast can be adjusted using the potentiometer mounted on the module
- Jump pin provides backlight for the LCD or disconnects it
- Adjustable potentiometer for LCD contrast
2.4.9 DHT11 temperature and humidity sensor module
Figure 2.20 DHT11 temperature and humidity sensor module
The DHT11 temperature and humidity sensor simplifies connectivity with its integrated 5.1k resistor on the output pin, providing user-friendly use compared to sensors lacking an exposed pin Utilizing a 1-wire communication interface, this module ensures accurate data through the sensor's integrated signal processing, eliminating the need for additional computations The module is specifically designed to function at a 5VDC voltage level [14]
Pinout of the DHT11 sensor as shown in Figure 2.20:
- Pin 1: VCC Provides power supply to the sensor module
- Pin 2: Data Outputs both temperature and humidity data through serial communication
- Pin 3: GND Serves as the ground connection for the sensor module
- Operating Current: 0.3mA (during measurement), 60uA (in standby mode)
Figure 2.21 Gas sensor MQ-2 Gas Sensor MQ-2 Description [16]:
The MQ-2 gas sensor as shown in Figure 2.21 utilizes an SnO2 element with lower electrical conductivity in clean air When combustible gases are present, the sensor's conductivity increases The higher the concentration of combustible substances, the higher the electrical conductivity of SnO2, which is then converted into an electrical signal
Overview of HTML, CSS, and JavaScript
HTML, short for Hypertext Markup Language, is a programming language utilized for constructing and organizing components within websites It serves the purpose of dividing text segments, headings, links, block quotes, etc., on a website HTML was created by Tim Burners-Lee, a physicist at the CERN research center in Switzerland, and has evolved into an Internet standard governed by the World Wide Web Consortium (W3C) The first version of HTML, consisting of 18 tags, emerged in 1991, and HTML 4.01 was published in 1999, later replaced by XHTML in 2000 In 2014, HTML underwent an upgrade to HTML5, introducing additional tags for content categorization
HTML documents have file extensions HTML, or.htm, can be viewed using modern web browsers such as Google Chrome, Firefox, Safari, etc These documents are read by browsers, transforming them into visual content on the internet for user comprehension A website typically comprises multiple HTML documents (e.g., homepage, blog page, contact page), each with its own HTML file Each HTML document involves a set of tags or elements, creating a structure resembling a directory tree with headings, sections, paragraphs, and other content blocks Most HTML elements follow an opening and closing tag structure like
2.5.2 CSS can be HTML tag names, IDs, classes, or various types CSS then applies the necessary property changes to those selected areas
HTML and CSS are closely related, where HTML serves as the markup language (website framework) and CSS defines the style (creates the website interface) The two are inseparable
JavaScript, first known as Mocha and developed by Brendan Eich, is a widely used programming language that powers interactive websites Embedded directly into HTML, JavaScript enhances web pages dynamically As a client-side language, it executes directly on the user's device, offering a responsive and interactive web experience.
MQTT Cloud
MQTT Cloud is a platform in the cloud designed for the creation and deployment of managed MQTT brokers that are hosted in the cloud
This cloud-based broker is accessible 24/7 from any location worldwide and can be easily configured using a web-based interface.
Android Studio
Android Studio is specially designed for developing Android applications It supports Windows, serves as the official integrated development environment (IDE) by Google for building native Android applications, replacing the Android Development Tools
Android Studio consists of two main components: the design interface and the code editor
DESIGN AND IMPLEMENTATION
System requirements
In the scope of this project, we aim to implement a system with multiple functions, capable of controlling various household devices and providing monitoring capabilities for temperature and humidity in different rooms of the house
The system is designed with the integration of three ESP32 microcontrollers, each MCU playing a role in managing and connecting with devices in specific rooms, including the living room, kitchen, and bedroom
By connecting various rooms, the system creates a smart and automated environment, enabling users to manage and control multiple components within the space through the host interface
It includes the automatic feature that triggers lights, fans, and alarms upon detecting a gas concentration exceeding the safety threshold, ensuring safety and preventing risks associated with gas leaks and fires
The integration of the security feature, using RFID to lock and unlock doors, enhances convenience in door access and significantly strengthens the system's safety This function efficiently authenticates users and provides flexible management with the ease of adding and removing access cards
It features instant notification of incidents through SMS warnings Users will be warned in situations such as unauthorized door access or potential fire hazards in their daily activities.
Block diagram
From the system requirements, we constructed a generalized block diagram of the system functions as shown in Figure 3.1
Figure 3.1 Block diagram for the smart home system design
The system shown in Figure 3.1 is built with:
- Three independent nodes capable of processing data and signals received, connected to the Internet through Wi-Fi communication protocol This block can control the operation of several devices based on the values of variables received from the web or mobile app blocks through the Host At the same time, it sends the measured sensor values to the host for easy observation and manipulation through user interface blocks
- The power supply block is used to provide power to all devices in the system This block is crucial because without it, all devices in the system will not be supplied with voltage or current, and these devices cannot operate
- The host block acts as an intermediary for connecting and interacting with other IoT devices in the system and the user interface The host is responsible for network management, data storage, and providing control services to optimize the operation of connected IoT devices
Website and mobile app interfaces are designed to facilitate user interaction with IoT systems They offer controls for managing connected devices, including on/off toggles, parameter adjustments, and status monitoring By optimizing the user experience, these interfaces empower users to harness the capabilities of their smart home systems.
Figure 3.2 Block diagram for the living room design
In our living room design shown in Figure 3.2, each functional block is constructed with specific objectives:
The Central Processing Block acts as a central hub, gathering data from sensors and controlling other devices within the room This centralization ensures system stability and facilitates seamless communication with the IoT Host, which serves as the primary control unit.
- Power Supply Block: Responsible for providing stable power to the entire system, ensuring continuous and stable operation of all devices, and ensuring safety for the entire system
- Button Block: Provides a direct interface between users and the system, allowing them to conveniently activate functions or devices It's designed to be simple and user-friendly
- Sensor Block: Collects data about the environment, such as temperature, humidity, and light, providing continuous and accurate information about the living room environment
- Device Block: Enhances the features and flexibility of the system, activating devices or functions based on events or user requests
- Warning Block: Automatically activates notification devices when necessary, sending warning signals to ensure safety and informing users of emergency situations
- Display Block: Provides a visual interface to monitor the operational status of devices and information from sensors through an LCD screen
- Hosting IoT Block: Lastly, the IoT Host Block acts as the central control center, communicating with central processing blocks from other rooms and managing the entire IoT system It ensures comprehensive connectivity and interaction throughout the entire system
Figure 3.3 Block diagram for the bedroom design
In our bedroom design shown in Figure 3.3, each functional block is constructed with specific objectives:
- Central Processing Block: Plays a crucial role in gathering information from sensors and controlling other devices in the room This ensures stability and provides a platform for effective communication with the IoT Host, the central control unit of the system
- Power Supply Block: Responsible for providing stable power to the entire system, ensuring continuous and stable operation of all devices, and ensuring safety for the entire system
- Button Block: Provides a direct interface between users and the system through physical interactions, allowing them to conveniently activate functions or devices
- Sensor Block: Includes temperature and humidity sensors that provide continuous and accurate information about the bedroom environment
- Device Block: Activates devices or functions based on events or user requests, including operations through the website or mobile app via physical or direct interactions
- Display Block: Provides a visual interface to monitor the status from sensors, offering a real-time display of information
Figure 3.4 Block diagram for the kitchen design
In our kitchen design shown in Figure 3.4, each functional block is built with a specific goal, combining technical features to create a comprehensive user experience
The Central Processing Unit Block is the heart of the smart home system, gathering data from sensors and controlling connected devices It acts as a bridge between these devices and the IoT Host, which is the central control hub This ensures stability and facilitates effective communication within the system, enabling the integration and coordination of various smart home components.
- Power Supply Block: Responsible for providing stable energy to the entire system, ensuring that all devices operate continuously and reliably, ensuring safety throughout the system
- Button Block: Provides a direct interface between the user and the system through physical interactions, allowing users to activate functions or devices conveniently
- Sensor Block: Includes temperature and humidity sensors providing continuous and accurate information Additionally, it incorporates gas and fire sensors to monitor the safety level of the room and warning in case of potential hazards
- Device Block: Triggers devices or functions based on events or user requests, including operations through the website or mobile app, or direct physical interactions
- Display Block: Provides a visual interface to monitor connection status and notify people about the safety or potential hazards in the kitchen, such as fire or gas leakage
- Warning Block: Executes the notification function through an alarm system and sends SMS messages to a designated phone number in case of emergencies
- Hosting IoT block: Acts as the central control center, communicating with processing units from other rooms and managing the overall IoT system.
Detail hardware designs
Figure 3.5 Power supply block design
In the designed system, the power block plays a crucial role as an energy hub and voltage converter, ensuring that every component operates with the appropriate power supply
Here's a more detailed explanation of how this connection is designed:
- The 12V power input is sourced from the adapter, chosen to ensure a reliable and powerful energy source The 12V voltage is selected for its high conversion capability and efficient power transmission
- The LM2596, a voltage conversion circuit, plays a vital role in reducing the voltage from 12V to the required input voltage for ESP32 and other components in the system Input (in+ and in-): LM2596 receives 12V power from the adapter through input in+ and in- to initiate the conversion process Output (out+ and out-): After the conversion process, the output out+ is directly connected to the 5V source, an ideal decision to power the ESP32 The output out- is connected to the ground, completing the circuit
The LM2596 DC-DC buck converter and other devices such as lights and fans receive power from the same 12V adapter This setup optimizes power distribution by sharing the 12V power supply, ensuring consistent and stable energy for all connected devices.
- Using the 12V adapter as the power source instead of relying on the ESP32's internal power has several reasons:
- The 12V adapter supplies a stable and less fluctuating power source compared to the integrated power source in ESP32 This ensures that components and devices in the system operate steadily without being affected by voltage fluctuations
- The 12V adapter can deliver better energy efficiency, especially for devices like lights and fans designed to operate on a 12V power supply Therefore, using an appropriate power source optimizes the overall energy efficiency of the system
- Finally, using the 12V adapter as a power source allows for easier management and maintenance of the power supply This centralized power source can be controlled and monitored more effectively, especially when adjustments or changes to the power supply are needed
By stabilizing and flexibly managing the power supply, the system effectively handles devices and components with varying energy and voltage needs This ensures optimal performance and prevents potential instabilities or damages, contributing to the overall stability and reliability of the system.
Schematic for living room design shown in Figure 3.6
Figure 3.6 The schematic for living room design
The ESP32 MCU is serving as the central processing unit in the living room design, receiving sensor values and handling necessary operations, as outlined in Table 3-1:
Table 3-1 Connection table of esp32
G5 O Control Pin of Led Bar 12V
G16 O CS Pin SPI RFID RC522
G17 O RST Pin SPI RFID RC522
G18 O SCK Pin SPI RFID RC522
G19 I SO Pin SPI RFID RC522
G23 O SI Pin SPI RFID RC522
G21 I/O SDA Pin I2C LCD Display Module
G22 O SCL Pin I2C LCD Display Module
Serial Pins (TX, RX) O Module Sim 800L (RX, TX)
In connection system, we have linked the components using specific pins with designated functions and purposes:
- Pin G2 is utilized for connecting to the speaker, enabling the system to produce sound and necessary announcements
- G4 is employed to control a 12V fan, regulating temperature
- G5 is connected to the Samsung Led Bar, allowing control of light intensity at 12V
- G13 interfaces with the Servo SG90 for controlling and adjusting the position of the mechanical device
- G27 connects to the DHT11 one-wire sensor, gathering information about temperature and humidity
- G14 is linked to the Infrared Obstacle Sensor to detect motion or the presence of objects
- G16 (CS RFID), G17 (RST RFID), G18 (SCK RFID), G19 (SO RFID), and G23 (SI RFID) are used to connect the RFID RC522 module via SPI, facilitating
- G25, G26, and G33 are pins connecting to push buttons, enabling user interaction with the system
- RXD connects to the SIM800L module for receiving data via the mobile network
- TXD is used to transmit data from the system to the SIM800L module for sending information to other devices via the mobile network
The execution of operations, data collection, and communication with the IoT host is achieved by programming the MCU according to the flowchart shown in Figure 3.7
Figure 3.7 Flowchart for the living room MCU program The ESP32 program, using the Arduino IDE, starts by setting up the variables for
Then, it reads data from MQTT Cloud and processes data from MQTT Cloud to control devices such as lights and fans, and processes data such as fire alarms sent via SMS Next is to read the sensor and process data from the sensor such as an infrared obstacle sensor to warn of theft via SMS, at the same time warn via buzzer and display data from the temperature and humidity sensor to LCD
Next is to read data from RFID to open the door and display room status on LCD if the access card opens, then the door opens, then will check the button pressed to see if the user pressed it, if pressed once it will add RFID card, if pressed twice it will delete RFID card
Then, read push buttons and control devices based on device status and send status data device as well as humidity and temperature data to MQTT Cloud
Figure 3.8 Schematic for power supply circuit
The living room circuit design as illustrated in Figure 3.8, the power supply consists of both 5V and 12V sources, along with ground These power sources are provided from a common power block to ensure efficiency and convenience in power management The common power block is integrated into the living room circuit design
The 5V power is typically used to supply power to devices such as the ESP32 controller, sensors, and other electronic components with a 5V requirement This helps maintain the stable operation of these components
The 12V power is often utilized to supply power to devices that require a higher voltage, such as lights and fans with a 12V requirement Using a 12V power source ensures an ample supply of energy for these devices
In our living room design, a diverse array of sensors has been seamlessly integrated to provide a secure and convenient living experience The RFID sensor ensures security by controlling door locks, while temperature and humidity sensors monitor and regulate the environment Additionally, motion sensors detect unauthorized door openings, enhancing overall security
Temperature and Humidity sensor DHT11
Figure 3.9 Schematic for DHT11 connection
The design is equipped with a DHT11 sensor connected to the ESP32 as shown in Figure 3.9 to collect data on temperature and humidity from the environment The diagram below illustrates the connection between the ESP32 and the DHT11 module via a 3-pin communication interface, as described in Table 3-2
Table 3-2 Connection interface between the DHT11 sensor and ESP32
MCU ESP32 and the DHT11 module are physically connected following the structure outlined in the connection diagram in Table 3-2 The ESP32 reads the values from the DHT11, including humidity and temperature The two functions readHumidity() and readTemperature() from the DHT library are utilized to read the humidity and temperature values from the DHT11 sensor Here's a detailed explanation of these two functions: readHumidity(): The humidity value is of type float by default, and the returned value ranges from 0 (0%) to 100 (100%), representing the humidity from dry to moist readTemperature(): The temperature value is of type float by default, and the returned value is usually displayed in Celsius
Figure 3.10 Schematic for connection between Infrared Obstacle Sensor and living indicate the presence of an obstacle or detection For digital infrared obstacle sensors, a value of 0 is typically interpreted as the presence of an obstacle, while a value of 1 indicates no obstacle
RFID RC522 using SPI Interface
Figure 3.11 Schematic for connection between RFID RC522 and living room's MCU
The connection of the RFID card identification sensor with the ESP32 is shown in Figure 3.11, and the details are described in Table 3-3
Table 3-3 Connection interface between RFID RC522 module and ESP32
RFID RC522 Module Pin ESP32 Pin Connection
Detail software designs
Figure 3.28 MQTT Cloud Interface of the IoT Host
We utilize IoT hosting through MQTT Cloud with an interface shown in Figure 3.28 Choosing MQTT Cloud Hosting for an IoT system brings strategic benefits Here are several reasons:
- Efficient Management: MQTT Cloud Hosting provides a simple and effective management solution for IoT systems This helps administrators easily monitor and control devices remotely without complications
- Optimized Performance: The preferred MQTT protocol in the IoT environment optimizes connections by reducing latency and network traffic Integration with reliable cloud services ensures sufficient resources and bandwidth for the system
- High Security: MQTT Cloud Hosting supports security methods such as TLS/SSL, ensuring data protection during transmission Flexibility and scalability make it easy to adjust the system's size without compromising stability
- WebSocket and Real-Time Support: MQTT Cloud Hosting supports WebSocket
- Installing the MQTT library must align with the supported programming language Use provided source code during initialization to connect to the MQTT server and perform send/receive operations with IoT devices
- On the CloudMQTT management interface, managing connected devices and monitoring data transmission involves creating and managing topics to organize information logically
- Activate support for TLS/SSL to secure data during transmission Additionally, set up login credentials to ensure that only necessary individuals have access 3.4.2 Mobile application design
The process of designing an Android application in Android Studio involves a combination of designing the user interface and writing scripts to create an app that can interact with users
In Android Studio, use XML layout design to define the structure of the application's user interface This involves placing components such as buttons, text fields, images, and other elements in the desired positions
At the beginning of the XML code, utilize ScrollView to ensure scrolling when the content exceeds the screen size The LinearLayout contains all interface components with layout_width set to match_parent and layout_height set to wrap_content The layouts are arranged vertically, and each layout includes a TextView and a ToggleButton
The layout of each feature's interface within ScrollView is divided into two parts on the same line, comprising the feature name and its value Below is the complete design of the application after being compiled from the XML design file The complete interface of the mobile app is shown in Figure 3.29
Figure 3.29 IoT Mobile App Interface
The script defines how the application responds to user behavior This may include handling events when the user clicks a button, sending and receiving data from the server, and managing the application's state
This process utilizes the Java programming language and the Android framework to ensure that your code is efficient and maintainable Combined with interface design, it will create a complete Android application with the required interface and functionality
In the scope of this project's research, the script will handle events, interact with data, and manage the application's flow according to the flowchart in Figure 3.30
Figure 3.30 Flowchart for IoT mobile app script
This flowchart illustrates the operation of the Android application in connecting, interacting with the MQTT server, and updating the user interface based on data from the server and user interactions
The process begins by initializing the necessary variables and objects, then attempting to connect to the MQTT server using essential information such as the address, username, and password
Upon establishing a successful connection, the program continuously monitors for incoming events These events encompass both messages received from the MQTT server and user interactions with toggle buttons present on the user interface.
When there is a new message from the server, the program checks the message type and updates the temperature, humidity values, and the status of the corresponding toggle buttons These changes are immediately displayed on the user interface to provide the latest information
When the user clicks on the toggle buttons, the program updates the user interface and simultaneously sends the new value of the toggle button to the MQTT server using the corresponding topic and message This ensures that the status between the server and the Android device is always synchronized
This process occurs continuously, synchronizing the status and data between the server and the Android application, creating a real-time interactive experience and information tracking
The website is created and accessed through a URL that corresponds to the location of the HTML file in the repository https://datbt207.github.io/iotsmarthome/
The process involves combining HTML for structural construction, CSS for decoration, and JavaScript for interactions, resulting in a comprehensive web page The finalized website is designed following these steps and then published to a public repository provided by GitHub
The website is fully designed and then published to a public repository provided by GitHub The website will be created and accessed through a path similar to the location of the HTML file in the repository https://datbt207.github.io/iotsmarthome/
3.4.3.1 Implementation of website using HTML and CSS
The website interface is designed with a layout as shown in Figure 3.31
Figure 3.31 Main Interface of the IoT Website
The website is built with only a single page, and as soon as you access the provided interface immediately appears Here, you will encounter three main sections:
- The header displays the name of the website
- The section displays values collected from the rooms
- The bottom section of the website contains control buttons used to operate devices These buttons include turning on/off lights and turning on/off fans for each room They are designed as an interactive interface, allowing control and interaction with the hardware devices
Figure 3.32 Flowchart for the IoT website Java Script
Defining Connection Information: Important parameters like the broker address, clientId, username, and password are specified to establish a secure connection
Creating MQTT Client: The Paho.MQTT.Client object is utilized to create a new MQTT client for sending and receiving messages
RESULTS
Hardware implementation
In the overall checking of the total model, the hardware implementation of each room and their interconnections is presented in Figure 4.1
Figure 4.1 Result of Top-Down view of Smart Home System
The PCB circuit illustrates the results of the schematic design process in Proteus
Figure 4.2 Layout of PCB Circuit and Living Room Component Connections
The living room's interior is designed around sensors and components attached to the pins of a PCB circuit beneath the model These components and sensors are depicted in Figure 4.3.
Figure 4.3 Result of living room implementation 4.2.3 Bedroom
Similarly, to the living room, the outcome of the connection and assembly process for creating the PCB based on the bedroom diagram is presented in Figure 4.4
Figure 4.4 Layout of PCB Circuit and Bedroom Component Connections
The layout of the bedroom is constructed using sensors and devices, as depicted in Figure 4.5 This includes components connected to the PCB placed below the model
Figure 4.5 Result of bedroom implementation 4.2.4 Kitchen
The result of the PCB implementation process by converting the schematic into an electronic circuit shown in Figure 4.6 The connection and assembly procedures are conducted to create the PCB according to the designated design for the kitchen
Figure 4.6 Layout of PCB Circuit and Kitchen Component Connections
Figure 4.7 shows the results of implementing the block functions inside the kitchen, encompassing the display block, device block, and sensor block The components are connected at fixed positions and connected to the PCB circuit
Figure 4.7 Result of kitchen implementation
Software implementation
This website is designed with a single control page, creating a unified space for managing and interacting with the system When accessing the address https://datbt207.github.io/iotsmarthome/, users will see a web interface allowing interaction with the hardware
The result of the designed website will have an interface as depicted in Figure 4.8
Figure 4.8 Result of IoT Website implementation 4.2.2 Android mobile application
In testing the Android mobile app, we conducted various test cases to check the quality and ensure the best experience for users
In the initial stage, the result includes the application icon and the application name, as shown in Figure 4.9
Figure 4.9 IoT mobile app Icon
The main screen displays all functions and features with a simple layout, as shown in Figure 4.10 This is the result after opening the application and accessing its main screen.
System operation
The overall operation of the model includes connections to the host to execute the communication process and transfer values to other units
Firstly, when the successful connection process of the Website is established, the continuous signal transmission to the Host and communication between the website and the host is illustrated in Figure 4.11
Figure 4.11 Result of changing value when connect with website
Next, the continuous signal transmission to the Host successful connection and communication between the mobile application and the host is illustrated in Figure 4.12
Figure 4.12 Result of change values when connect with mobile app
In the test scenario where the "ON" button is pressed for the living room lights and fan on the mobile app, the results are displayed on the model as shown in Figure 4.13
Figure 4.13 Result of system control by IoT mobile app
Similarly, we have the result of pressing the "ON" button for the lights and fan in the bedroom and kitchen on the website, displayed in the image as shown in Figure 4.14
Figure 4.14 Result of system control by IoT Website
The comparison of values between the temperature and humidity values displayed on the LCD screens of the rooms and the values shown on the application is shown in Figure 4.15
Figure 4.15 Comparison values between mobile app and living room LCD
When the living room door is closed and the RFID card with the appropriate identification code is detected during the scanning process, the controller will activate access confirmation to the living room Simultaneously, the main door will automatically open, allowing users to perform security operations such as adding or removing members from the authorized access list The successful authentication result of the network card is shown in Figure 4.16
Figure 4.16 Result of a correctly accessed card
On the contrary, when an invalid RFID card is detected during the scanning process,
Figure 4.17 Result of an incorrect access card
In the event of three consecutive unsuccessful access card attempts in the living room, the controller will activate a warning through the alarm for 10 seconds Simultaneously, it sends an SMS message to the initially set phone number During the warning period, the LCD screen also displays a warning, as depicted in Figure 4.18
Figure 4.18 Result of an access warning
When the user successfully logs in with the RFID card, they are allowed to press the button once to enter the mode for adding a new access card This mode allows users to register additional unlocked cards beyond the main card The interface for adding a card is displayed as shown in Figure 4.19
Figure 4.19 Result of add access card mode
In the mode for adding a new access card, when the user successfully scans a new card, the result will be displayed on the LCD screen as shown in Figure 4.20
Figure 4.20 Result of adding a new member card
If the user presses the button twice consecutively after successfully accessing the delete card mode as shown in Figure 4.21, when the user successfully scans a card, that
Figure 4.21 Result of deleting access card mode
When activated by gas or fire, kitchen sensors alert the homeowner via signal, triggering the fan and alarm for immediate warning Simultaneously, the LCD screen displays clear fire or gas leakage warnings for convenient visual monitoring (Figure 4.22).
Figure 4.22 Result on Kitchen LCD when ESP32 detects a fire or gas leakage Additionally, it also sends messages to the host as shown in Figure 4.23.
Figure 4.23 Result on the host when the ESP detects a fire or gas leakage
When the controller in the living room receives a fire warning signal from the server, it will send a notification to the user as shown in Figure 4.24
Figure 4.24 Result of the fire warning message
When there is an unauthorized door opening during the access card authentication process, the alarm will activate simultaneously The controller sends an SMS warning message to the user, as described in Figure 4.25.
Summary of testing result and evaluate model
Table 4-1 Summary of testing result table
Control device by IoT Web 20 20
Control device by IoT App 20 16 Lost connect to host
Wrong access card Warning in buzzer
20 15 Not warning in 3rd wrong
Illegal access Warning in buzzer 20 20
Gas and fire Warning in buzzer 20 18
Send Warning SMS 20 16 Livingroom lost connect Wi-fi
Automatically turns on the fan when there is a fire and high gas concentration
The smart home model has successfully implemented basic functional tools The overall accuracy rate can achieve an excellent level of 75% Most errors in the test results mainly produce the detection of loss of connection to the server or interruption of Wi-Fi Additionally, some bugs were discovered because the system did not fully cover practical cases
Despite some difficulties, it is important to emphasize that most of the warning functions in the model operate reliably and accurately This is testament to the robustness of the developed warning mechanisms that advise the overall performance and security of the smart home system
In summary, despite receiving points for improvement, the model can be successfully implemented in functional settings and holds promise for further improvement and development.
CONCLUSIONS AND FUTURE WORK
Conclusion
Despite encountering challenges in researching unfamiliar topics, the project's feasibility and achievability were validated The endeavor yielded notable achievements, yet faced limitations compared to prior IoT smart home research.
The project was successful in achieving many diverse goals Instead of using a single button to control all operations, we implemented three ESP32 buttons with independent control This has improved communication between the microcontroller and sensor devices, reducing connection distances and increasing the accuracy of signal values These buttons enable device control and monitoring through a separate mobile app and web interface The system effectively addresses home safety issues by providing monitoring and alerts for incidents such as fire and theft Furthermore, we have developed a secure door system using RFID technology, integrating two types of cards - a master card and a guest card
The components used in the project are common and commercially available in recent times, providing a quick solution compared to older devices Additionally, utilizing these components will bring great benefits to the future development and expansion of integrated products without becoming obsolete due to not being able to utilize old components The use of popular and modern components helps this system become more accessible to the IoT community and users compared to previously built systems
This system integrates precise algorithms for control operations and device communication, helping to optimize performance and save energy
This system can communicate between the microcontroller and devices with low latency, ensuring quick and smooth response based on practical testing to meet the intended usage needs because it uses minimal connection in all designs Compared to other solutions, this communication capability helps the system meet real-time requirements and interact directly with users more effectively
This system uses MQTT cloud hosting, an IoT friendly and scalable solution This makes it easy to manage and control the system remotely and allows for flexible and
The first limitation of the system is the lack of interaction and integration with users' daily activities, such as schedule management, controlling home devices through artificial intelligence
The application interface and website of this smart home system are still in the development stage and are not highly technical This can reduce the user experience and limit the system's ability to be customized and updated Compared to other projects in the smart home field, the applications and websites of this project may be even simpler and do not show high professionalism and interactivity
One limitation of the system is that the SIM module is often affected by the location of the hotspot This can cause instability in the network connection, especially when the devices are located far from the base station Compared to other IoT smart home topics, the problems have been researched and development of technical solutions to increase network connection stability
Another problem is that the problem of losing Wi-Fi connection during system operation of project and other IoT smart home topics have not been resolved This loss of connection can cause interruptions in communication and reduce system continuity Troubleshooting this issue may require technical workarounds to ensure continuous and stable connectivity
The system also has not overcome the problem of power outages during operation, which can reduce the continuity and stability of the system Handling this problem has been addressed in some related topics through the integration of backup solutions or energy storage devices to ensure continuous system operation in all situations
Finally, the processing and updating the status on the interface of the application and website has not been fully implemented This leads to difficulty in knowing whether the devices have been successfully controlled or not Compared to other projects in the current smart home field, status updates have become an important factor to ensure users can monitor and control devices easily and accurately.
Future works
Based on the project's outcomes, we identify key areas for further development to enhance system functionality and better align with current practical needs These directions include the following:
- Develop new features to serve daily usage requirements
- Develop application and website interfaces to improve technical features
- Apply specialized equipment to the system
- Handle the problem of losing Wi-Fi connection and losing power during operation
5.2.1 Develop new features to serve daily usage requirements
To enhance the system's interaction with daily living activities, there are several improvements that can be made First, we can develop and grow automation capabilities, allowing users to easily set up activities such as managing schedules or controlling home devices through a simple and intuitive interface This will help ease daily work and create a smarter and more convenient living environment Next, integrating smart sensors such as light, temperature, and motion sensors into the system will help them detect and respond automatically to changes in the environment For example, the system can automatically adjust room brightness or temperature based on current environmental conditions All these improvements will help the system become more flexible and responsive to users' daily activities, thereby enhancing the experience and convenience of using the smart home system
5.2.2 Develop application and website interfaces to improve technical features
Implementing modern technologies and tools to automatically update status on the user interface is necessary Automatic notification mechanisms and instant status updates will help users identify and control the status of devices more easily and accurately At the same time, investing in the development and deployment of advanced technologies will enhance interaction and user experience, bringing great benefits to smart home systems
5.2.3 Apply specialized equipment to the system
Developing devices that save energy and operate accurately and quickly In addition, it is necessary to improve the connectivity of devices, including support for multiple connection protocols and advanced wireless connection technologies such as Wi-Fi 6, 5G, and LoRa
In addition, developing the flexibility and compatibility of devices also helps enhance system integration and flexibility Security and data management also need to be enhanced, by developing devices with strong security features and creating smart data management tools
Finally, improving data integration and analysis capabilities will help the system extract useful information from collected data, creating more effective decisions and operations In total, using specialized devices for IoT systems can provide significant
5.2.4 Handle the problem of losing Wi-Fi connection and losing power during operation
To handle the problem of Wi-Fi connection loss and power outage during IoT system operation, there are specific solutions that we can implement
First, developing backup methods will keep the system running continuously even if the Wi-Fi connection or power is lost This may include integrating a backup battery or energy storage device to keep the system running in the event of a power outage
Furthermore, self-healing mechanisms must be implemented so that the system automatically restores connectivity and operations after a failure These measures not only ensure the continuity and stability of the system but also help increase its reliability and ability to operate in all situations
MQTT (Message Queue Telemetry Transport) là một giao thức truyền thông nhẹ, được thiết kế để kết nối các thiết bị Internet vạn vật (IoT) có băng thông thấp và không đáng tin cậy MQTT sử dụng mô hình đăng ký/xuất bản, trong đó các thiết bị có thể đăng ký các chủ đề (topic) và xuất bản tin nhắn tới các chủ đề đó Các thiết bị khác có thể đăng ký các chủ đề tương tự để nhận tin nhắn đã xuất bản Ứng dụng của MQTT trong IoT rất đa dạng, bao gồm theo dõi điều khiển từ xa, quản lý thiết bị và truyền dữ liệu cảm biến.
[2] Lê Võ Lâm - Lê Thành Nhân, "Thiết kế mô hình hệ thống iot cho nhà kính trồng rau", Capstone Project, HCM City University of Technology and Education [3] The Bluetooth SIG “Bluetooth Technology Overview” Website: https://www.bluetooth.com/learn-about-bluetooth/tech-overview/ [Accessed Dec
[4] David Law, "IEEE 802.3 Ethernet", IEEE802.org Website: https://www.ieee802.org/3/ [Accessed Dec 12, 2023]
[5] H Ochiai, H Nakagami, Y Teranishi & H Esaki, "Facility networking with IP over RS485: Packet control for master-slave cascaded networks", IEEE
International Conference on Smart Grid Communications (SmartGridComm), 3-6 November 2014
[6] Frédéric Leens, "An introduction to I2C and SPI protocols”, IEEE Instrumentation
[7] Umakanta Nanda - Sushant Kumar Pattnaik, "Universal Asynchronous Receiver and Transmitter (UART)", 3rd International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 22-23 January 2016 [8] TP electronics AS, “LM2596 DC-DC Adjustable PSU Module” [Online]
Available: http://tpelectronic.ir/datasheets/20150123144301750.pdf [Accessed Nov 20, 2023]
[9] Công ty TNHH Giao Lộ, “SIM800L GPRS GSM Module” [Online] Available: https://www.thegioiic.com/sim800l-gprs-gsm-module [Accessed Nov 20, 2023] [10] Công ty TNHH Giao Lộ, “RC522 Mạch Đọc Ghi IC RFID” [Online] Available: https://www.thegioiic.com/rc522-mach-doc-ghi-ic-rfid [Accessed Nov 20, 2023] [11] Công ty TNHH Giao Lộ, “SG90 Động Cơ Servo” [Online] Available: https://www.thegioiic.com/sg90-dong-co-servo-180-do-1-2-2-4-kg-cm-4-8-6v [Accessed Nov 20, 2023]
[12] Lê Thị Tuyết Nga, “Cảm Biến Vật Cản Hồng Ngoại” [Online] Available: https://dientutuyetnga.com/products/cam-bien-vat-can-hong-ngoai-2 [Accessed Nov 20, 2023]
[13] Trần Thị Bích Ngọc, “LCD 1602 Xanh Lá” [Online] Available: https://hshop.vn/products/lcd-text-lcd1602-xanh-lo [Accessed Nov 20, 2023] [14] Trần Thị Bích Ngọc, “Mạch chuyển giao tiếp LCD1602, LCD1604, LCD2004
[15] Công ty TNHH Giao Lộ, “DHT11 Mạch Cảm Biến Nhiệt Độ Và Độ Ẩm Đen”
[Online] Available: https://www.thegioiic.com/dht11-mach-cam-bien-nhiet-do- va-do-am-den [Accessed Nov 20, 2023]
[16] Công ty TNHH Giao Lộ, “MQ-2 Mạch Cảm biến khí Gas LPG Propane
Hydrogen” [Online] Available: https://www.thegioiic.com/mq-2-mach-cam-bien- khi-gas-lpg-propane-hydrogen [Accessed Nov 20, 2023]
[17] Công ty TNHH Giao Lộ, “LM393 Mạch Cảm Biến Hồng Ngoại Phát Hiện Lửa 3
Chân” [Online] Available: https://www.thegioiic.com/lm393-mach-cam-bien- hong-ngoai-phat-hien-lua-3-chan [Accessed Nov 20, 2023].