0% found this document useful (0 votes)
11 views

Project Report - Group 1

The document is a project report on the development of a Smart Mirror integrated with AI using Raspberry Pi, submitted for a Bachelor of Technology degree at APJ Abdul Kalam Technological University. It details the project's objectives, including providing real-time information and enhancing user interaction through voice recognition and natural language processing. The report also outlines the system's design, implementation, and potential future enhancements, showcasing the Smart Mirror as a versatile home automation solution.

Uploaded by

devilrider337
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Project Report - Group 1

The document is a project report on the development of a Smart Mirror integrated with AI using Raspberry Pi, submitted for a Bachelor of Technology degree at APJ Abdul Kalam Technological University. It details the project's objectives, including providing real-time information and enhancing user interaction through voice recognition and natural language processing. The report also outlines the system's design, implementation, and potential future enhancements, showcasing the Smart Mirror as a versatile home automation solution.

Uploaded by

devilrider337
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

SMART MIRROR WITH AI USING

RASPBERRY PI
PROJECT REPORT

Submitted by

BENISON T R ( HKC21CS009 )
JUDIN K G ( HKC21CS013 )
NIKHIL R ( HKC21CS019 )
SONU K JOSEPH ( HKC21CS027 )

to
The APJ Abdul Kalam Technological University in partial
fulfillment of the requirements for the award of the Degree

of

Bachelor of Technology
in
Computer Science and Engineering

Department of Computer Science and Engineering

MGM College of Engineering and Technology


Pampakuda, Muvattupuzha.

January 2025
DECLARATION

We undersigned hereby declare that the report SMART MIRROR WITH AI USING
RASPBERRY PI, submitted for the partial fulfillment of the requirements for the award
of degree of Bachelor of Technology of the APJ Abdul Kalam Technological University,
Kerala is a bonafide work done by us under supervision of Asst.Prof.Amala George. This
submission represents our ideas in our own words and where ideas or words of others have
been included, we have adequately and accurately cited and referenced the original sources.
We also decide that we have adhered to ethics of academic honesty and integrity and have
not misrepresented or fabricated any data or idea or fact or source in our submission. We
understand that any violation of the above will be a cause for disciplinary action by the
institute and/or the University and can also evoke penal action from the sources which
have thus not been properly cited or from whom proper permission has not been obtained.
This report has not been previously formed the basis for the award of any degree, diploma
or similar title of any other University.

Pampakuda Benison T R
Date: Judin K G
Nikhil R
Sonu K Joseph
DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING MGM COLLEGE OF ENGINEERING AND
TECHNOLOGY, PAMPAKUDA, MUVATTUPUZHA

CERTIFICATE

This is to certify that the report entitled SMART MIRROR WITH AI USING
RASPBERRY PI submitted by BENISON T R (HKC21CS009), JUDIN K G
(HKC21CS013), NIKHIL R (HKC21CS019), SONU K JOSEPH (HKC21CS027) of the
APJ Abdul Kalam Technological University in partial fulfillment of the requirements for
the award of the Degree of Bachelor of Technology in Computer Science and Engineering
is the bonafide record of the Project work carried out by them under our guidance and
supervision. This report in any other form has not been submitted to any other University
or Institute for any purpose.

Asst.Prof. Amala George


( Head of the Department )
( Project Coordinator )
( Project Guide )
ACKNOWLEDGEMENT

First and foremost, we thank God Almighty for his divine grace and blessings in making
all this possible. It’s our privilege to render our heartfelt thanks and gratitude to our most
beloved Principal Dr. Satheesh Kumar K for providing excellent digital library facilities and
permission to use the same. We are deeply thankful to our Head of the Department,
Asst.Prof. Amala George for her support and encouragement. We express our sincere
gratitude to our project guide Asst.Prof. Amala George, Department of Computer Science
and Engineering for their motivation, assistance, and support. We are also thankful to all
the staff members of the Computer Science and Engineering Department for their support.
At last, but not least we thank all our friends and family for their valuable feedback from
time as well as their help and encouragement.

Benison T R (HKC21CS009)
Judin K G (HKC21CS013)
Nikhil R (HKC21CS019)
Sonu K Joseph (HKC21CS027)

i
ABSTRACT
This project presents the development of a Smart Mirror integrated with AI, utilizing the
capabilities of the Raspberry Pi as the core computing platform. The Smart Mirror serves
as an interactive display that not only reflects the user's image but also provides real-time
information such as weather updates, news headlines, calendar events, and personalized
reminders. By incorporating AI, the Smart Mirror enhances user interaction through
natural language processing, allowing users to engage in conversational queries and receive
intelligent responses. The system is designed to utilize voice recognition and text-to-speech
functionalities, enabling hands-free operation and a seamless user experience.

The project leverages the Raspberry Pi's GPIO pins for interfacing with various sensors
and components, such as microphones and displays, while employing a modular software
architecture to facilitate easy updates and enhancements. This innovative integration of AI
with a traditional smart mirror not only showcases the versatility of the Raspberry Pi but
also demonstrates the potential for creating personalized, interactive home automation
solutions. Ultimately, this Smart Mirror project aims to enhance daily routines by
providing users with a convenient and engaging interface for accessing information and
managing tasks efficiently.

ii
CONTENTS
Title Page No :

ACKNOWLEDGEMENT i
ABSTRACT ii
LIST OF FIGURES iv
LIST OF TABLES v
ABBREVIATIONS vi

Chapter 1: INTRODUCTION 1
1.1 EXISTING SYSTEM 2
1.2 PROPOSED SYSTEM 2
1.3 SCOPE 3
Chapter 2 : LITERATURE REVIEW 4
2.1 SMART MIRROR USING RASPBERRY PI 4
2.2 IoT BASED SMART MIRROR USING RASPBERRY Pi 4 4
2.3 SMART MIRROR USING RASPBERRY PI-3B+ 5
2.4 SMART MIRROR WITH ALEXA USING RASPBERRY PI 5
Chapter 3 : REQUIREMENT ANALYSIS 7
3.1 FUNCTIONALITIES 7
3.2 HARDWARE REQUIREMENTS 7
3.3 SOFTWARE REQUIREMENTS 8
3.3.1 Raspberry Pi 4 8
3.3.2 Magic Mirror Software 9
3.3.3 Python 10
3.3.4 OpenAI API 11
Chapter 4 : SYSTEM DESIGN 12
4.1 METHODOLOGY 12
4.1.1 PROPOSED SYSTEM 12
4.1.2 PROBLEMS IDENTIFIED 13
4.1.3 SOLUTIONS FOR THE PROBLEM 13
4.2 UML DIAGRAMS 14
4.2.1 Use Case Diagram 15
4.3 ACTIVITY DIAGRAM 16
4.4 SEQUENCE DIAGRAM 17

