KEMBAR78
Project Report-1 | PDF | Internet Of Things | Artificial Intelligence
0% found this document useful (0 votes)
14 views37 pages

Project Report-1

This document outlines a project focused on developing an AI-based smart home system that optimizes energy consumption by analyzing user behavior, specifically daily entry times, using sensors like Passive Infrared (PIR). The proposed system employs anomaly detection algorithms to intelligently control air conditioning units, enhancing comfort while reducing energy waste. The project also includes a literature survey on existing smart home technologies and their challenges, as well as a detailed analysis of the proposed system's specifications and requirements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views37 pages

Project Report-1

This document outlines a project focused on developing an AI-based smart home system that optimizes energy consumption by analyzing user behavior, specifically daily entry times, using sensors like Passive Infrared (PIR). The proposed system employs anomaly detection algorithms to intelligently control air conditioning units, enhancing comfort while reducing energy waste. The project also includes a literature survey on existing smart home technologies and their challenges, as well as a detailed analysis of the proposed system's specifications and requirements.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 37

CHAPTER 1

INTRODUCTION
1.1 DOMAIN OVERVIEW

The domain of this project lies at the intersection of Artificial Intelligence


(AI), and the Internet of Things (IoT), with a specific focus on energy
optimization and user behavior analysis. Traditional smart home systems often
rely on fixed rules or simple motion sensors, which do not adapt to changing user
routines and can lead to energy wastage. This project addresses these limitations
by proposing an AI-based system that learns user behavior specifically daily entry
times using data collected from sensors like Passive Infrared (PIR).

The system logs arrival times, stores them in a database, and anomaly
detection algorithms to recognize patterns and deviations. Based on this analysis,
it intelligently controls air conditioning (AC) units turning them ON, delaying
activation, or keeping them OFF to optimize comfort and reduce energy usage.
This domain supports a wide range of applications, including climate control,
energy-efficient buildings, and elder care monitoring. Future enhancements, like
integrating calendar data and seasonal behavior changes, can make smart homes
even more intelligent, secure, and user-centric.

1.2 OVERVIEW OF THE PROJECT

Our project is focused on energy optimization through behavior based


automated control. It aims to enhance smart home efficiency by using AI and IoT
to automate air conditioning based on user behavior. It collects daily entry times
using PIR sensors and stores them in a database. The system analyzes this data to
learn routines and uses anomaly detection to identify deviations. Based on this, it
intelligently controls the AC turning it ON, delaying, or keeping it OFF to reduce
energy consumption and increase comfort. This approach is scalable to other

1
devices and promotes a smart, energy-efficient, and personalized living
environment.

1.3 OBJECTIVE OF THE PROJECT

The objective of the project energy optimization through behavior based


automated control is to design a smart home automation system that intelligently
manages energy consumption by analyzing user behavior. The system focuses on
automating air conditioning based on daily entry patterns using AI and IoT
technologies. By collecting data through sensors and applying machine learning
algorithms, it detects regular schedules and anomalies in user activity. Based on
this analysis, the system decides when to activate, delay, or turn off the AC,
ensuring comfort and reducing energy wastage. The goal is to create a
personalized, energy-efficient, and intelligent living environment.

1.4 MOTIVATION

This project aims to enhance energy efficiency in smart homes through


behavior-based automation of air conditioning systems. It leverages AI to learn
user entry patterns and adapt the environment accordingly. By identifying
anomalies in user routines, the system optimizes AC usage to reduce energy waste.
This approach ensures personalized comfort while promoting sustainable power
consumption.

2
CHAPTER 2

LITERATURE SURVEY

A Literature review is a text of a scholarly paper, which includes the current


knowledge, including substantive findings, as well as theoretical and
methodological contributions to a particular topic. Literature reviews use
secondary sources and do not report new or original experimental work. A
literature review usually precedes the methodology and results section.

PAPER: 1

Title: “A Problem Analysis of Smart Home Automation: Toward Secure and


Usable Communication – Based Authorization”

Author: Siok Wah Tay

Year: 2024

Summary: This paper analyzes security challenges in Smart Home Automation


(SHAuto) driven by IoT and AI technologies. It emphasizes the risks of
compromised devices, which can lead to data breaches and unsafe control of smart
systems. A detailed study of SHAuto use cases helps form a generic model
highlighting communication and access control vulnerabilities.

PAPER: 2

Title: “Adaptive AI Powered Full Home Automation System for

Intelligent Living “

Author: Oluwasegun D. Onasanya

Year: 2024
3
Summary: This project introduces an Adaptive AI-powered Full Home
Automation System that enhances comfort and efficiency. It uses an AI-based
neural network (AIDBNN) to adjust settings based on user preferences and
environmental changes. A CNN ensures facial recognition and intruder detection
for improved security. A Decision Tree algorithm coordinates system actions for
optimal performance.

PAPER: 3

Title: “AI Driven Smart Homes – Challenges and Opportunities”

Author: Elkhalik

Year: 2024

Summary: This research surveys AI-based smart homes, highlighting their


benefits, challenges, and user perspectives. It reviews essential AI technologies
and smart home requirements for implementation. Key applications and popular
AI approaches in existing literature are discussed.

