0% found this document useful (0 votes)
50 views36 pages

Final Project Report Combined

Uploaded by

vaishnavijapril
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views36 pages

Final Project Report Combined

Uploaded by

vaishnavijapril
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Visvesvaraya Technological University, Belagavi.

REPORT OF PROJECT WORK


on
“COGNITIVE REAL TIME STRESS LEVEL MONITORING AND
ALERTING SYSTEM”

Project Report submitted in partial fulfillment of the requirement for the award of
the degree of
Bachelor of Engineering
in
Electronics and Communication Engineering
For the academic year 2023-24

Submitted by

1CR20EC062 J VAISHNAVI
1CR20EC076 LAKSHANYA RAJASHEKAR
1CR20EC079 MANASA S

Under the guidance of


Mr. SUNIL KUMAR K H
Assistant Professor
Department of ECE
CMRIT, Bangalore
Department Of Electronics and Communication Engineering

Department of Electronics and Communication Engineering


CMR Institute of Technology, Bengaluru – 560 037
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

This is to Certify that the dissertation work “Cognitive Real Time Stress Level Monitoring and

Alerting System” carried out by Students: J Vaishnavi, Lakshanya Rajashekar, Manasa S

USN:1CR20EC062, 1CR20EC076, 1CR20EC079 bonafide students of CMRIT in partial fulfillment

for the award of Bachelor of Engineering in Electronics and Communication Engineering of the

Visvesvaraya Technological University, Belagavi, during the academic year 2023-24. It is certified

that all corrections/suggestions indicated for internal assessment have been incorporated in the report

deposited in the departmental library. The project report has been approved as it satisfies the academic

requirements in respect of Project work prescribed for the said degree.

Signature of Guide Signature of HOD Signature of Principal

_________________ _________________ _________________


Mr.Sunil Kumar KH, Dr. Pappa M Dr. Sanjay Jain,
Assistant Professor, Head of the Department, Principal,
Dept. of ECE. Dept. of ECE. CMRIT,
CMRIT, Bengaluru. CMRIT, Bengaluru. Bengaluru.
ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any
task would be incomplete without the mention of people who made it possible,
whose consistent guidance and encouragement crowned our efforts with success.

We consider it as our privilege to express the gratitude to all those who guided in
the completion of the project.

We express our gratitude to Principal, Dr. Sanjay Jain, for having provided us
the golden opportunity to undertake this project work in their esteemed
organization.

We sincerely thank Dr Pappa M, HOD, Department of Electronics and


Communication Engineering, CMR Institute of Technology for the immense
support given to me.

We express our gratitude to our project guide Mr. Sunil Kumar K H., Assistant
Professor for his support, guidance and suggestions throughout the project work.

Last but not the least, heartful thanks to our parents and friends for their support.
Table of Contents
CHAPTER 1

INTRODUCTION 1-2

CHAPTER 2

LITERATURE SURVEY 3-6

CHAPTER 3

METHODOLOGY AND IMPLEMENTATION 7

3.1 Stress Level Monitoring and Alerting system 7

3.2 Hardware and Software 8-17

3.2.1 Arduino Uno 8

3.2.2 SpO2 sensor 9

3.2.3 One wire temperature sensor 10

3.2.4 Sweat sensor 11

3.2.5 GSM module 12

3.2.6 Esp8266 wifi module 13

3.2.7 LCD display 14

3.2.8 Arduino Ide 15

3.2.9 Embedded C 16

3.3 Hardware Connections 17

CHAPTER 4

CODE IMPLEMENTATION 18-25

CHAPTER 5

RESULTS 26-27

CHAPTER 6

APPLICATIONS 28-29
CHAPTER 7

CONCLUSIONS AND SCOPE FOR FUTURE WORK 30

REFERENCES 31

List of Figures

Figure 1. Stress level monitoring and alerting system 7


Figure 2. Arduino Uno 8
Figure 3. SpO2 sensor 9
Figure 4. One wire temperature sensor 10

Figure 5. Sweat sensor 11

Figure 6. GSM module 12

Figure 7. Esp8266 wifi module 13

Figure 8. LCD display 14

Figure 9. Project prototype 26

Figure 10. Working model of the stress monitoring and alerting system 27

Figure 11. Telegram and sms messages 27


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 1

INTRODUCTION
As the population increases in the world, the ratio of health carers is rapidly decreasing.
Actually, the Organisation for Economic Co-operation and Development (OECD) warns
about future shortages of available health workers and doctors . Therefore, there is an urgent
need to create new technologies to monitor the health of people, both physical and mental,
during their daily life with the aim of supporting health workers, caregivers, and doctors in
their tasks.

These technologies, also known as Quality of Life Technologies (QoLTs), have emerged
as the concept of applying findings from different technological areas to assist people and
improve their quality of life. An emerging research topic inside QoLTs is their application
to psychology and self-therapy to improve the mood of people and thus, their quality of
life. Although there exist several technologies to support the health of people at the
physiological level, the technologies that are able to provide similar support at the mental
level are almost inexistent.

Treating negative mental states in people is becoming a priority in our new societies. In
particular, stress is a big problem in modern populations due to the increment of stressful
situations during everyday activities including work. Stress is a natural reaction of the
human body to an outside perturbing factor.

The physiological responses to stress are correlated with variations in heart rate, blood
volume pulse, skin temperature, pupil dilation, electro-dermal activity Stress may have
beneficial effects on fighting the stress factor, like increasing reflexes, but it was
determined that long term stress is correlated with various health problems like depression
and premature ageing . Stress is creating new problems that have a great impact in our
societies and economies.