iii
4.5 DATA FLOW DIAGRAM 18
Chapter 5 : IMPLEMENTATION AND TESTING 20
5.1 IMPLEMENTATION 20
5.2 TESTING 20
5.2.1 TEST CASES 21
5.2.1.1 Unit Testing 21
5.2.1.2 Integrated Testing 22
5.2.1.3 Validation Testing 22
5.3 RESULT 23
Chapter 6 : CONCLUSION 24
Chapter 7 : REFERENCES 25
Chapter 8 : APPENDIX 26

iii
LIST OF FIGURES

No. Title Page No :

4.1 Use Case Diagram 15


4.2 Activity Diagram 16
4.3 Sequence Diagram 17
4.4 Data Flow Diagram 18
5.1 Smart Mirror Interface 23

iv
LIST OF TABLES

No. Title Page No :

2.1 Literature Survey Table 6

v
ABBREVIATIONS

UML - Unified Modeling Language


DFD - Data Flow Diagram
HDMI - High Definition Multimedia Interface
USB - Universal Serial Bus
GPIO - General Purpose Input/Output

vi
CHAPTER 1

INTRODUCTION

The concept of a Smart Mirror has gained significant popularity in recent years, merging
traditional reflective surfaces with advanced technology to create interactive and
informative displays. This project explores the development of a Smart Mirror using the
Raspberry Pi, a compact and powerful single-board computer, integrated with AI, an
advanced natural language processing model developed by OpenAI. The integration of
these technologies aims to enhance user interaction and provide a personalized experience
that goes beyond mere reflection.

A Smart Mirror typically displays essential information such as time, weather, news
updates, and calendar events, all while maintaining the functionality of a regular mirror.
By incorporating ChatGPT, this project elevates the Smart Mirror's capabilities, allowing
users to engage in natural language conversations. Users can ask questions, seek
information, and receive intelligent responses, making the Smart Mirror not just a passive
information source but an active assistant in daily life. This interaction is facilitated
through voice recognition and text-to-speech technologies, enabling hands-free operation
and a seamless user experience.

The Raspberry Pi serves as the backbone of this project, providing the necessary processing
power and connectivity options to support various functionalities. Its GPIO (General
Purpose Input/Output) pins allow for the integration of additional sensors and
components, such as microphones and displays, enhancing the Smart Mirror's interactivity.
The modular software architecture enables easy updates and the addition of new features,
ensuring that the Smart Mirror can evolve with user needs and technological
advancements.

In summary, this project aims to create a Smart Mirror that not only reflects the user's
image but also serves as a personalized assistant, providing real-time information and
facilitating interactive conversations. By leveraging the capabilities of the Raspberry Pi and
AI, this Smart Mirror project represents a significant step forward in the realm of home
automation and user interaction, ultimately enhancing the convenience and efficiency of
daily routines.

1
1.1 EXISTING SYSTEM

The existing systems for smart mirrors primarily focus on enhancing traditional mirrors by
integrating basic digital functionalities, such as displaying time, weather updates, and news
headlines. While these systems represent a step forward in merging technology with
everyday objects, they often have significant drawbacks. One major limitation is the
reliance on manual input methods, such as touch controls or remote interfaces, which can
be cumbersome and impractical, especially in environments like bathrooms where users
may have wet or soapy hands.

Additionally, many existing smart mirrors lack customization options, preventing users
from personalizing the information displayed according to their individual preferences or
needs. This lack of interactivity and flexibility underscores the necessity for a more
advanced smart mirror solution that offers seamless voice interaction and greater
adaptability to enhance user experience.

1.2 PROPOSED SYSTEM

Interactive User Interface : The Smart Mirror will feature a user-friendly interface that
displays essential information such as time, weather, news headlines, and calendar
events. By integrating ChatGPT, users can engage in natural language conversations,
asking questions and receiving intelligent responses, thereby enhancing the interactivity
of the mirror.

Voice Recognition and Control : The system will incorporate voice recognition
technology, allowing users to interact with the Smart Mirror hands-free. This feature
enables users to issue commands, ask for information, and control various
functionalities simply by speaking, making it convenient for use in daily routines,
especially in scenarios where hands may be occupied.

Modular Design and Customization : The Smart Mirror will be built on a modular
software architecture, allowing for easy updates and the addition of new features over
time. Users can customize the mirror's functionalities by adding or removing modules,
such as fitness tracking, reminders, or integration with smart home devices, tailoring
the experience to their specific needs.

2
Integration with Raspberry Pi : Utilizing the Raspberry Pi as the core computing
platform provides a cost-effective and powerful solution for the Smart Mirror. The
Raspberry Pi's GPIO pins will facilitate the connection of various sensors and
components, such as microphones, cameras, and displays, enabling a wide range of
functionalities and enhancing the overall user experience.

Real-Time Information and Personalization : The Smart Mirror will be capable of


displaying real-time information sourced from the internet, such as news updates and
weather forecasts. Additionally, by leveraging ChatGPT's capabilities, the system can
provide personalized responses based on user preferences and past interactions,
creating a more engaging and tailored experience for each user.

1.3 SCOPE

The scope of the "Smart Mirror With AI Using Raspberry Pi" project encompasses the
development of an interactive and multifunctional smart mirror that enhances user
experience through real-time information display and conversational AI. This system aims
to integrate various features such as weather updates, news feeds, calendar management,
and personalized reminders, all while allowing users to engage in natural language
conversations with ChatGPT for information retrieval and task management.