PAPER: 4

Title: “AI big data analytics for building automation and management systems: a
survey, actual challenges and future perspectives”

Author: Himeur

Year: 2023

Summary: This paper surveys the integration of AI and big data analytics into
Building Automation and Management Systems (BAMSs). It highlights AI's role
in overcoming BAMS limitations by enabling tasks like energy anomaly detection
and performance optimization. A taxonomy-based review covers AI applications
such as load forecasting, water management, and occupancy detection.

PAPER: 5

Title: “A deep learning model for intelligent home energy management system
using renewable energy”

Author: Sami Ben

4
Year: 2023

Summary: This paper introduces an Intelligent Home Energy Management


(IHEM) system using reinforcement learning to optimize energy usage and cost. It
models energy scheduling as a Markov Decision Process and applies a Neural
Network with Q-learning for dynamic, cost effective decision-making. The system
uses machine learning to predict electricity prices and PV energy supply for better
demand response efficiency. Results show a 20% reduction in monthly electricity
costs compared to traditional ILP-based methods.

PAPER: 6

Title: "Machine learning for intelligent energy consumption in smart homes"

Author: Alzoubi

Year: 2022

Summary: This study addresses rising residential energy demands and highlights
the role of smart homes in optimizing energy consumption. It proposes a data
fusion - based energy management approach, improving prediction accuracy to
92% over existing methods. Smart applications in asset management, automation,
and healthcare drive the need for intelligent energy solutions.

PAPER: 7

Title: "Intelligent control system of smart home for context awareness"

Author: Minbo

Year: 2022

Summary: This study proposes a smart home control framework using a novel
context modeling method based on object and attribute graphs. It analyzes existing
modeling strategies and designs rule, mode, and voice control for smart
interactions. An inference engine maps context-aware data to IoT services for
automation. Performance tests show faster response times and enhanced
personalization compared to traditional methods.

PAPER: 8

5
Title: “Artificial Intelligent of Things (AIoT) enabled floor monitoring system for
smart home applications”

Author: Zixuan Zhang

Year: 2021

Summary: This study presents a smart floor monitoring system using reliable
tribo electric coding mats and deep-learning analytics. It addresses sensor
limitations by normalizing outputs for stability, unaffected by humidity or usage
variations. A universal electrode design allows cost-effective, scalable production
with simplified wiring and reduced complexity. The system enables accurate
tracking, identity recognition, and smart interactions, advancing floor sensing in
smart homes.

PAPER: 9

Title: "Deep reinforcement learning for home energy management system


control"

Author: Lissa

Year: 2021

Summary: This study presents a deep reinforcement learning (DRL) algorithm for
smart home energy management, focusing on heating and hot water control. The
DRL approach optimizes PV energy use, achieving up to 16% energy savings in
summer without compromising user comfort. A dynamic indoor temperature set
point method enhances flexibility and efficiency in energy usage.

PAPER: 10

Title: "Smart home security: challenges, issues and solutions at different IoT
layers"

Author: Touqeer

Year: 2021

Summary: This paper explores the role of IoT in enabling smart home
technologies like temperature control, smart locks, and smoke detection. While
6
offering convenience, IoT also introduces serious security and privacy risks,
making users hesitant to adopt smart homes. The paper analyzes the layered IoT
structure and identifies security challenges at each layer within smart home
environments. It also proposes potential solutions to mitigate these issues and
enhance the overall security of IoT - based smart homes.

CHAPTER 3

SYSTEM ANALYSIS

3.1 EXISTING SYSTEM

AI-driven smart home systems commonly use rule-based automation and


basic machine learning models to enhance user experience. These systems rely on
various sensors such as motion detectors, cameras, and wearable devices to
monitor human presence and activity within the home. The data collected helps
identify the user's daily routines and preferences. However, traditional systems
operate on fixed rules. For example, a typical rule might be: “Turn the AC ON
when motion is detected.” These rules must be manually configured and do not
adapt automatically to changing behaviors.

Some systems incorporate supervised learning techniques, such as the


Random Forest algorithm, to analyze historical data and predict future actions.
While this adds a layer of intelligence, such models often struggle to adapt to
unusual or unexpected behaviors, making them less flexible in real-world
scenarios.

Additionally, smart devices like thermostats, lights, and voice assistants


communicate using Internet of Things (IoT) protocols such as MQTT, Zigbee, and
Wi-Fi. Although these enable automation and remote control, most devices still
follow static schedules rather than adjusting based on behavioral insights. Data
processing can occur either locally (edge computing) or in the cloud.

7
3.1.1 DISADVANTAGES OF AN EXISTING SYSTEM

● No context awareness
● Energy Efficiency
● No time based adjustment

3.2 PROPOSED SYSTEM

The proposed smart home air conditioning system uses an AI-driven