In the proposed system, a model is designed to monitor the heartbeat rate, blood pressure,
temperature and humidity and respiration using various sensors which will be will be
uploaded to the server through WIFI module. A message could be sent to concerned person
or doctor through GSM module. The model consumes less power and is designed to detect
the level of stress with good efficiency .

Department of ECE, CMRIT, Bangalore 2023-24 1


Cognitive Real Time Stress Level Monitoring and Alerting System

Problem statement

• Treating negative mental states in people is becoming a priority in our new


societies.
• In particular, stress is a big problem in modern populations due to the increment of
stressful situations during everyday activities including work.
• Stress is a natural reaction of the human body to an outside perturbing factor.
• The physiological responses to stress are correlated with variations in heart rate,
blood volume pulse, skin temperature, pupil dilation, electro-dermal activity . Stress
may have beneficial effects on fighting the stress factor, like increasing reflexes,
but it was determined that long term stress is correlated with various health
problems like depression and premature ageing .
• Stress is creating new problems that have a great impact in our societies and
economies.

Department of ECE, CMRIT, Bangalore 2023-24 2


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 2
LITERATURE SURVEY
1) Stress Detection in Daily Life Scenarios Using Smart Phones and Wearable Sensors

Stress has become a significant cause for many diseases in the modern society. Recently,
smartphones, smartwatches and smart wrist-bands have become an integral part of our lives
and have reached a widespread usage. This raised the question of whether we can detect
and prevent stress with smartphones and wearable sensors. In this survey, we will examine
the recent works on stress detection in daily life which are using smartphones and wearable
devices. Although there are a number of works related to stress detection in controlled
laboratory conditions, the number of studies examining stress detection in daily life is
limited. We will divide and investigate the works according to used physiological modality
and their targeted environment such as office, campus, car and unrestricted daily life
conditions. We will also discuss promising techniques, alleviation methods and research
challenges.

2) Towards an automatic early stress recognition system for office environments


based on multimodal measurements: A review

Stress is a major problem of our society, as it is the cause of many health problems and
huge economic losses in companies. Continuous high mental workloads and non-stop
technological development, which leads to constant change and need for adaptation, makes
the problem increasingly serious for office workers. To prevent stress from becoming
chronic and provoking irreversible damages, it is necessary to detect it in its early stages.
Unfortunately, an automatic, continuous and unobtrusive early stress detection method
does not exist yet. The multimodal nature of stress and the research conducted in this area
suggest that the developed method will depend on several modalities. Thus, this work
reviews and brings together the recent works carried out in the automatic stress detection
looking over the measurements executed along the three main modalities, namely,
psychological, physiological and behavioural modalities, along with contextual
measurements, in order to give hints about the most appropriate techniques to be used and
thereby, to facilitate the development of such a holistic system.

Department of ECE, CMRIT, Bangalore 2023-24 3


Cognitive Real Time Stress Level Monitoring and Alerting System

3) Stress Detection in Computer Users Based on Digital Signal Processing of


Noninvasive Physiological Variables

A stress detection system is developed based on the physiological signals monitored by


non-invasive and non-intrusive sensors. The development of this emotion recognition
system involved three stages: experiment setup for physiological sensing, signal
preprocessing for the extraction of affective features and affective recognition using a
learning system. Four signals: Galvanic Skin Response (GSR), Blood Volume Pulse
(BVP), Pupil Diameter (PD) and Skin Temperature (ST) are monitored and analyzed to
differentiate affective states in a computer user. A Support Vector Machine is used to
perform the supervised classification of affective states between “stress” and “relaxed”.
Results indicate that the physiological signals monitored do, in fact, have a strong
correlation with the changes in emotional state of our experimental subjects when stress
stimuli are applied to the interaction environment. It was also found that the pupil diameter
was the most significant affective state indicator, compared to the other three physiological
signals monitored.

4) EmoSense: An Ambulatory Device for the Assessment of ANS Activity—


Application in the Objective Evaluation of Stress With the Blind

Analysis of autonomic nervous system activity is a subject of increasing interest in the


fields of health care and handicap management, as it provides information on the emotional,
sensorial, and cognitive states of the patient. In this context, the simultaneous measurement
of several physiological signals using small, discreet, mobile devices is required, in order
to unobtrusively obtain such information under real-life conditions. We have therefore
developed an ambulatory device which enables the measurement of heart rate,
electrodermal activity, and skin temperature with noninvasive sensors. Wireless
communication and local data storage on a memory card enables the device to be used
during in-situ experiments for the analysis of autonomic nervous system activity. We have
used this instrumentation in a study for the objective evaluation of stress in the blind when
walking in urban space, through the analysis of electrodermal activity of blind pedestrians
who independently followed a charted course involving a range of urban conditions.
Experimenting in real-life settings has lead to the definition of novel, more pertinent
parameters for the analysis of physiological signals in the study of autonomic nervous
system activity. Results from these experiments have identified, for the first time, some
rather surprising obstacles or events which give rise to an increased stress for the blind.

Department of ECE, CMRIT, Bangalore 2023-24 4


Cognitive Real Time Stress Level Monitoring and Alerting System

These results were very encouraging for the use of such ambulatory devices for experiments
under reallife conditions.

5) Design and Implementation of a wireless healthcare system based on Galvanic Skin


Response

Electrocardiography response (ECG) and Electroencephalography response (EEG) have


been often applied in modern medical field. With the development of modern medicine,
Galvanic skin response (GSR) also has becoming a reliable medical diagnosis. This paper
presents the design and implementation of a novel medical healthcare system which use
GSR as the relaxation factor. The system adopts wireless RF module PTR8000 to transmit
the measurement data between the primary stage and the subordinate stage. The
subordinate stage collects the GSR signal and converts analog signal into a digital signal,
then sends it away; the primary stage receives the data, then stores and displays them.
The paper illustrated the principle of wireless GSR healthcare system, its main
components, and the flow chart of the system. Experiments have demonstrated that our
system is reliable and useful in the healthcare field.