The project also explores the potential for future enhancements, including the integration
of additional modules for fitness tracking, smart home control, and voice-activated
functionalities, thereby expanding the mirror's capabilities. Furthermore, the use of the
Raspberry Pi as the core platform ensures a cost-effective and accessible solution, making
it suitable for a wide range of users, from tech enthusiasts to everyday consumers seeking
to improve their daily routines through innovative technology.

Overall, this project not only demonstrates the practical applications of AI and IoT in
home automation but also sets the foundation for further research and development in
smart home technologies.

3
CHAPTER 2

LITERATURE REVIEW

2.1 SMART MIRROR USING RASPBERRY PI


Author : Bhuvaneswari T, Aishwarya C, Aishwarya H A, B Abhinaya Nalina H D, 2020

The paper presents the development of a Smart Mirror using Raspberry Pi technology,
designed to provide busy individuals with real-time updates while grooming. This
innovative mirror integrates features such as weather forecasts, time, date, news updates,
music, and email notifications, all accessible through voice control for seamless interaction.
The system utilizes a two-way mirror that reflects the user's image while displaying digital
information, enhancing multitasking capabilities. It comprises hardware components like a
Raspberry Pi, LED monitor, microphone, and speaker, along with software elements
including the Raspbian operating system and JavaScript for coding. The authors also
discuss future enhancements, such as incorporating artificial intelligence for home
automation and security features like face detection, aiming to create a more interactive
and intelligent user experience.

2.2 IoT BASED SMART MIRROR USING RASPBERRY Pi 4


Author : Ashutosh Narayan Bilange1 , Aniket Kadam2 , Prof. H. N. Burande, 2020

The paper discusses the development of an IoT-based smart mirror utilizing Raspberry Pi 4
technology, designed to enhance daily routines by providing real-time information such as
news, weather, and time while users prepare in front of the mirror. The smart mirror
integrates voice command capabilities through Amazon's Alexa, allowing users to interact
with the device for various tasks, including controlling smart home devices and accessing
personalized data. The project aims to create a multifunctional product that not only
serves as a traditional mirror but also acts as an information hub and entertainment
source, with future enhancements planned for features like facial recognition and advanced
AI applications.

The smart mirror is constructed using a combination of hardware components, including a


Raspberry Pi 4, a one-way mirror film, an LCD panel, a USB microphone, and a Pi
camera for face detection. The software aspect involves the Raspbian operating system and
the installation of Alexa Voice Services, enabling voice interaction. The paper highlights
the potential applications of the smart mirror in various settings, such as homes and
offices, emphasizing its role in making life more interactive, efficient, and secure.

4
2.3 SMART MIRROR USING RASPBERRY PI-3B+
Author : Shital S Garud, Pranoti D Lokare, Snehal S Pawar, Nilesh C Yadav, 2021

The PDF discusses the design and implementation of a Smart Mirror using Raspberry Pi-
3B+, which enhances the functionality of a traditional mirror by integrating digital
features. This innovative device displays real-time information such as time, date, weather
updates, and news headlines, providing users with a convenient way to access essential data
while getting ready for the day. The Smart Mirror operates through voice commands and
utilizes a two-way mirror, allowing it to function as both a reflective surface and a display
for digital content.

The project outlines the components involved, including a Raspberry Pi, a monitor, a
motion sensor, and a microphone, which work together to create an interactive user
experience. The Smart Mirror is designed to activate when it detects a person in front of it,
thereby conserving energy. Future enhancements could include touch screen capabilities
and additional features like traffic and flight updates, making it a versatile tool for home
automation and personal assistance.

2.4 SMART MIRROR WITH ALEXA USING RASPBERRY PI


Author : Dr. PM Shiva Kumar Swamy,Aditya S, Ashish S Ammanagi, Hemanth
Reddy G,
Jeevan S Aradhya, 2022

The PDF discusses the development of a smart mirror utilizing Raspberry Pi and Alexa,
designed to provide users with essential information while they engage with their reflection.
The smart mirror integrates various features such as displaying the date, weather updates,
news, and home automation controls, making it a practical tool for daily life. The project
employs Python programming and the Raspbian operating system to facilitate the mirror's
functionality, allowing for easy interaction through voice commands via Alexa. This
innovative device aims to enhance time management and multitasking for users, providing
a seamless way to access information without the need for separate gadgets.

The methodology of the project includes designing the mirror's dimensions, fabricating a
sturdy frame, and ensuring the use of a two-way mirror that allows for both reflection and
display of information. The smart mirror not only serves as a functional object but also
enriches the user experience by combining aesthetic appeal with advanced technology,
ultimately catering to the needs of a busy lifestyle.

5
2.1 Literature Survey Table

6
CHAPTER 3

REQUIREMENT ANALYSIS

The "Smart Mirror With AI Using Raspberry Pi" system enhances daily routines with real-
time information and interactive features. It provides weather forecasts, news headlines,
and calendar events, and allows users to manage schedules, receive reminders, and control
smart home devices.

3.1 FUNCTIONALITIES

Real-Time Information Display : Shows current time, date, weather updates, and news
headlines for quick access to essential data.
Voice Interaction with ChatGPT : Engages users in natural language conversations,
allowing questions and personalized responses without a keyboard.
Calendar and Reminder Management : Displays calendar events and reminders to help
users keep track of their schedules and important tasks.
Smart Home Control : Integrates with smart home devices, enabling control of lights,
thermostats, and other appliances through voice commands.
Customizable Modules : Allows users to add or remove various modules to tailor
functionalities, such as fitness tracking, social media updates, or additional news
sources.

3.2 HARDWARE REQUIREMENTS


Two-Way Mirror
Display Screen
Microcontroller : Raspberry Pi 4
Mirror Frame
HDMI Cable
USB Cable
Speaker
Microphone
Internet Connection
Power Supply

7
3.3 SOFTWARE REQUIREMENTS

Operating System : Raspbian OS


Magic Mirror Software

Python
OpenAI API
Web Browser : Internet Explorer/Google Chrome/Firefox

3.3.1 Raspberry Pi 4

The Raspberry Pi 4 is a powerful and versatile single-board computer developed by the