workflow that begins by detecting user presence through motion sensors or
cameras. When a person enters a room, the system records the entry time and
sends this information to the AI model. The model then compares this new input
with historical user behavior stored in the database. If the entry time falls within a
typical range such as within 10 minutes of usual patterns it is considered normal,
and the AC is turned on immediately. However, if the behavior appears unusual,
machine learning algorithms, specifically anomaly detection methods, analyze the
pattern further. If a minor anomaly is detected, the system introduces a 10–20
minute delay before gradually activating the AC. In cases of significant anomalies
such as entries occurring far outside usual times the AC remains off until user
presence is confirmed. This adaptive approach ensures that energy is not wasted
on brief or abnormal visits. By analyzing past behavior and adapting to real-time
inputs, the system intelligently manages energy consumption while maintaining
user comfort. Additionally, this behavior-based model can be extended to other
smart home devices like lights or fans, making the overall home environment
more responsive, efficient, and personalized.

3.2.1 ADVANTAGES OF PROPOSED SYSTEM


 Smart Anomaly Detection
 Time-Based Logic
 Gradual Adjustment

8
 Energy Efficient

Figure.3.1 Existing System vs Proposed System

3.3 ALGORITHM

3.3.1 ANOMALY DETECTION


The core algorithm utilized in this project is a statistical Anomaly
Detection Algorithm, which enables behavior-based automation by analyzing the
user's daily entry patterns. The system continuously records the user's arrival times
using sensors and stores this information in a database. Over time, it calculates the
mean and standard deviation of the entry times to understand the user's regular
routine. By comparing a new arrival time against these statistical values, the

9
system identifies whether the behavior falls within the expected range or deviates
significantly. If the deviation exceeds a predefined threshold typically two or three
standard deviations the entry time is marked as an anomaly. Based on this
classification, the system makes intelligent decisions regarding air conditioner
operation: it turns the AC ON immediately if the arrival is within the normal
range, gradually adjusts activation for minor delays, or keeps the AC OFF if a
significant anomaly is detected. This lightweight algorithm is effective for real-
time applications, as it requires minimal computational resources and does not
depend on large datasets. By intelligently responding to user behavior, the
anomaly detection algorithm ensures energy efficiency while maintaining user
comfort.

1. User Detection and Data Collection


2. Historical Data Logging
3. Pattern Learning
4. New Entry Time Detection Anomaly Check
5. Decision Making
6. Energy Optimization

After completing the above six steps, the anomaly detection algorithm
effectively learns the user's behavioral patterns and dynamically adapts the air
conditioning system to respond intelligently to deviations. This behavior-based
approach ensures that the system avoids unnecessary energy usage during irregular
routines while maintaining comfort during normal patterns. By integrating
statistical analysis with real-time decision-making, the algorithm enables
predictive control rather than reactive switching. This significantly improves
overall energy efficiency and user satisfaction. The insights gathered through this
process form the basis for further system evaluation, where performance can be
measured in terms of energy savings, reduced false triggers, and improved comfort
levels. These outputs are then analyzed in the result analysis section to validate the
10
effectiveness of the proposed smart home automation system.

CHAPTER 4
SYSTEM SPECIFICATION

The proposed system is designed to optimize energy consumption through


behavior-based control of the air conditioning system in a fully automated manner.
It uses a microcontroller connected to smart AC devices to collect and process
user entry time data. This data is analyzed using Python-based machine learning
algorithms to predict user behavior and automate AC operation without manual
input. Anomaly detection techniques are used to identify deviations in routine and
adjust AC settings to prevent unnecessary energy use. A cloud or local database is
used for storing historical data and supporting predictive analysis.

4.1 FUNCTIONAL REQUIREMENTS

The system should be able to collect and store data on the user's daily home
entry times. It must analyze historical patterns to predict future home arrival
accurately. The system should adjust AC settings automatically based on predicted
arrival times to optimize comfort and energy use. Anomaly detection must be
implemented to handle deviations from normal schedules. It should turn off or
delay AC operation when unexpected late arrivals are detected. The system should
provide feedback or control access through a user interface for monitoring and
adjustments.

4.2 NON-FUNCTIONAL REQUIREMENTS

The system should ensure high reliability to consistently perform


automation tasks without failure. It must be scalable to handle multiple users and
devices as the smart home network grows. The software should maintain

11
responsiveness, with minimal delay in adjusting settings based on user behavior.
Security is essential to protect user data and prevent unauthorized access to smart
devices. The system should offer high availability, operating continuously without
downtime.
4.3 HARDWARE REQUIREMENTS

1. Arduino Nano
Arduino Nano is a small and compact microcontroller board based on
the ATmega328 chip. It is similar to the Arduino Uno but smaller in size,
making it ideal for compact electronic projects. It has 14 digital input/output
pins, 8 analog inputs, a USB port for programming, and runs at 16 MHz. It is
widely used in DIY electronics, robotics, and embedded systems.

Figure 4.3.1 Arduino Nano

2. Relay Module
This acts as an electrical switch that allows the ESP32 microcontroller to
turn the air conditioner ON or OFF. When the AI algorithm determines that
the AC should be activated or deactivated based on user behavior, the ESP32
sends a signal to the relay module to perform the action.

12
Figure 4.3.2 Relay Module

3. Jumper Wire
A jumper wire is a short insulated wire used to connect components on
a breadboard or between devices in electronic circuits. It comes in male-to-
male, male-to-female, and female-to-female types for easy and quick
prototyping.

Figure 4.3.3 Jumper Wire