6) Feasibility study on drivers stress detection from differential skin temperature


measurement

Prolonged monotonous driving may lower a driver's awareness level as well as increasing
their stress level due to the compulsion to maintain safe driving, which may result in an
increased risk of a traffic accident. There is therefore an opportunity for technological
assessment of driver physiological status to be applied in-car, hopefully reducing the
incidence of potentially dangerous situations. As part of our long-term aim to develop such
a system, we describe here the investigation of differential skin temperature measurement
as a possible marker of a driver's stress level. In this study, healthy male (n=18) & female
(n=7) subjects were investigated under environment-controlled conditions, whilst being
subjected to simulated monotonous travel at constant speed on a test-course. We acquired
physiological variables, including facial skin temperature which consists of truncal and
peripheral skin temperatures (T s ) using thermography, beat-by-beat blood pressure (BP),
cardiac output (CO), total peripheral resistance (TPR), and normalized pulse volume (NPV)
used as an indicator of local peripheral vascular tone. We then investigated the driver's
reactivity in terms of skin temperatures with this background of cardiovascular
haemodynamics. We found that the simulated monotonous driving produced a gradual drop

Department of ECE, CMRIT, Bangalore 2023-24 5


Cognitive Real Time Stress Level Monitoring and Alerting System

in peripheral T s following the driving stress, which, through interpretation of the TPR and
NPV recordings, could be explained by peripheral sympathetic activation. On the other
hand, the truncal T s was not influenced by the stress. These findings lead us to suggest that
truncal-peripheral differential T s could be used as a possible index indicative of the driver's
stress.

7) A stress-detection system based on physiological signals and fuzzy logic

A stress-detection system is proposed based on physiological signals. Concretely, galvanic


skin response (GSR) and heart rate (HR) are proposed to provide information on the state
of mind of an individual, due to their nonintrusiveness and noninvasiveness. Furthermore,
specific psychological experiments were designed to induce properly stress on individuals
in order to acquire a database for training, validating, and testing the proposed system. Such
system is based on fuzzy logic, and it described the behavior of an individual under
stressing stimuli in terms of HR and GSR. The stress-detection accuracy obtained is 99.5%
by acquiring HR and GSR during a period of 10 s, and what is more, rates over 90% of
success are achieved by decreasing that acquisition period to 3-5 s. Finally, this paper
comes up with a proposal that an accurate stress detection only requires two physiological
signals, namely, HR and GSR, and the fact that the proposed stress-detection system is
suitable for real-time applications.

Department of ECE, CMRIT, Bangalore 2023-24 6


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 3
METHODOLOGY AND IMPLEMENTATION
3.1 Stress Level Monitoring and Alerting System

Figure1. Stress Level Monitoring and Alerting System

The block diagram consists of microcontroller Arduino Uno, wifi-module ESP8266 and
the sensors blood pressor sensor, SpO2 sensor, One wire temperature sensor, Sweat sensor.

The main objective is to send the normal health and stress level condition messages to an
individual’s mobile phone who is wearing the device. The sensors will record the

conditions and send the regular data to telegram via Esp8266 wifi module and send only
the stress level condition sms via the GSM module.

Department of ECE, CMRIT, Bangalore 2023-24 7


Cognitive Real Time Stress Level Monitoring and Alerting System

3.2 Hardware and Software

Hardware

• Arduino Uno
• Blood pressure sensor
• SpO2 sensor
• Sweat sensor
• One wire temperature sensor
• Esp8266 wifi module
• GSM module

Software

• Arduino Ide
• Embedded C

3.2.1 Arduino Uno

Figure 2. Arduino Uno

The Arduino Uno is microcontroller development board. The Arduino Uno is based on the
ATmega328P microcontroller. It operates at 16 MHz and has 32 KB of flash memory for
program storage, 2 KB of SRAM for data storage, and 1 KB of EEPROM for non-volatile
data storage. The board features 14 digital input/output (I/O) pins, labeled from 0 to 13.
These pins can be used for various purposes, including reading digital sensors and
controlling external devices. There are 6 analog input pins labeled A0 through A5. These
pins can read analog signals from sensors, potentiometers, and other analog sources.

The Arduino Uno can be powered in several ways through the USB connection to a
computer. An external power supply (7-12V) can be connected to the board via the DC jack

Department of ECE, CMRIT, Bangalore 2023-24 8


Cognitive Real Time Stress Level Monitoring and Alerting System

or the Vin pin.- Battery: A rechargeable battery or other power source can be connected to
the board's power input.

The board includes a voltage regulator that provides a stable 5V supply to power the
microcontroller and other components on the board. The Arduino Uno has a USB Type-B
connector that allows it to connect to a computer for programming and serial
communication. It uses the USB-to-Serial (UART) interface to communicate with the
computer. A 16 MHz crystal oscillator is used to provide precise timing for the
microcontroller. The board has a reset button that can be pressed to restart the program
running on the microcontroller. There are built-in LEDs on the board, including a power
LED, a built-in LED on pin 13, and a transmit/receive LED for serial communication.

The Arduino Uno is the main controller in our project.

3.2.2 SpO2 sensor

Figure 3. SpO2 sensor

The MAX30100 is a pulse oximeter and heart-rate sensor module designed by Maxim
Integrated. It integrates two key functions into a single package: a red and infrared (IR)
LED for measuring oxygen saturation (SpO2) and a photodetector for measuring the heart
rate.