Raspberry Pi Foundation, marking a significant advancement in performance and
capabilities compared to its predecessors. Launched in June 2019, it features a quad-core
ARM Cortex-A72 processor running at 1.5 GHz, which allows it to handle more
demanding applications suitable for desktop computing, media centers, and Internet of
Things (IoT) projects. The Raspberry Pi 4 is available in three memory configurations—2
GB, 4 GB, and 8 GB of LPDDR4-3200 SDRAM—providing users with the flexibility to
choose a model that best fits their specific needs.

One of the standout features of the Raspberry Pi 4 is its enhanced connectivity options. It
includes Gigabit Ethernet for faster wired connections, dual-band 802.11ac Wi-Fi for
improved wireless performance, and Bluetooth 5.0 for connecting various peripherals.
Additionally, the board supports dual micro-HDMI ports, allowing for dual 4K display
output at 60 frames per second, which is particularly beneficial for multimedia
applications. The Raspberry Pi 4 retains the 40 GPIO (General Purpose Input/Output)
pins found in previous models, enabling extensive interfacing with sensors, motors, and
other electronic components, making it ideal for robotics and DIY electronics projects.

The Raspberry Pi 4 supports a variety of operating systems, with Raspberry Pi OS being


the most popular choice. Other compatible distributions include Ubuntu, LibreELEC, and
Windows 10 IoT Core, offering users a range of options to suit their project requirements.
The active community surrounding the Raspberry Pi ecosystem contributes to its success
by providing a wealth of resources, tutorials, and project ideas, making it an excellent
platform for both educational purposes and practical applications. Overall, the Raspberry
Pi 4 is a robust and flexible computing solution that empowers users to explore a wide
array of projects, from simple programming tasks to complex systems integration, making
it a valuable tool for hobbyists, educators, and professionals alike.

8
3.3.2 Magic Mirror Software

MagicMirror is an open-source modular smart mirror platform that transforms a standard


mirror into a dynamic information display, showcasing content such as the time, weather,
news updates, and calendar events. This innovative concept allows users to access essential
information at a glance while engaging in daily routines, such as getting ready in the
morning. Designed to run on devices like the Raspberry Pi, MagicMirror offers a cost-
effective solution for DIY enthusiasts and developers, making it accessible to a wide
audience interested in creating personalized smart mirror applications.

A key feature of MagicMirror is its modular architecture, which enables users to customize
their smart mirror experience by adding or removing modules based on their preferences.
Each module serves a specific function, allowing for a diverse range of functionalities, such
as displaying social media feeds, controlling smart home devices, or providing traffic
updates. This flexibility empowers users to tailor their smart mirror to meet individual
needs, creating a personalized interface that enhances daily life. Additionally, the modular
design encourages developers to create and share their own modules, fostering a
collaborative community around the platform.

The core of the MagicMirror software is built using JavaScript, utilizing Node.js for
server-side operations and Electron for creating a desktop application that runs seamlessly
on the Raspberry Pi. The installation process is user-friendly, typically involving
downloading the MagicMirror repository from GitHub and configuring it for specific
hardware setups. This accessibility makes it suitable for users with varying levels of
technical expertise. The active community surrounding MagicMirror provides extensive
documentation, tutorials, and support for troubleshooting, ensuring that users can easily
find resources and assistance as they develop their smart mirror projects.

MagicMirror enhances the functionality of a traditional mirror while serving as an


engaging interface for accessing essential information and controlling smart home features.
Its open-source nature, modular design, and strong community support make it a popular
choice for those looking to create personalized smart mirror solutions. As technology
continues to evolve, the potential for MagicMirror to integrate with new devices and
services will only expand, making it an exciting platform for future development. By
leveraging the capabilities of MagicMirror, users can create a smart mirror that not only
reflects their image but also embodies their lifestyle and preferences in an increasingly
connected world.

9
3.3.3 Python

Python is a high-level, interpreted programming language renowned for its simplicity and
readability, making it an ideal choice for developing the "Smart Mirror Using Raspberry
Pi Integrated With ChatGPT" system. Its straightforward syntax allows developers to
write code that is easy to read and understand, facilitating rapid prototyping and
development. This is particularly beneficial in collaborative projects, where multiple
developers may be involved, as well as for hobbyists and beginners who may be new to
programming. The ease of use inherent in Python enables quick implementation of features
and iterative design, which is essential for a project that aims to integrate various
functionalities seamlessly.

One of the significant advantages of Python is its extensive ecosystem of libraries and
frameworks that can significantly accelerate development. For the Smart Mirror project,
libraries such as Flask or Django can be utilized to create a web-based interface, allowing
users to interact with the system through a browser. Additionally, the SpeechRecognition
library enables the Smart Mirror to process voice commands, converting spoken language
into text for further processing. The gTTS (Google Text-to-Speech) library allows the
system to convert text responses from ChatGPT into spoken words, enhancing user
interaction. Furthermore, Python can be used to interact with the OpenAI API, providing
access to ChatGPT and enabling the Smart Mirror to generate intelligent responses based
on user queries.

Python's compatibility with hardware makes it particularly well-suited for projects


involving the Raspberry Pi. The Raspberry Pi supports GPIO (General Purpose
Input/Output) pins, which can be controlled using Python libraries such as RPi.GPIO or
gpiozero. This capability allows developers to interface with various sensors, buttons, and
other electronic components, enabling functionalities such as voice activation through a
connected microphone and sensor integration for displaying real-time data (e.g.,
temperature, humidity) on the Smart Mirror interface. This hardware integration is crucial
for creating a fully interactive and responsive system.

Lastly, the strong community support surrounding Python is a significant asset for
developers. With a large and active user base, developers can easily find resources,
tutorials, and forums to seek help and share knowledge. This community support is
invaluable for troubleshooting issues and discovering best practices. For the Smart Mirror
project, developers can leverage online resources to find examples of similar projects, code
snippets, and libraries that can enhance the system's functionality. Overall, Python's ease of
use, extensive libraries, hardware integration capabilities, and community support make it
an excellent choice for developing the Smart Mirror system, ultimately contributing to a
robust and interactive user experience.