4.4 SOFTWARE REQUIREMENTS

● Python

● Pycharm

● Visual Studio Code

4.5 FEASIBILITY STUDY


13
The proposed behavior-based smart home automation system is technically
feasible using existing sensors, machine learning algorithms, and IoT platforms. It
is economically viable due to the potential for significant energy savings and the
decreasing cost of smart devices. Operationally, the system can be easily integrated
into modern homes with minimal disruption. Legally and ethically, it complies
with current data privacy norms if user data is securely handled. The system's
scalability allows it to be deployed across different home environments. Overall, it
presents a sustainable and user-centric approach to energy-efficient automation.

The system leverages commonly available hardware such as motion sensors,


smart thermostats, and microcontrollers, ensuring ease of implementation. Its
reliance on behavioral data allows it to deliver personalized automation, enhancing
user comfort and satisfaction. Maintenance is minimal, primarily involving
occasional software updates and hardware checks. The use of anomaly detection
ensures adaptability to changing user routines, increasing system robustness.
Cloud-based or local data storage options provide flexibility in deployment and
privacy management. Given these factors, the solution proves to be a practical and
forward-thinking advancement in smart home technology.

4.5.1 ECONOMICAL FEASIBILITY

The proposed behavior-based smart home automation system is


economically feasible due to its reliance on cost-effective components like
microcontrollers, sensors, and open-source software. Leveraging existing Wi-Fi
networks and smart devices reduces infrastructure expenses. Cloud-based or local
data storage options provide flexible cost management. Development and
maintenance costs remain minimal due to open-source tools and scalable design.
Overall, the long-term energy efficiency benefits outweigh the initial setup
investment.

4.5.2 TECHNICAL FEASIBILITY


14
The proposed system is technically feasible due to the availability of
affordable IoT sensors and microcontrollers capable of collecting user entry data.
Machine learning libraries like scikit-learn can be used to implement behavior
prediction and anomaly detection effectively. Cloud or local databases enable
efficient data storage and retrieval. The project can be developed and tested using
existing simulation tools and real-world data collection. Overall, current
technology supports the seamless implementation of behavior-based smart home
automation.

4.5.3 SOCIAL FEASIBILITY

The proposed behavior-based smart home automation system is


socially feasible as it aligns with the modern demand for energy-efficient and
convenient living. It enhances user comfort by personalizing the indoor
environment while promoting sustainable energy practices. By automating tasks
based on user habits, it reduces manual effort and increases daily efficiency. The
system respects user routines and adapts to changes, fostering a sense of reliability
and ease.

4.5.4 OPERATIONAL FEASIBILITY

The proposed behavior-based smart home automation system is


operationally feasible due to its integration with readily available smart devices
and IoT platforms. The use of established programming languages and open-
source tools ensures ease of development and deployment. Collecting user entry
data and controlling AC settings can be efficiently managed through existing
smart sensors and controllers.

CHAPTER 5
15
SYSTEM DESIGN AND DEVELOPMENT

5.1 INTRODUTION

Systems design is the processor art of defining the architecture, components,


modules, interfaces, and data for a system to satisfy specified requirements. One
could see it as the application of systems theory to product development. There is
some overlap and energy with the disciplines of systems analysis, systems
architecture and systems engineering.

5.2 FILE DESIGN

File design is a critical component of database development that focuses on


structuring how information is stored, accessed, and maintained within the system.
In the context of our smart home automation project, the file design includes the
creation of relational tables that capture user behavior, sensor activity, and system
responses. These tables are designed with carefully selected fields and data types
to support efficient processing and meaningful analytics.

5.3 INPUT DESIGN

The input design is the process of converting the user-oriented inputs into
the computer-based format. The goal of designing input data is to make the
automation as easy and free from errors as possible. For providing a good input
design for the application easy data input and selection features are adopted. The
input design requirements such as user friendliness, consistent format and
interactive dialogue for giving the right message and help for the user at right time
are also considered for the development of the project.

5.4 OUTPUT DESIGN


16
When designing output, systems analyst must accomplish the following;

● Determine what information to present


● Decide whether to display, print the information and select the output
medium
● Arrange the presentation of information in an acceptable format

Accomplishing the general activities listed above will require specific


decisions, such as whether to use preprinted forms when preparing reports and
documents, how many line to plan on printed page, or whether to user graphics
and color. The output design is specified on layout forms, sheets that describe the
location characteristics (such as length and type), and format of the column
headings and pagination.

5.5 SYSTEM ARCHITECTURE

Figure 5.1 System Architecture Diagram

17
The system design used in the project "Energy Optimization Through
Behavior-Based Automated Control" is centered around integrating artificial
intelligence (AI), Internet of Things (IoT) devices, and behavioral pattern
recognition to optimize energy usage specifically air conditioning in smart homes.
The system starts by detecting user presence through PIR sensors or cameras,
recording entry times into a local or cloud database. AI models analyze these
historical patterns to learn the user's routine. When a user's entry time deviates
from the usual schedule, an anomaly detection algorithm evaluates whether it is a
minor or major variation. Based on this, the system dynamically adjusts or delays
air conditioning operation to save energy without sacrificing comfort.

The architecture includes modules for data collection, logging, pattern