The MAX30100 module typically includes two LEDs, one emitting red light (typically
around 660nm) and the other emitting infrared light (typically around 940nm). These LEDs
are used to illuminate the blood vessels in the tissue being monitored. The module also
contains a photodetector, which detects the amount of light transmitted or reflected back
from the tissue. Changes in the amount of light detected are caused by variations in blood
volume, such as those that occur with each heartbeat. The MAX30100 module incorporates
an integrated circuit (IC) that contains the signal processing circuitry necessary to process
the raw data from the LEDs and photodetector. This IC typically includes analog front-end
circuitry, a digital signal processor (DSP), and other components needed for data
processing.

Department of ECE, CMRIT, Bangalore 2023-24 9


Cognitive Real Time Stress Level Monitoring and Alerting System

The MAX30100 communicates with an external microcontroller or other host device using
the Inter-Integrated Circuit (I2C) serial communication protocol. This allows the host
device to control the operation of the module and retrieve the measured data. The
MAX30100 is designed for low-power operation, making it suitable for battery-powered
and portable applications such as wearable devices and fitness trackers. The module is
typically housed in a small, compact package, making it easy to integrate into various
electronic devices and wearable gadgets. The MAX30100 is designed to provide accurate
measurements of oxygen saturation (SpO2) and heart rate, making it suitable for medical
and healthcare applications where precise monitoring is required. While the primary
application of the MAX30100 is pulse oximetry and heart-rate monitoring, it can also be
used for other optical sensing applications, such as detecting changes in blood flow and
tissue perfusion. Maxim Integrated provides comprehensive documentation, application
notes, and software libraries to support developers in integrating the MAX30100 module
into their designs and applications.

3.2.3 One wire temperature sensor

Figure 4. One wire temperature sensor

The One Wire Temperature Sensor, often referred to as the DS18B20, is a popular digital
temperature sensor that communicates over a single wire (plus ground).

The DS18B20 temperature sensor utilizes a digital communication protocol known as One
Wire, developed by Maxim Integrated. This protocol allows multiple sensors to be
connected to a single microcontroller pin, simplifying wiring and reducing the number of
required I/O pins.The DS18B20 is capable of accurately measuring temperature over a wide
range, typically from -55°C to +125°C (-67°F to +257°F). It provides temperature readings
with a resolution of 9 to 12 bits, allowing for precise measurement in small increments.Each
DS18B20 sensor is factory-programmed with a unique 64-bit serial number, which serves

Department of ECE, CMRIT, Bangalore 2023-24 10


Cognitive Real Time Stress Level Monitoring and Alerting System

as a unique identifier. This allows multiple sensors to be connected to the same One Wire
bus without the need for manual addressing.

The DS18B20 can operate in a parasitic power mode, where it draws power from the data
line during temperature conversions and communication. This simplifies wiring by
requiring only two connections (data and ground) to the sensor.The sensor requires a certain
amount of time to perform temperature conversions, which typically ranges from 94
milliseconds to 750 milliseconds depending on the resolution selected (9 to 12 bits). During
this time, the sensor is not responsive to communication commands.The DS18B20 is
compatible with a wide range of microcontrollers, including Arduino, Raspberry Pi, and
many others. It is supported by various libraries and code examples available online,
making it easy to integrate into projects and applications.

The DS18B20 sensor offers high accuracy and stability over time, with low temperature
drift and minimal calibration requirements. This makes it suitable for precision temperature
measurement applications where reliability is crucial.

3.2.4 Sweat sensor

Figure 5. Sweat sensor

Sweat sensors are devices used to measure the sweat level produced by an individual.

The main component of a sweat sensor is the probe or sensing element. This probe contains
electrodes or other sensing elements to measure the moisture content. The capacitive
sensors typically consist of two electrodes separated by a dielectric material. As moisture
increases, the dielectric constant changes, altering the capacitance between the electrodes.

Department of ECE, CMRIT, Bangalore 2023-24 11


Cognitive Real Time Stress Level Monitoring and Alerting System

3.2.5 GSM Module

Figure 6. GSM Module

The GSM Module 800A is a communication device that enables the transmission and
reception of data over the Global System for Mobile Communications (GSM) network. The
GSM Module 800A adheres to the GSM standard, which is the most widely used cellular
network technology globally for voice and data communication. It operates on various
frequency bands allocated for GSM networks, depending on regional regulations and
compatibility.

The core component of the GSM Module 800A is the GSM modem, which incorporates
the necessary circuitry and components for transmitting and receiving data over the GSM
network. This includes a radio transceiver, baseband processor, SIM card interface, and
antenna connection. The module typically includes a SIM card slot for inserting a
Subscriber Identity Module (SIM) card, which is essential for authenticating the device on
the GSM network and enabling access to cellular services. The module is equipped with an
antenna connector to connect an external GSM antenna for transmitting and receiving radio
signals efficiently. The antenna's design and placement are crucial for optimizing signal
strength and coverage. The GSM Module 800A communicates with external devices, such
as microcontrollers or computers, via a serial interface (e.g., UART) using standard AT
commands. This interface allows the external device to control the module's operation and
send/receive data over the GSM network.

The GSM Module 800A supports voice communication capabilities, allowing users to
make and receive phone calls over the GSM network. It can be integrated into various

Department of ECE, CMRIT, Bangalore 2023-24 12


Cognitive Real Time Stress Level Monitoring and Alerting System

applications requiring voice communication functionality. The module enables Short