10
3.3.4 OpenAI API

The OpenAI API provides a powerful interface for developers to access advanced language
models, including ChatGPT, enabling the integration of natural language processing
capabilities into various applications. In the context of the "Smart Mirror Using Raspberry
Pi Integrated With ChatGPT" project, the OpenAI API serves as the backbone for
enabling conversational interactions between users and the smart mirror. By leveraging
this API, developers can harness the capabilities of ChatGPT to process user queries,
generate contextually relevant responses, and create a more engaging and interactive user
experience.

To integrate the OpenAI API into the Smart Mirror project, developers first need to obtain
an API key from OpenAI, which grants access to the language model. This key is essential
for authenticating requests made to the API. Once the API key is secured, developers can
use Python to send HTTP requests to the OpenAI API endpoint, passing user input as a
prompt. The API processes this input and returns a generated response based on the
context provided. This interaction allows the Smart Mirror to respond intelligently to user
queries, making it feel more like a personal assistant rather than a static information
display.

The OpenAI API supports various parameters that can be adjusted to customize the
behavior of the ChatGPT model. For instance, developers can set the "temperature"
parameter to control the randomness of the responses, allowing for more creative or
focused outputs depending on the desired interaction style. Additionally, the "max tokens"
parameter can be used to limit the length of the generated response, ensuring that the
Smart Mirror provides concise answers suitable for quick interactions. By fine-tuning these
parameters, developers can tailor the conversational experience to meet user expectations
and enhance the overall functionality of the Smart Mirror.

Moreover, the OpenAI API is designed to handle a wide range of conversational contexts,
making it suitable for various applications beyond simple question-and-answer
interactions. In the Smart Mirror project, this capability can be utilized to provide
personalized responses based on user preferences, past interactions, and contextual
information. For example, the Smart Mirror could offer tailored news updates, reminders,
or even motivational quotes based on the user's interests. This level of personalization not
only enriches the user experience but also encourages regular engagement with the Smart
Mirror, transforming it into a valuable tool for daily routines. Overall, the integration of
the OpenAI API into the Smart Mirror project significantly enhances its interactivity and
functionality, making it a cutting-edge solution in the realm of smart home technology.

11
CHAPTER 4

SYSTEM DESIGN

4.1 METHODOLOGY

The development of the Smart Mirror follows a structured approach, beginning with
hardware selection and assembly. A two-way mirror is used as the reflective surface,
behind which an LCD screen displays digital content. A Raspberry Pi serves as the central
processing unit, running the software and managing various functionalities. Additional
components, including a microphone, speaker, and sensors, are integrated through the
Raspberry Pi’s GPIO pins to enable voice recognition and environmental interactions. The
display is powered by a lightweight web-based interface that retrieves and presents real-
time information like time, weather, and news updates.

The software implementation involves setting up the Raspberry Pi with an operating


system and configuring essential applications. The MagicMirror² framework, an open-
source platform, is customized to display relevant widgets and support AI interactions.
ChatGPT is integrated using API calls, enabling natural language processing and
intelligent responses. Voice recognition is implemented using libraries like
SpeechRecognition and Google’s Text-to-Speech (TTS) for hands-free operation. The
modular software architecture ensures flexibility for future updates, allowing new features
and enhancements to be incorporated seamlessly.

To optimize user experience, the Smart Mirror undergoes testing and refinement.
Performance evaluation includes assessing response accuracy, display clarity, and voice
command efficiency. User feedback is gathered to improve functionality and enhance
interaction. The final version of the Smart Mirror aims to provide a seamless and intuitive
experience, offering personalized assistance and real-time information while maintaining
its primary function as a mirror.

4.1.1 PROPOSED SYSTEM


The proposed Smart Mirror system integrates AI-driven interaction with a traditional
mirror, enhancing user experience through real-time information display and voice-enabled
assistance. A two-way mirror with an LCD screen serves as the primary interface, where
essential details such as time, weather, news, and calendar updates are displayed. The
Raspberry Pi acts as the processing unit, running the system software and managing
various components, including a microphone and speakers for voice interaction. ChatGPT
is integrated to enable natural language conversations, allowing users to ask questions,
receive responses, and perform basic tasks hands-free.
12
The system's software is built using the MagicMirror² framework, customized to support
AI-based features and modular widgets. Voice recognition, powered by libraries like
SpeechRecognition, enables seamless communication, while text-to-speech technology
provides spoken responses. The modular architecture ensures scalability, allowing new
features and integrations such as home automation control and personalized
recommendations. With a user-friendly interface and hands-free operation, the Smart
Mirror enhances convenience and efficiency in daily routines, making it a practical
addition to modern smart homes.

4.1.2 PROBLEMS IDENTIFIED

Traditional Smart Mirrors primarily function as passive information displays, lacking


advanced interactivity and personalization. Most existing models provide only basic
widgets like time, weather, and calendar updates, without the ability to engage in natural
language conversations. Additionally, many do not support voice commands effectively,
requiring users to rely on touch interfaces or pre-set gestures, which limits accessibility
and ease of use. Unlike the proposed system, traditional Smart Mirrors often lack AI
integration, reducing their ability to provide intelligent responses or adapt to user
preferences. Furthermore, their software architecture is often rigid, making it difficult to
add new features or integrate with other smart home devices.

Key Problems in Traditional Smart Mirrors:


Limited interactivity : Mostly display-only functionality with minimal user
engagement.
No AI-driven assistance : Lack of intelligent responses and natural language
processing.
Weak voice recognition : Many rely on touch inputs or basic gesture controls.
Lack of personalization : Static information display without adapting to user needs.
Limited expandability : Difficult to integrate new features or smart home devices.

4.1.3 SOLUTIONS FOR THE PROBLEM

Enhanced Interactivity : Unlike traditional Smart Mirrors, this project incorporates


AI-powered voice interaction, allowing users to engage in natural language
conversations for a more interactive experience.
AI-Driven Assistance : With ChatGPT integration, the Smart Mirror can provide
intelligent responses, answer queries, and assist with tasks, transforming it from a
passive display into an active virtual assistant.
Advanced Voice Recognition : The inclusion of voice recognition and text-to-speech
technology enables hands-free operation, eliminating the need for touch inputs and
making the mirror more accessible.