learning, anomaly detection, and adaptive control decision-making. The decision
engine determines whether to turn the AC on immediately, delay it, or keep it off
depending on the level of deviation from the user's regular schedule. By using
reinforcement learning principles and statistical analysis (mean and standard
deviation), the system adapts intelligently over time. This design reduces
unnecessary power consumption, enhances user comfort, and forms a scalable
framework that can also control other smart devices like lights and fans. Overall,
the system design reflects a balance between automation efficiency, energy
savings, and personalization.

18
5.5 USECASE DIAGRAM

Figure 5.2 Use Case Diagram

19
5.6 DATAFLOW DIAGRAM

User

Dataset Collection

Preprocessing

Trained Dataset Testing Dataset

Feature Extraction

Classification

Accuracy of result

Figure 5.3 Dataflow Diagram

20
5.6 CLASS DIAGRAM

Figure 5.4 Class Diagram

21
CHAPTER 6
TECHNOLOGIES
6.1 PYTHON LANGUAGE
Python is an object-oriented programming language created by Guido
Rossum in 1989. It is ideally designed for rapid prototyping of complex
applications. It has interfaces to many OS system calls and libraries and is
extensible to C or C++. Many large companies use the Python programming
language include NASA, Google, YouTube, Bit Torrent, etc. Python
programming is widely used in Artificial Intelligence, Natural Language
Generation, Neural Networks and other advanced fields of Computer Science.
Python had deep focus on code readability & this class will teach you python
from basics.
6.2 PYTHON PROGRAMMING CHARACTERISTIC
● It provides rich data types and easier to read syntax than any other
programming languages.
● It is a platform independent scripted language with full access to
operating system API's.
● Compared to other programming languages, it allows more run-time
flexibility.
● It includes the basic text manipulation facilities of Perl and Awk.
● A module in Python may have one or more classes and free functions.
● Libraries in Pythons are cross-platform compatible with Linux,
Macintosh, and Windows.
● For building large applications, Python can be compiled to byte-code.
● Python supports functional and structured programming as well as
OOP.
● It supports interactive mode that allows interacting testing .
22
6.3 INTERNET OF THINGS
The Internet of Things (IoT) refers to a network of physical devices,
vehicles, appliances, and other physical objects that are embedded with sensors,
software, and network connectivity, allowing them to collect and share data.
Technologists are even envisioning entire “smart cities” predicated on IoT
technologies. It enables these smart devices to communicate with each other and
with other internet-enabled devices. Like smart phones and gateways, creating a
vast network of interconnected devices that can exchange data and perform
various tasks autonomously.
As the number of internet-connected devices continues to grow, IoT is
likely to play an increasingly important role in shaping our world. Transforming
the way that we live, work, and interact with each other. In an enterprise context,
IoT devices are used to monitor a wide range of parameters such as temperature,
humidity, air quality, energy consumption, and machine performance. This data
can be analyzed in real time to identify patterns, trends, and anomalies that can
help businesses optimize their operations and improve their bottom line.
6.3.1 BENEFITS OF IOT
● Improved efficiency
● Data driven decision making
● Automation
● Real time data collection
● Remote monitoring and control
● Predictive maintenance
6.3.2 KEY TECHNOLOGIES IN IOT
● Sensors and actuators
● Connectivity technologies

23
● Cloud computing
● Big data analytics
● Security and privacy technologies
6.3.3 APPLICATIONS OF IOT
● Healthcare
● Manufacturing
● Retail
● Agriculture
● Transportation
6.4 ANOMALY DETECTION ALGORITHM
An anomaly detection algorithm is a machine learning technique that
identifies data points or patterns that significantly differ from the normal
behavior within a dataset. It analyzes historical data to understand typical trends
and then monitors new data to detect any deviations from these patterns. When
such deviations are found, the algorithm flags them as anomalies. This process
helps systems become more intelligent by enabling them to respond to
unexpected or irregular conditions, thereby improving efficiency, reliability, and
decision-making.
6.4.1 BENEFITS OF ANOMALY DETECTION ALGORITHM
● Enhances Automation
● Early Problem Detection
● Supports Adaptive Systems
● Reduces Operational Costs
● Increases Reliability
● Saves Energy and Resources