Message Service (SMS) messaging, allowing users to send and receive text messages over
the GSM network. SMS functionality is commonly used for notifications, alerts, and remote
control applications. The module facilitates data transmission over the GSM network,
enabling applications such as remote monitoring, telemetry, asset tracking, and Internet of
Things (IoT) connectivity. It supports both circuit-switched data (e.g., GPRS) and packet-
switched data (e.g., SMS, TCP/IP).The module handles the process of network registration
and authentication, establishing a connection with the GSM network by authenticating the
SIM card and obtaining network access privileges.

The GSM Module 800A requires a stable power supply voltage within the specified range
(e.g., 3.3V or 5V) to operate reliably. It consumes power during active transmission and
reception, as well as in standby mode when idle.

Integrating the GSM Module 800A into a specific application requires interfacing with a
microcontroller or other control device using standard AT commands via the serial
interface. Programming the module involves sending AT commands to control its
operation, configure settings, and handle communication tasks.

3.2.6 ESP8266 wifi module

Figure 7. Esp8266 wifi module

The ESP8266 WiFi module is a popular and versatile device for adding wireless
connectivity to electronic projects and Internet of Things (IoT) applications. The ESP8266
is not just a WiFi module; it also contains a powerful microcontroller unit (MCU) based on
the Tensilica Xtensa LX106 architecture. This MCU enables standalone operation and can
execute user-programmed tasks, making it suitable for IoT applications that require both
WiFi connectivity and processing capabilities.

Department of ECE, CMRIT, Bangalore 2023-24 13


Cognitive Real Time Stress Level Monitoring and Alerting System

The ESP8266 module includes built-in WiFi functionality, allowing it to connect to


wireless networks and communicate with other devices over the internet. It supports both
station (client) and access point (AP) modes, enabling it to connect to existing WiFi
networks or create its own network for other devices to connect to.The primary method of
communication with the ESP8266 module is through a serial interface, typically UART
(Universal Asynchronous Receiver-Transmitter). Users send commands and data to the
module via serial communication, and the module responds accordingly.

The ESP8266 module features a number of General Purpose Input/Output (GPIO) pins,
which can be used to interface with external sensors, actuators, and other peripherals. These
pins can be configured as digital inputs or outputs and can also support functions such as
PWM (Pulse Width Modulation). The module contains onboard flash memory for storing
firmware, configuration data, and user programs. The amount of available flash memory
varies depending on the specific variant of the ESP8266 module, with options ranging from
a few hundred kilobytes to several megabytes.

3.2.7 LCD display

Figure 8. LCD display

An LCD, or Liquid Crystal Display, is a flat-panel display technology commonly used in


various electronic devices to provide visual information.

LCDs contain liquid crystal molecules that can change orientation in response to an applied
electric field. These molecules act as shutters to control the passage of light.Most LCDs
have a backlight source, such as LEDs (Light-Emitting Diodes) .

Department of ECE, CMRIT, Bangalore 2023-24 14


Cognitive Real Time Stress Level Monitoring and Alerting System

3.2.8 Arduino Ide

The Arduino Integrated Development Environment (IDE) is a software application used to


write, compile, and upload code to Arduino-compatible microcontroller boards. It provides
a user-friendly interface that simplifies the process of creating projects for Arduino-based
hardware.

The IDE includes a text editor where you write your Arduino code. It supports syntax
highlighting, auto-indentation, and code completion features, making it easier to write and
edit code.In the Arduino world, programs are called "sketches." Each sketch consists of
two essential functions: `setup()` and `loop()`. The `setup()` function is called once when
the Arduino is powered on or reset, while the `loop()` function runs continuously after
`setup()` completes. The IDE allows you to create, save, and manage multiple sketches for
different projects.

The IDE features a built-in compiler that translates the Arduino code (written in C/C++)
into machine-readable instructions for the microcontroller. When you click the "Verify"
button, the IDE compiles your code to check for syntax errors and generates a compiled
binary file (with a `.hex` extension) ready for uploading to the Arduino board.

Arduino IDE comes with a library manager that allows you to easily add and manage
libraries for your projects. Libraries are collections of pre-written code that extend the
functionality of Arduino by providing additional features and functions. The manager lets
you search, install, and update libraries directly from within the IDE. This tool allows you
to communicate with the Arduino board via the serial port. It displays messages sent by the
Arduino via `Serial.print()` or `Serial.println()` statements in your code. This is invaluable
for debugging and monitoring the behavior of your sketch at runtime.

Arduino IDE supports various Arduino-compatible boards, each with its own specifications
and configurations. The Board Manager enables you to select the appropriate board from a
list and install the necessary drivers and board definitions for programming it.Once you've
written and verified your code, you can upload it to the Arduino board using the Upload
button. The IDE communicates with the board via a USB connection (or other supported
interfaces) to transfer the compiled binary file to the microcontroller's flash memory,
making your code executable.

Department of ECE, CMRIT, Bangalore 2023-24 15


Cognitive Real Time Stress Level Monitoring and Alerting System

3.2.9 Embedded C
Embedded C is a variant of the C programming language that is specifically tailored for
programming embedded systems. Embedded systems are computing devices that are
designed to perform dedicated functions within a larger mechanical or electrical system.
These systems typically have constrained resources such as limited memory, processing
power, and sometimes power consumption requirements. Embedded C is optimized for
such environments, allowing developers to write efficient and portable code for embedded
systems.
Embedded C is designed to be highly efficient in terms of both memory usage and
execution speed. It allows developers to write code that minimizes resource usage, making
it suitable for systems with limited hardware capabilities.
Embedded C provides low-level access to hardware peripherals and registers, allowing
developers to directly manipulate hardware components such as GPIO pins, timers,
UARTs, and ADCs. This level of control is essential for interfacing with sensors, actuators,
and other external devices commonly found in embedded systems.
Many embedded systems require real-time responsiveness, where tasks must be completed
within specific time constraints to ensure proper system operation. Embedded C allows
developers to write code that meets real-time requirements by carefully managing timing,
interrupts, and task scheduling.
Embedded C allows developers to interact with on-chip peripherals and external hardware
devices using a variety of communication protocols such as SPI (Serial Peripheral
Interface), I2C (Inter-Integrated Circuit), UART (Universal Asynchronous Receiver-
Transmitter), and CAN (Controller Area Network).