13
Personalized User Experience : AI adapts to user preferences by learning from
interactions, offering tailored recommendations, reminders, and relevant real-time
updates.
Modular and Expandable Architecture : The system is built with a flexible software
framework, allowing easy integration of new features, smart home controls, and
additional AI-driven functionalities over time.
Seamless Smart Home Integration : Unlike traditional models, this Smart Mirror can
connect with IoT devices, enabling users to control lights, thermostats, and other home
automation systems through voice commands.

4.2 UML DIAGRAMS

A UML diagram for this project would likely feature a class diagram, showcasing the
various components and their relationships.The Smart Mirror class could be the central
element, interacting with other classes like Display, Microcontroller, and Information
System.The Display class would represent the television used to show the mirror's content,
while Microcontroller represents the Raspberry Pi 3 responsible for controlling the system's
logic.The Information System class could be further subdivided into classes like Weather
and Time, each responsible for specific data retrieval and display.The diagram would
depict the interactions between these classes, showing how data flows and commands are
executed to create the functional smart mirror.

4.2.1 Use Case Diagram

Use case diagrams are visual representations of how users interact with a system. They
depict the relationships between actors (people or external systems) and the use cases (the
specific tasks the system performs). Each use case represents a specific function or goal the
system helps achieve. Lines connect actors to the use cases they interact with, illustrating
the system's functionality from the user's perspective. These diagrams help understand the
system's intended purpose and how different actors will utilize it.

14
Figure 4.1 Use Case Diagram

This diagram illustrates the interaction between a user and a smart mirror system. The user
can engage with the system through several actions:

Activate Mirror : This is the first step to initiate any interaction with the system.
Speak Command : The user can communicate with the mirror by speaking a
command.
Receive Response : The mirror system processes the command and provides a
response.
View Information : The user can receive information or data displayed by the mirror.
Control Smart Home Devices : The mirror can be used to control smart home
devices.

This simple interaction model showcases the user's ability to control and receive feedback
from the smart mirror system.

15
4.3 ACTIVITY DIAGRAM
An Activity Diagram is a type of Unified Modeling Language (UML) diagram used to
represent the dynamic behavior of a system by modeling the flow of activities or actions in
a process. It illustrates how different activities or tasks are performed and the sequence of
events that lead from one activity to the next. Activity diagrams can also depict conditions
or decisions that affect the flow of control, as well as parallel processes using elements like
fork and join nodes. They provide a clear view of the overall workflow, making it easier to
understand how individual actions are linked together in a system.

Figure 4.2 Activity Diagram

These diagrams are commonly used in business process modeling, software design, and
systems analysis to document, analyze, and improve workflows. By capturing both
sequential and concurrent actions, activity diagrams are especially useful for visualizing
processes that involve multiple decision points, interactions between actors, and complex
sequences of tasks. With elements like decision nodes, initial and final nodes, and
swimlanes for separating responsibilities, activity diagrams help stakeholders comprehend
how processes work and where optimizations or improvements can be made.

16
The diagram outlines the typical workflow of a voice-activated system. It begins with the
Voice Activation step, where the system is triggered by a user's voice command or signal.
This is followed by Input Capture, where the system records the user's voice input. The
captured input is then processed in the Processing Input step to extract meaning and
identify the user's intent. Based on this understanding, the system generates an appropriate
Response in the next step. The generated response is then prepared for Display Output to
the user, which could be through text, audio, or visual means. Finally, the system enters the
User Interaction phase, waiting for the user's next action or command. This could involve
confirmation, additional input, or other feedback. The process can then loop back to the
beginning for another round of interaction, allowing for continuous engagement with the
user.

4.4 SEQUENCE DIAGRAM

Sequence diagrams are a type of interaction diagram used in software engineering to


visually represent the flow of messages between different objects or components within a
system. They depict the order in which these messages are exchanged, making it easier to
understand the interactions and dependencies between various parts of the system. Time is
represented along the vertical axis of the diagram, with the sequence of messages shown
horizontally. Each object or component is represented by a lifeline, and messages are
shown as arrows between lifelines. Sequence diagrams are particularly useful for analyzing
and designing complex interactions, such as those in distributed systems, client-server
applications, and user interfaces.

By using sequence diagrams, developers can gain a clear understanding of how different
parts of the system work together and identify potential issues or bottlenecks. They can
also be used to communicate design decisions to other stakeholders, such as clients or other
developers. In essence, sequence diagrams provide a valuable tool for visualizing and
analyzing the dynamic behavior of software systems.

Figure 4.3 Sequence Diagram

17
The sequence diagram illustrates the interaction between a User, Smart Mirror System,
and OpenAI API. The User first approaches the Smart Mirror System and triggers Voice
Activation. The system captures the voice input, processes it to understand the user's
intent, and then sends a request to the OpenAI API. The API processes the request and
sends back a response, which the Smart Mirror System receives and displays to the User.
The User can then interact with the system, providing further input or confirming the
response. The system loops back to voice activation, ready for the next user interaction.
This diagram shows the flow of messages and the sequence of actions involved in a typical
interaction with a smart mirror system using OpenAI's language model.

4.5 DATA FLOW DIAGRAM

Data Flow Diagrams (DFDs) are visual tools used in software engineering to represent the
flow of data within a system. They depict how data enters a system, is processed, stored,
and ultimately leaves the system. DFDs use a set of standard symbols to represent different
elements, such as processes (represented by circles or rounded rectangles), data stores
(represented by rectangles), data flows (represented by arrows), and external entities
(represented by squares). These symbols and their interconnections provide a clear and
concise overview of the data movement and transformation within the system.

Figure 4.4 Data Flow Diagram

18
DFDs are particularly valuable in the early stages of system development and analysis.
They help stakeholders, including developers, analysts, and clients, to understand the
overall data flow and identify potential issues or inefficiencies. By breaking down complex
systems into smaller, more manageable components, DFDs aid in system design and
implementation. They also serve as a valuable documentation tool, providing a high-level
view of the system's data processing logic.