24
CHAPTER 7
TEST CASES
Testing, as already explained earlier, is the process of discovering all
possible weak-points in the finalized product. Testing helps to counter the
working of sub-assemblies, components, assembly and the complete result. The
project is taken through different exercises with the main aim of making sure that
software meets the business requirement and user-expectations and doesn’t fails
abruptly. Several types of tests are used today. Each test type addresses a specific
testing requirement.
7.1 TESTING TECHNIQUES
A test plan is a document which describes approach, its scope, its resources
and the schedule of aimed testing exercises. It helps to identify almost other test
item, the features which are to be tested, its tasks, how will everyone do each
task, how much the tester is independent, the environment in which the test is
taking place, its technique of design plus the both the end criteria which is used,
also rational of choice of theirs, and whatever kind of risk which requires
emergency planning. It can be also referred to as the record of the process of test
planning. Test plans are usually prepared with signification input from test
engineer.
1. UNIT TESTING
Unit testing for this project involves verifying data collection accuracy,
ensuring the prediction algorithm correctly anticipates user arrival times, testing
anomaly detection logic for schedule deviations, and validating the automation
control that manages AC settings based on behavior insights.
2. FUNCTIONAL TESTING
Functional testing for this project involves verifying if the system accurately
25
collects and records user entry times, processes the data to predict home arrival,
and adjusts the AC accordingly. It also checks whether anomaly detection
correctly identifies schedule deviations and modifies AC settings to save energy.
3. INTEGRATION TESTING
Integration testing for this project involves verifying the interaction between
the data collection module, behavior analysis algorithms, and the AC control
system. It ensures seamless communication between the sensors, machine
learning models, and smart device controllers. Testing also validates real-time
anomaly detection and appropriate system responses.
4. SYSTEM TESTING
System testing for this project involves verifying the integration of data
collection, behavior analysis, anomaly detection, and AC automation
functionalities. It ensures the system accurately predicts user arrival times and
responds appropriately to deviations. Additionally, the system's reliability and
responsiveness in varying user behavior patterns are evaluated.
5. WHITE BOX TESTING
White box testing for this project involves verifying the internal logic of
behavior analysis algorithms, ensuring correct implementation of the schedule
prediction and anomaly detection modules. It also includes checking condition
handling in the control flow for turning the AC on or off based on user patterns.
Testing ensures accurate data parsing, learning model outputs, and response to
edge cases like missing or inconsistent data.
6. BLACK BOX TESTING
Black box testing for this project involves verifying that the system
responds correctly to different user entry times without knowing the internal
logic. It checks whether the AC pre-conditioning activates or deactivates
appropriately based on detected patterns. It also tests anomaly handling when the
user deviates from typical behavior. The focus is on input-output correctness,
26
energy-saving functionality, and system responsiveness.

CHAPTER 8
MODULES
8.1 MODULE DESCRIPTION
8.1.1 DATA COLLECTION
Data Collection Module serves as the foundation of the smart home
behavioral automation system. It is responsible for gathering real-time data from
various sensors installed within the home environment. Primarily, motion sensors
such as Passive Infrared (PIR) sensors detect the user's physical presence or
movement, while temperature and humidity sensors like DHT11 monitor
environmental conditions. In addition to sensor data, the system also logs the
exact time of user entry on a daily basis. All collected data is time-stamped and
stored systematically to facilitate accurate analysis in later stages.
8.1.2 DATA PREPROCESSING
Data Preprocessing Module plays a vital role in ensuring the quality
and usability of the raw data collected from sensors. This module performs
cleaning operations to eliminate noise, remove duplicate entries, and resolve
inconsistencies that may arise due to faulty sensor readings or data logging
errors. It also converts and formats timestamps into standardized units, enabling
accurate time-series analysis. By transforming raw data into a clean, structured
format, this module ensures the integrity and accuracy of the system’s behavioral
models.
8.1.3 BEHAVIOR PATTERN ANALYSIS
Behavior Pattern Analysis Module is responsible for identifying the
user's habitual patterns based on historical entry time data. Utilizing time-series
analysis techniques, this module detects recurring behaviors, such as typical
arrival and departure times. By clustering similar behaviors, the system can build
27
a comprehensive profile of user activity, which is crucial for forecasting future
behavior and optimizing system responses.
8.1.4 ABNORMALITY DETECTION
Abnormality Detection Module ensures that deviations from the user’s
normal routine are quickly identified and addressed. It compares real-time data
against established behavior patterns to detect anomalies, such as unexpected
delays, early arrivals, or complete absences. Upon detecting such deviations, the
module automatically triggers energy-saving actions, such as turning off air
conditioning or lighting systems to avoid unnecessary energy usage.
8.1.5 CONTROL AND AUTOMATION
Control and Automation Module acts as the execution layer of the
system, interfacing directly with IoT- based smart devices such as relays, smart
plugs, and home automation hubs. It ensures seamless and reliable device
operation, enabling automated control over environmental settings without
manual intervention. This module is essential for transforming predictive insights
into tangible actions within the smart home environment.
8.1.6 FEEDBACK AND LEARNING
The Feedback and Learning Module enhances the system’s
intelligence by continually refining behavior models using newly collected data.
As users’ routines evolve, this module updates the underlying behavioral patterns
to reflect recent changes, thus improving prediction accuracy over time. It
supports adaptive learning, enabling the system to respond to seasonal shifts,
schedule changes, or lifestyle adjustments.
8.1.7 EVALUATION AND SIMULATION
Evaluation and Simulation Module is designed to test and validate
the effectiveness of the proposed smart home automation system. It runs
simulated scenarios based on actual data to assess how well the system performs
under various conditions. It also generates detailed performance metrics and
28
visual reports that help system’s responsiveness, accuracy, and overall impact.

CHAPTER 9
CODING
Main.py
import serial
importserial.tools.list_ports
import time
import pandas as pd
importjoblib
importnumpy as np

# Load ML model and encoders


print("🔄 Loading model and encoders...")
model = joblib.load("smart_ac_model.pkl")
le_time = joblib.load("encoder_timeofday.pkl")
le_occ = joblib.load("encoder_occupancy.pkl")
le_signal = joblib.load("encoder_acsignal.pkl")