Department of ECE, CMRIT, Bangalore 2023-24 16


Cognitive Real Time Stress Level Monitoring and Alerting System

3.3 Hardware Connections


1) Arduino Uno – Power supply: +5v and ground connection
2) Lcd: Pin1 +5v, Pin2 ground, Pin3 potentiometer, Pin4 (Rs) Digital8, Pin5(R/W) ground,
Pin6(enable) Digital9, D4 Digital13, D5 Digital12, D6 Digital11, D7 Digital10, +5v,
ground.
3) Esp8266 wifi module: +5v and ground connection, Tx Digital6, Rx Digital7.
4) Bp sensor: +5v and ground, O7data Analog0.
5) Spo2 sensor: +5v and ground, Scl and Sda.
6) One wire temperature sensor: +5v and ground, data Digital2.
7) Moisture sensor: +5v and ground, data Analog2.
8) GSM module: +12v, ground, Tx Digital0, Rx Digital1.

Department of ECE, CMRIT, Bangalore 2023-24 17


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 4
Code Implementation
#include <LiquidCrystal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float temperature;
char ch;
const int rs = 8, en = 9, d4 =13 , d5 = 12, d6 = 11, d7 = 10;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

#include <SoftwareSerial.h>

SoftwareSerial NodemcuSerial(6, 7);

int data=A0;//heartbeat sensor


int count=0;

int a,b,c;
int Sweat_val;

char mystr[20];

unsigned long temp=0;


byte customChar1[8] =
{0b00000,0b00000,0b00011,0b00111,0b01111,0b01111,0b01111,0b01111};
byte customChar2[8] =
{0b00000,0b11000,0b11100,0b11110,0b11111,0b11111,0b11111,0b11111};
byte customChar3[8] =
{0b00000,0b00011,0b00111,0b01111,0b11111,0b11111,0b11111,0b11111};
byte customChar4[8] =
{0b00000,0b10000,0b11000,0b11100,0b11110,0b11110,0b11110,0b11110};
byte customChar5[8] =
{0b00111,0b00011,0b00001,0b00000,0b00000,0b00000,0b00000,0b00000};
byte customChar6[8] =
{0b11111,0b11111,0b11111,0b11111,0b01111,0b00111,0b00011,0b00001};
byte customChar7[8] =
{0b11111,0b11111,0b11111,0b11111,0b11110,0b11100,0b11000,0b10000};
byte customChar8[8] =
{0b11100,0b11000,0b10000,0b00000,0b00000,0b00000,0b00000,0b00000};

Department of ECE, CMRIT, Bangalore 2023-24 18


Cognitive Real Time Stress Level Monitoring and Alerting System

#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
// Timer variables
unsigned long lastTime = 0;
unsigned long timerDelay = 30000;

float BPM, SpO2,BP;

PulseOximeter pox;
uint32_t tsLastReport = 0;

//char ch;
void Init_spo2();

void onBeatDetected()
{
Serial.println("Beat Detected!");
}

void SEND_SMS(String num, String str );

void setup()
{
pinMode(data,INPUT);

lcd.createChar(1, customChar1);
lcd.createChar(2, customChar2);
lcd.createChar(3, customChar3);
lcd.createChar(4, customChar4);
lcd.createChar(5, customChar5);
lcd.createChar(6, customChar6);
lcd.createChar(7, customChar7);
lcd.createChar(8, customChar8);
NodemcuSerial.begin(9600);
Serial.begin(9600);

lcd.begin(16, 2);
lcd.clear();
lcd.print(" Stress ");
lcd.setCursor(0,1);
lcd.print(" Monitoring S/M ");
Serial.println("Stress Monitoring");

Serial.print("Initializing pulse oximeter..");

Department of ECE, CMRIT, Bangalore 2023-24 19


Cognitive Real Time Stress Level Monitoring and Alerting System

if (!pox.begin()) {
Serial.println("FAILED");
for (;;);
} else {
Serial.println("SUCCESS");

pox.setOnBeatDetectedCallback(onBeatDetected);
}

pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);

SEND_SMS("+918197526429","Stress Monitoring System...");


delay(2000);
}