The Data Flow Diagram (DFD) illustrates the flow of data within a smart mirror system.
The User provides voice input, which is captured and processed. The system retrieves
settings from the User Preferences data store to customize the response. The processed
input is used to generate an API Request and sent to the OpenAI API. The API processes
the request and returns a response. This response is then used to generate a Display Output
for the User, presenting the information or completing the requested task. The diagram
highlights how data moves between different components of the system, from user input to
final output, while incorporating user preferences to personalize the experience.

19
CHAPTER 5

IMPLEMENTATION AND TESTING

5.1 IMPLEMENTATION

The implementation of the AI-powered Smart Mirror begins with the hardware setup. A
two-way acrylic mirror is mounted over an LCD screen, which displays content while
maintaining reflectivity. A Raspberry Pi is configured as the core processing unit, running
the operating system and controlling all software functionalities. Additional components,
such as a USB microphone, speaker are connected via the GPIO pins to enable voice
interaction. The system is powered through a stable power supply, and the components are
enclosed in a sleek frame to resemble a standard mirror while concealing the electronics.

On the software side, the Raspberry Pi runs a lightweight Linux-based OS, with the
MagicMirror² open-source framework installed to manage the display. Custom modules
are added to show real-time information like time, weather, news, and calendar events. For
AI integration, OpenAI's ChatGPT is connected via API, allowing the system to process
user queries and provide intelligent responses. Voice recognition is handled using Python
libraries such as SpeechRecognition and PyAudio, while responses are delivered through
Google Text-to-Speech (gTTS) or similar services. The entire system is designed to run on
startup and operate autonomously, ensuring a smooth and hands-free user experience.

The Smart Mirror’s modular software design allows for easy updates and future
enhancements, such as integrating smart home device control or facial recognition for
personalized experiences. Continuous testing ensures stability, and user feedback is used to
improve usability, responsiveness, and functionality. This implementation not only meets
the goals of the project but also sets the foundation for a scalable, intelligent home
assistant.

5.2 TESTING

Coding conventions are a set of guidelines for a specific programming language that
recommend Programming style, practices and methods for each aspect of a piece program
written in this language. These conventions usually cover file organization, indentation,
comments, declarations, statements, white space, naming conventions, programming
practices, programming principles, programming rules of thumb, architectural best
practices, etc. These are guide lines for software structural quality. Software programmers
are highly recommended to follow these guidelines to help improve the readability of their
source code and make software maintenance easier.

20
5.2.1 TEST CASE

The objective of system testing is to ensure that all individual programs are working as
expected that the programs link together to meet the requirements specified and to ensure
that the computer system and the associated clerical and other procedures work together.
The initial phase of system testing is the responsibility of the analyst who determines what
conditions are to be tested, generates test data, produced a schedule of expected results,
runs the tests and compares the computer produced results with the expected results with
the expected results. The analyst may also be involved in procedures testing. When the
analyst is satisfied that the system is working properly, he hands it over to the users for
testing. The importance of system testing by the user must be stressed. Ultimately it is the
user who must verify the system and give the go-ahead.

During testing, the system is used experimentally to ensure that the software does not fail,
i.e., that it will run according to its specifications and in the way, users expect it to. Special
test data is input for processing (test plan) and the results are examined to locate
unexpected results. A limited number of users may also be allowed to use the system so
analysts can see whether they try to use it in unexpected ways. It is preferably to find these
surprises before the organization implements the system and depends on it. In many
organizations, testing is performed by person other than those who write the original
programs. Using persons who do not know how certain parts were designed or
programmed ensures more complete and unbiased testing and more reliable software.

Parallel running is often regarded as the final phase of system testing. Since he parallel
operation of two systems is very demanding in terms of user resources it should be
embarked on only if the user is satisfied with the results of testing -- it should not be started
if problems are known to exist. Testing is the major quality control measure during
software development. Its basic function is to detect errors in the software. Thus, the goal
of testing is to uncover requirement design and coding errors in the program. Testing is the
process of correcting a program with intends of finding an error. Different types of testing
are:

1. Unit Testing
2. Integrated testing
3. Validation Testing

5.2.1.1 Unit Testing

In computer programming, unit testing is a method by which individual units of source


code, sets of one or more computer program modules together with associated control
data, usage procedures, and operating procedures are tested to determine if they are fit for
use. In this testing we test each module individual and integrated the overall system. Unit
testing focuses verification efforts on the smaller unit of software design in the module.

21
This is also known as module testing. The modules of the system are tested separately. The
testing is carried out during programming stage itself. In this testing step each module is
found to working satisfactory as regard to the expected output from the module. There are
some validation checks for verifying the data input given by the user which both the formal
and validity of the entered. It is very easy to find error debug the system.

5.2.1.2 Integrated Testing