# Function to detect Arduino COM port automatically


deffind_arduino_port():
ports = serial.tools.list_ports.comports()
for port in ports:
if "Arduino" in port.description or "CH340" in port.description:
returnport.device
raise Exception("⚠️Arduino not found. Please check USB connection.")

# Convert time to minutes


deftime_to_minutes(tstr):
h, m = map(int, tstr.split(":"))
return h * 60 + m

while 1:

# === Get Input from User ===


time_of_day = input("Enter time of day (Morning, Afternoon, Evening, Night): ")
29
exact_time = input("Enter exact time (HH:MM): ")
is_occupied = input("Is the home occupied? (Yes or No): ")

# === Preprocess and Predict ===


time_encoded = le_time.transform([time_of_day])[0]
minutes = time_to_minutes(exact_time)
occupied_encoded = le_occ.transform([is_occupied])[0]

input_df = pd.DataFrame([{
"Time of Day Encoded": time_encoded,
"Exact Time Minutes": minutes,
"Is Home Occupied Encoded": occupied_encoded
}])

prediction = model.predict(input_df)[0]
ac_signal = le_signal.inverse_transform([prediction])[0]

print(f"\n🔌 Smart AC Decision: AC should be **{ac_signal}**.")

# === Send to Arduino ===


try:
port = find_arduino_port()
withserial.Serial(port, 9600, timeout=2) as ser:
time.sleep(2) # Wait for Arduino to reset
ser.write(f"{ac_signal}\n".encode())
print(f"📤 Sent command to Arduino: {ac_signal}")
except Exception as e:
print(e)
print("⚠️Failed to send command to Arduino. Please check the connection.")

temp = input("Press Enter to continue or type 'exit' to quit: ")


iftemp.lower() == 'exit':
break

Train_Model.py
import pandas as pd
fromsklearn.model_selection import train_test_split
30
fromsklearn.preprocessing import LabelEncoder
fromsklearn.ensemble import RandomForestClassifier
fromsklearn.metrics import classification_report, accuracy_score
importjoblib

# Load dataset
df = pd.read_csv("smart_ac_dataset.csv") # Replace with your actual path

# Convert Exact Time to minutes since midnight


deftime_to_minutes(tstr):
h, m = map(int, tstr.split(":"))
return h * 60 + m

df["Exact Time Minutes"] = df["Exact Time"].apply(time_to_minutes)

# Encode categorical variables


le_time = LabelEncoder()
le_occ = LabelEncoder()
le_signal = LabelEncoder()

df["Time of Day Encoded"] = le_time.fit_transform(df["Time of Day"])


df["Is Home Occupied Encoded"] = le_occ.fit_transform(df["Is Home Occupied"])
df["AC Signal Encoded"] = le_signal.fit_transform(df["AC Signal"]) # 0: OFF, 1: ON

# Features and target