void Init_spo2()
{
Serial.print("Initializing pulse oximeter..");
if (!pox.begin()) {
Serial.println("FAILED");
for (;;);
} else {
Serial.println("SUCCESS");

pox.setOnBeatDetectedCallback(onBeatDetected);
}

pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);

}
void loop()
{

int i=0;
while(i<10000)
{
pox.update();
BP = pox.getHeartRate();
SpO2 = pox.getSpO2();

if (millis() - tsLastReport > REPORTING_PERIOD_MS)


{
//
Serial.print("BP: ");
Serial.println(BP);
Serial.print("SpO2: ");
Serial.print(SpO2);

Department of ECE, CMRIT, Bangalore 2023-24 20


Cognitive Real Time Stress Level Monitoring and Alerting System

Serial.println("%");

NodemcuSerial.begin(9600);
NodemcuSerial.print("$BP: ");
NodemcuSerial.print(BP);
NodemcuSerial.println('#');

NodemcuSerial.print("$SpO2: ");
NodemcuSerial.print(SpO2);
NodemcuSerial.println('#');

lcd.clear();
lcd.print("BP:");
lcd.print(BP);
lcd.setCursor(0,1);
lcd.print("Spo2:");
lcd.print(SpO2); // print the temperature in °C
lcd.print("%");

Serial.println("***********");
Serial.println();

tsLastReport = millis();
}
// delay(500);
i++;
}
// if(SpO2<50)
// {
// a=1;
// lcd.clear();
// lcd.setCursor(0,0);
// lcd.print("Spo2 is Low");
// SEND_SMS("+918197526429","Spo2 is Low");
// delay(2000);
// }
if(BP>120)
{
a=1;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("BP is More");
SEND_SMS("+918197526429","Bp is More");
delay(2000);
}
Temp_check();
HEART_BEAT_MONITOR();
SWEAT_MONITORING();

Department of ECE, CMRIT, Bangalore 2023-24 21


Cognitive Real Time Stress Level Monitoring and Alerting System

lastTime = millis();
// }
}
void Temp_check()
{
sensors.requestTemperatures();
temperature = sensors.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.println(temperature);
lcd.clear();
lcd.print("Temp: ");
lcd.print(temperature);
NodemcuSerial.begin(9600);
NodemcuSerial.print("$Temp: ");
NodemcuSerial.print(temperature);
NodemcuSerial.println('#');
delay(1000);

if(temperature>34)
{
b=1;
lcd.clear();
lcd.print("More Temperature");
lcd.setCursor(0,1);
lcd.print("Detected");
SEND_SMS("+918197526429","More Temperature Detected");
delay(2000);

}
void SWEAT_MONITORING()
{

Sweat_val=analogRead(A1);
Sweat_val=1023-Sweat_val;

lcd.clear();
lcd.print("Sweat:");
lcd.print(Sweat_val);
Serial.print("Sweat:");
Serial.print(Sweat_val);
Serial.println("");
NodemcuSerial.begin(9600);
NodemcuSerial.print("$Sweat: ");
NodemcuSerial.print(Sweat_val);

Department of ECE, CMRIT, Bangalore 2023-24 22


Cognitive Real Time Stress Level Monitoring and Alerting System

NodemcuSerial.println('#');

delay(1000);

if(Sweat_val<400)
{
c=1;
lcd.clear();
lcd.print("Sweat Detected");
Serial.println("Sweat Detected");
SEND_SMS("+918197526429","Sweat Detected");
delay(2000);
}
Init_spo2();
}
void HEART_BEAT_MONITOR()
{

count=0;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Place The Finger");
lcd.setCursor(0, 1);
lcd.print("to check HB");
// Serial.println("Place The Finger to check HB");
delay(2000);
// while(digitalRead(start)>0);

lcd.clear();
temp=millis();

while(millis()<(temp+5000))
{

if(analogRead(data)<100)
{
count=count+1;

lcd.setCursor(6, 0);
lcd.write(byte(1));
lcd.setCursor(7, 0);
lcd.write(byte(2));
lcd.setCursor(8, 0);
lcd.write(byte(3));
lcd.setCursor(9, 0);
lcd.write(byte(4));

lcd.setCursor(6, 1);

Department of ECE, CMRIT, Bangalore 2023-24 23


Cognitive Real Time Stress Level Monitoring and Alerting System

lcd.write(byte(5));
lcd.setCursor(7, 1);
lcd.write(byte(6));
lcd.setCursor(8, 1);
lcd.write(byte(7));
lcd.setCursor(9, 1);
lcd.write(byte(8));

while(analogRead(data)<100);
//
lcd.clear();
}
}

lcd.clear();
lcd.setCursor(0, 0);
count=count*5;
// count=map(count,0,1023,0,130);
lcd.setCursor(2, 0);
lcd.write(byte(1));
lcd.setCursor(3, 0);
lcd.write(byte(2));
lcd.setCursor(4, 0);
lcd.write(byte(3));
lcd.setCursor(5, 0);
lcd.write(byte(4));

lcd.setCursor(2, 1);
lcd.write(byte(5));
lcd.setCursor(3, 1);
lcd.write(byte(6));
lcd.setCursor(4, 1);
lcd.write(byte(7));
lcd.setCursor(5, 1);
lcd.write(byte(8));
lcd.setCursor(7, 1);
if(count>130)
count=65;
lcd.print(count);
lcd.print(" BPM");
temp=0;

//delay(1000);
sprintf(mystr, "HB:%d", count);
Serial.print('$');
Serial.print(mystr);
Serial.println("#");

Department of ECE, CMRIT, Bangalore 2023-24 24


Cognitive Real Time Stress Level Monitoring and Alerting System

NodemcuSerial.begin(9600);
NodemcuSerial.print("HB: ");
NodemcuSerial.print(mystr);
NodemcuSerial.println('#');
delay(1000);
if((count>120)&&(a==1)&&(b==1)&&(c==1))
{
a=0;
b=0;
c=0;
lcd.clear();
lcd.print("Stress Detected...");
SEND_SMS("+918197526429","Stress Detected");
delay(2000);
}

}
void SEND_SMS(String num, String str )
{
Serial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second

Serial.print("AT+CMGS=\""); // Send the SMS number


Serial.print(num);
Serial.println("\"");
delay(1000);

Serial.println(str);// The SMS text you want to send


delay(100);

Serial.println((char)26);// ASCII code of CTRL+Z


delay(1000);

Serial.println("SMS Sent..");

Department of ECE, CMRIT, Bangalore 2023-24 25


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 5
RESULTS
The main aim of our project is to send regular health data and stress level data to the
individual who is wearing the device.
The regular health data is sent to the telegram account which has an id number and
password. The stress level data and alert messages are sent to the person’s mobile phone
through sms.
The following are the pictures of the project prototype:

Figure 9. Project Prototype

Department of ECE, CMRIT, Bangalore 2023-24 26


Cognitive Real Time Stress Level Monitoring and Alerting System

Figure 10. Working model of the stress monitoring and alerting system

The following are pictures of the telegram and sms messages :

Figure 11. Telegram and Sms messages

Department of ECE, CMRIT, Bangalore 2023-24 27


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 6

APPLICATIONS
In recent years, the physiological computing literature has proposed various systems for
automatic emotion detection using the physiological signals discussed in the previous
sections. In many cases, their purpose is not limited to stress detection: many of them are
designed to recognize a wide variety of emotions, such as joy and surprise. To highlight the
practical utility of stress detection systems in real-world computer applications, we provide
some examples from both the literature and our own research work in the following.

• Exposure therapy and biofeedback: By “feeding back” information to users about their
affective state, biofeedback applications enable users to learn how to change physiological
activity for the purposes of improving health and performance. Exposure therapy is a
technique intended to treat anxiety disorders and involves progressive exposure to the
feared object or context in order to inhibit fear and overcome anxiety. Virtual reality
exposure therapy (VRET) has been proposed in the literature as an efficient and cost-
effective alternative to in-vivo exposure for the treatment of anxiety disorders. For
example, VE simulators of flying on airplanes are used to treat aviophobia (fear of flying),
while simulators of combat settings (such as Virtual Iraq and Virtual Afghanistan) are used
to treat soldiers who suffer from posttraumatic stress disorder (PTSD). VRET applications
could exploit biofeedback for real-time monitoring of affective states in patients with
anxiety disorders, providing valuable information to therapists and allowing for a more
tailored and personalized treatment, e.g., by dynamically adapting the experience to elicit
the desired level of stress in patients.

• Training and biofeedback: Training supports the acquisition of knowledge, competence


and skills through direct or indirect experience. During emergency training, for example,
first responders can learn how to provide medical care by being immersed in VEs that
accurately replicate, possibly on a large scale, a dangerous environment. Training can also
help people to develop coping skills to reduce anxiety and to maintain an optimal level of
performance under stress. This particular method is called stress inoculation training (SIT).

• Performance and health monitoring of workers: Various studies in the literature observed
a relationship between stress and performance. Automatic stress detection systems could

Department of ECE, CMRIT, Bangalore 2023-24 28


Cognitive Real Time Stress Level Monitoring and Alerting System

detect workers’ stress level and, for example, may be integrated into PCs in the workplace
to dynamically manipulate the state of applications and adapt workload to workers’ stress,
or to exploit this information to provide user assistance in the form of suggestions or
support. Real-time information about workers’ stress level is particularly relevant in
emergency situations. Stress detection can enhance geo-collaboration between team
members during mass emergencies (e.g., by identifying a critical state in team members
and plan their help), with particular focus on soldiers and first responders. Such applications
of stress detection, which are useful in real-life human collaboration, may be included also
in emergency training simulations.

Department of ECE, CMRIT, Bangalore 2023-24 29


Cognitive Real Time Stress Level Monitoring and Alerting System

Chapter 7
CONCLUSIONS AND SCOPE FOR FUTURE
WORK
Although this project, has tried to address the challenges of the continuous stress detection
and develop a practical real-time stress monitoring system, there are still some points that
might be interesting for further studies.

Generally, one of the limitations of the physiological modeling studies is the issue of
generalization of the obtained results. It means that in such studies, there are some factors
that may affect the achieved results such as sensor types, testing conditions, health
background of subjects, and dataset attributes. In this situation, choosing a large dataset can
help to resolve the issue.

The final model of the project is able to send the normal health and stress level condition
messages to an individual’s mobile phone who is wearing the device. The prototype utilizes
an Arduino Uno controller , Bp, SpO2, GSR and One wire Temperature sensors, Esp8266
wifi module, GSM module .

The Bp, SpO2, GSR and One wire Temperature sensors pick up the continuous regular
values and sends it to the telegram via the Esp8266 wifi module.

Only the stress level conditions and values are sent as a sms via the GSM module.

The future works of this project is converting the prototype into a real-time wearable
device.

Department of ECE, CMRIT, Bangalore 2023-24 30


Cognitive Real Time Stress Level Monitoring and Alerting System

REFERENCES
[1] IEEE Access: https://ieeexplore.ieee.org/document/9445082, A Review on Mental
Stress Detection Using Wearable Sensors and Machine Learning Techniques.

[2] MDPI: https://doi.org/10.3390/s22218135, Stress Monitoring Using Wearable Sensors:


A Pilot Study and Stress-Predict Dataset.

[3] MDPI: doi:10.3390/s19081849, Continuous Stress Detection Using Wearable Sensors


in Real Life: Algorithmic Programming Contest Case Study.

[4] IEEE: https://doi.org/10.29042/2020-10-2-161-167, IOT Based Stress Detection and


Health Monitoring System.

[5] IEEE: https://ieeexplore.ieee.org/document/8571973, A Study on the Development of


a Day-to-Day Mental Stress Monitoring System using Personal Physiological Data

[6] IEEE: https://ieeexplore.ieee.org/document/7819288, Wearable stress monitoring


system using multiple sensors.

[7] IEEE: https://ieeexplore.ieee.org/document/8073612, Design of low-cost, wearable


remote health monitoring and alert system for elderly heart patients.

[8] IEEE: https://ieeexplore.ieee.org/document/7995411, Stress influence on drivers


identified by monitoring galvanic skin resistance and heart rate variability.

Department of ECE, CMRIT, Bangalore 2023-24 31

You might also like