Integrated testing (sometimes called integration and testing, abbreviated I&T) is the phase
in software testing in which individual software modules are combined and tested as a
group. Software components may be integrated in an iterative way or all together ("big
bang"). Normally the former is considered a better practice since it allows interface issues
to be located more quickly and fixed. Data can be lost across an interface; one module can
have an adverse effort on the other sub functions when combined by, may not produce the
desired major functions. Integrated testing is the systematic testing for constructing the
uncover errors within the interface. This testing was done with sample data. The developed
system has run success full for this sample data. The need for integrated test is to find the
overall system performance.

Integration testing is a logical extension of unit testing. In its simplest form, two units that
have already been tested are combined into a component and the interface between them is
tested. A component, in this sense, refers to an integrated aggregate of more than one unit.
Integration testing identifies problems that occur when units are combined. By using a test
plan that require s you to test each unit and ensure the viability of each before combining
units, you know that any errors discovered when combining units are likely related to the
interface between units. This method reduces the number of possibilities to a far simpler
level of analysis. Progressively larger groups of tested software components corresponding
to elements of the architectural design are integrated and tested until the software works as
a system.

5.2.1.3 Validation Testing

At the culmination of Black Box testing, software is completely assembled as a package,


interface errors have been uncovered and corrected and final series of software tests,
Validation tests begins. Validation testing can be defined many was but a simple definition
is that validation succeeds when the software functions in a manner that can be reasonably
accepted by the customer. After validation test has been conducted one of the two possible
conditions exists.

1. The function or performance characteristics confirm to specification and are accepted.


2. A derivation from specification uncovered and a deficiency list is created.

22
5.3 RESULT

Figure 5.1

23
CHAPTER 6

CONCLUSION

This project successfully demonstrated the feasibility of creating a smart mirror with ai
using Raspberry Pi. The smart mirror was designed to provide a user-friendly interface for
accessing information and completing tasks using voice commands.The integration of AI
enabled the smart mirror to interpret natural language queries and generate relevant and
informative responses. This functionality was crucial for providing a natural and intuitive
user experience.

The project also explored the benefits of using a Raspberry Pi as the hardware platform for
the smart mirror. The Raspberry Pi's versatility and affordability made it an ideal choice
for this application. The low power consumption of the Raspberry Pi was also a significant
advantage, contributing to the overall efficiency of the smart mirror.

The project also identified potential areas for future development. This includes exploring
the integration of additional functionalities, such as facial recognition and gesture control,
to enhance the user experience further. Moreover, future research can focus on optimizing
the performance of the smart mirror by incorporating advanced AI techniques for natural
language processing and knowledge representation.

By leveraging the combined power of Raspberry Pi and AI, this project successfully
developed a functional and engaging smart mirror. The project demonstrates the potential
for AI-powered smart devices to enhance everyday living by providing convenient access to
information and services.

24
CHAPTER 7

REFERENCES

1. Piyush Maheshwari, Maninder Jeet Kaur, Sarthak Anand, “Smart Mirror: A


Reflective Interface to Maximize Productivity”, International Journal of Computer
Applications (0975 – 8887), Year: May 2017.
2. Mohammed Ghazal, Tara al Hadithy,Yyasmina al Khalil, Muhammad Akmal and
Hassan Hajjdiab, " a Mobile-programmable smart mirror for ambient IoT

environments", in 5th international conference on future internet of things and cloud


workshops, 2017.
3. Y. Sun, L. Geng and K. Dan, "Design of Smart Mirror Based on Raspberry Pi," 2018
International Conference on Intelligent Transportation, Big Data & Smart City
(ICITBS), Xiamen, 2018, pp. 77-80. doi: 10.1109/ICITBS.2018.00028.
4. M. M. Yusri et al. "Smart mirror for smart life," 2017 6th ICT International Student
Project Conference (ICT-ISPC), Skudai, 2017, pp. 1-5. doi: 10.1109/ICT-
ISPC.2017.8075339.
5. F. Ok, M. Can, H. Üçgün and U. Yüzgeç, "Smart mirror applications with raspberry
Pi," 2017 International Conference on Computer Science and Engineering (UBMK),
Antalya, 2017, pp. 94-98. doi: 10.1109/UBMK.2017.8093566.
6. Smart Mirror For Smart Lifestyle, IJARIIE-ISSN(O)- 2395-4396,Vol-4 Issue-2 2018.
7. Divyashree K J, Dr. P.A. Vijaya, Nitin Awasthi “Design And Implementation Of
Smart Mirror” As A Personal Assistant Using Raspberry Pi”.
8. IoT based Smart Mirror using Raspberry pi, International Journal for Engineering
Research and Technology (IJRET), ISSN 2278-0181, NCESC-2018 Conference
Proceedings, Special Issue-2018.
9. Salu George Thandekkattu “Smart Mirror-Network Architecture Based on Iot and

Cloud Computing Technology.


10. Si Liu, Luoqi Liu, Shuicheng Yan, Department of Electrical and Computer
Engineering National University of Singapore. 2013 Second IAPR Asian Conference
on pattern Recognition.

25
CHAPTER 8
APPENDIX
# This is a script for a text to speech bot that uses openai's chatgpt

# Imports
import speech_recognition as sr
import pyttsx3
from dotenv import load_dotenv
import openai
import time
import subprocess
from pocketsphinx import LiveSpeech

listening = False
wake_word = 'Hello'
shutoff_word = 'Thank You'
last_interaction_time = time.time()
api_key='sk-proj-bq54kE8SfBZA0dmClunakm0PZ_h3LMgm-
XqLAxeevydqCvGiR5_MeVD8gVAxt9VPeZDBO4tZU1T3BlbkFJ4Cva9vbXJolqe3K-
Nqkuve-1T97Rl5kvHbcEogIeQqCwWnxJORofPzpx5zeN55cvF9HhgAQ4IA'
openai.api_key = api_key
load_dotenv()
rec = sr.Recognizer()
messages = [ ]

# Function to get messages to gpt


def talk_to_gpt(message):
model = 'gpt-3.5-turbo'
response = openai.ChatCompletion.create(model=model,messages=message,
max_tokens=500, n=1, stop=None, temperature=0.8)
message = response.choices[0].message.content
messages.append(response.choices[0].message)
return message

# Function to speak with the specified voice


def speak(command):
subprocess.call(['espeak', '-ven-us', command])

# Function to get speech input


def get_text():
speech = LiveSpeech()
print('I am listening...')

26
for phrase in speech:
text = str(phrase)
print(text)
return text

# Function to reset the conversation


def reset_conversation():
global listening
global last_interaction_time
listening = False
last_interaction_time = time.time()
return [ ]

# To keep the conversation going


first_interaction = True
while True:
text = get_text()
if listening:
if shutoff_word in text or (time.time() - last_interaction_time) >= 35:
messages = reset_conversation()
first_interaction = True
else:
messages.append({'role': 'user', 'content': text})
response = talk_to_gpt(messages)
last_interaction_time = time.time()
print(response)
speak(response)
messages = messages[:-1]
elif first_interaction:
if wake_word in text:
listening = True
messages.append({'role': 'user', 'content': text})
response = talk_to_gpt(messages)
last_interaction_time = time.time()
print(response)
speak(response)
first_interaction = False
else:
messages.append({'role': 'user', 'content': text})
response = talk_to_gpt(messages)
last_interaction_time = time.time()
print(response)
speak(response)

27

You might also like