X = df[["Time of Day Encoded", "Exact Time Minutes", "Is Home Occupied
Encoded"]]
y = df["AC Signal Encoded"]

# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Train model
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)

# Predict and evaluate


y_pred = model.predict(X_test)
print("✅ Accuracy:", accuracy_score(y_test, y_pred))
31
print("\n📋 Classification Report:\n", classification_report(y_test, y_pred))

# Save model and encoders


joblib.dump(model, "smart_ac_model.pkl")
joblib.dump(le_time, "encoder_timeofday.pkl")
joblib.dump(le_occ, "encoder_occupancy.pkl")
joblib.dump(le_signal, "encoder_acsignal.pkl")

print("\n✅ Model and encoders saved successfully!")

Generate_df.py
import pandas as pd
import random
fromdatetime import datetime, timedelta

# Configuration
num_samples = 500 # How many rows you want

# Time categories
time_categories = ["Morning", "Afternoon", "Evening", "Night"]

# Helper to generate realistic Exact Time


defgenerate_time(time_of_day):
iftime_of_day == "Morning":
base_time = datetime.strptime("08:00", "%H:%M")
delta = random.randint(0, 180)
eliftime_of_day == "Afternoon":
base_time = datetime.strptime("13:00", "%H:%M")
delta = random.randint(0, 180)
eliftime_of_day == "Evening":
base_time = datetime.strptime("18:00", "%H:%M")
delta = random.randint(-15, 30) # 5:45 PM to 6:30 PM
eliftime_of_day == "Night":
base_time = datetime.strptime("21:00", "%H:%M")
delta = random.randint(-60, 60)
else:
base_time = datetime.strptime("12:00", "%H:%M")
delta = 0
32
final_time = base_time + timedelta(minutes=delta)
returnfinal_time.strftime("%H:%M")

# Helper to determine AC Signal based on your rules


defdetermine_ac_signal(exact_time_str, is_home_occupied):
exact_time = datetime.strptime(exact_time_str, "%H:%M")
six_pm = datetime.strptime("18:00", "%H:%M")
six_thirty_pm = datetime.strptime("18:30", "%H:%M")

ifsix_pm - timedelta(minutes=15) <= exact_time<= six_pm + timedelta(minutes=15):


# Between 5:45 PM and 6:15 PM, turn ON AC even if not occupied
return "ON"
elifexact_time>six_thirty_pm and is_home_occupied == "No":
# After 6:30 PM and still no one at home ➔ Turn OFF
return "OFF"
else:
# Otherwise, base it mainly on occupancy
return "ON" if is_home_occupied == "Yes" else "OFF"

# Now generate the full dataset


data = []
for _ in range(num_samples):
time_of_day = random.choice(time_categories)
is_home_occupied = random.choice(["Yes", "No"])
exact_time = generate_time(time_of_day)
ac_signal = determine_ac_signal(exact_time, is_home_occupied)

data.append({
"Time of Day": time_of_day,
"Exact Time": exact_time,
"Is Home Occupied": is_home_occupied,
"AC Signal": ac_signal
})

# Create DataFrame
df = pd.DataFrame(data)

# Save the dataset


output_file = "smart_ac_dataset.csv"
33
df.to_csv(output_file, index=False)

print(f"✅ Dataset generated and saved to {output_file} with {num_samples} samples.")

CHAPTER 10
SCREENSHOTS

Figure 10.1 Terminal Output of Intelligent AC Automation Based on User Inputs

34
Figure 10.2 Hardware Responce to Occupancy and Time-Based AC Control

CHAPTER 11

CONCLUSION

The proposed behavior-based smart home automation system demonstrates


a significant step forward in enhancing energy efficiency and user convenience.
By learning and adapting to the user's daily routines, particularly home entry
times, the system intelligently manages the air conditioning to create a
comfortable indoor environment while minimizing unnecessary energy
consumption. The integration of anomaly detection further refines the system's
responsiveness, ensuring that deviations from routine are addressed in real time to
avoid energy wastage. Simulation results and real-world data validate the
effectiveness of this approach, showcasing measurable reductions in power usage.
This project highlights the potential of combining machine learning, automation,
and IoT to create intelligent, adaptive living spaces, setting the stage for future
advancements in context-aware and sustainable smart home technologies.

Overall, this project demonstrates the use of anomaly recognition and


pattern analysis to build a home automation system that is fast and energy
efficient. This is a prerequisite for future advancements in smart home technology
by providing practical solutions that combine sustainability, comfort and ease of
use.

In conclusion, this project demonstrates how behavior-based automation can


enhance smart home efficiency by learning user routines and intelligently
managing air conditioning usage. By predicting arrival times and using anomaly
detection, the system reduces energy waste while maintaining comfort. The results

35
show that such adaptive systems can significantly contribute to smarter, more
sustainable living.

REFERENCES

[1] Tay, S. W., Zhang, N., &AlJanah, S. (2024). A problem analysis of smart home
automation:Toward secure and usable communication-based authorization. IEEE
Access, 12, 18103-18121https://doi.org/10.1109/ACCESS.2024.3359442
[2] Dahlgren, K., Pink, S., Strengers, Y., Nicholls, L., &Sadowski, J. (2021).
Personalization and the Smart Home: Questioning techno-hedonist
imaginaries. Convergence, 27(5),1155-116https://doi.org/10.1177/13548565211036801
[3] Suman, S., Etemad, A., &Rivest, F. (2021). Potential impacts of smart homes on
human behavior: A reinforcement learning approach. IEEE Transactions on Artificial
Intelligence, 3(4), 567-580 https://doi.org/10.1109/TAI.2021.3127483
[4] Zhang, F., Pan, Z., & Lu, Y. (2023). AIoT-enabled smart surveillance for personal
data digitalization: Contextual personalization-privacy paradox in smart
home. Information & Management, 60(2), 103736
https://doi.org/10.1016/j.im.2022.103736
[5] Gladence, L. M., Anu, V. M., Rathna, R., &Brumancia, E. (2020). Recommender
system for home automation using IoT and artificial intelligence. Journal of Ambient
Intelligence and Humanized Computing,1-9 https://doi.org/10.1007/s12652-020-01968-2
[6] Reyes-Campos, J., Alor-Hernández, G., Machorro-Cano, I., Olmedo-Aguirre, J. O.,
Sánchez-Cervantes, J. L., & Rodríguez-Mazahua, L. (2021). Discovery of resident
behavior patterns using machine learning techniques and IoT
paradigm. Mathematics, 9(3), 219 https://doi.org/10.3390/math9030219
[7] Agee, P., Gao, X., Paige, F., McCoy, A., &Kleiner, B. (2021). A human-centred
approach to smart housing. Building research & information, 49(1), 84-99
https://doi.org/10.1080/09613218.2020.1808946
[8] Gøthesen, S., Haddara, M., & Kumar, K. N. (2023). Empowering homes with
intelligence: An investigation of smart home technology adoption and usage. Internet of

36
Things, 24, 100944 https://doi.org/10.1016/j.iot.2023.100944
[9] Zaidi, A., Yang, R., Koshy, V., Cobb, C., Gupta, I., &Karahalios, K. (2023). A user-
centric evaluation of smart home resolution approaches for conflicts between
routines. Proceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous
Technologies, 7(1), 1-35.DOI:https://doi.org/10.1145/3581997

37

You might also like