Beruflich Dokumente
Kultur Dokumente
B.Tech Project
Department of Electrical Engineering
Indian Institute of Technology, Kharagpur
Submitted to
Submitted by
Prof. A. Routray
Professor,
The department of Electrical Engineering
Indian Institute of Technology, Kharagpur
CERTIFICATE
This is to certify that the report entitled, Intelligent control of an Ac
compressor based on sleep stage detection for energy saving submitted by
Mr. Abhishek Kumar Agrawal to Indian Institute of Technology, Kharagpur,
for 4th year BTP work, is a record of bonafide project work carried out by him
under my supervision and guidance.
__________________
Prof. Aurobinda Routray
Date:
ACKNOWLEDGEMENT
I take the opportunity to express my reverence to my supervisor Prof. Aurobinda
Routray for his guidance, inspiration and innovative technical discussion during
the course of this project. His perpetual energy and enthusiasm in research has
motivated us. In addition, he was always accessible and willing to help in this
project.
I would also like to thank Mr. Laxmi Kant Tiwari for his support, who always
found time between his busy research schedules to help me when stuck at any
problem.
I would also like to extend my gratitude to all the professors for their contribution
in my studies and research work. They have been great source of inspiration for
me.
Last but not the least I would like to thank my parents, who taught the value of
hard work by their own example.
Index
Sl. No.
Content name
Page No.
Certificate by supervisor
Introduction
Objective
6-7
Algorithm development
7-12
7-8
8-9
9-12
13-16
13-14
15
Hardware selection
16
16
5.2 Microphone
16
16
Prototype developed
17-19
Image Sources
20
References
20
1. Introduction:
Now days there is significant increase in number of Ac sleeping rooms and energy demand by
them has been increased in proportion. It seems that this trend will be in future as well and
requirement of energy will be increasing.
Compressor is the heart of any air conditioning system and a major player in total
energy consumption. As a person goes to bed he leaves Ac on and it will be keeping the room
temperature at reference temperature whole night with the help of compressor, which is not
needed. In night a person goes through sleep cycle many times. A sleep cycle consists of NREM
(non-rapid eye movement) sleep stage 1-2-3-4, and REM (rapid eye movement) stage.
As a person is in stage 2, 3, 4, of NREM sleep, chances of his waking up due to little variation
in room temperature is very less, so compressor can be switched of leaving the room
temperature to fluctuate with variation in surrounding temperature. But if he in stage 1 of
NREM or REM he may wake up due to changed room temperature and its chances are high so
compressor should be switched on in this stage. So, using the information of sleep stages of
person, on and off state of Ac compressor can be controlled intelligently and unnecessary
consumption of energy can be reduced.
2. Objective:
Key of this control is sleep stage detection on which further decision will be made.
There are many methods for detecting sleep stages mainly based on EEG signal, heart rate and
respiratory rate. EEG based sleep stage detection is standard but costly and of contact type.
Heart rate based sleep stage detection is also of contact type and person need to wear some
special devices. In case of respiratory rate based methods thermistor is widely used to get
respiratory rate but it is also of wearable type. Microphone based respiratory rate counter can
be used as noncontact type with proper placement and highly sensitive microphone but problem
with highly sensitive microphone is that it will capture surrounding noise as well.
In our case microphone based technique has been used with active noise cancellation technique
to minimize the effect of surrounding noise. In nutshell our goal is to develop a respiratory
rate counter based sleep stage detector and establish a wireless link for data transfer.
3. Algorithm Development:
3.1.
System Overview:
Fig2. 3.1.1
3.2.
Fig. 3.2.1
7
Fig. 3.2.2
Fig. 3.2.1 shows the breath signal and Fig. 3.2.2 shows its frequency transformation.
1024 point fft has been found using MATLAB fft command.
3.3.
Fig3. 3.3.1
Fig. 3.3.1 shows the schematic for active noise cancellation technique. Signal s(k) is
breath+ noise recorded by signal microphone and n(k) is the noise recorded by reference
microphone. A 2nd order LMS based adaptive filter outputs signal y(k) which should be
ideally equal to noise content in s(k). Difference of s(k) and y(k) is error signal e(k)
which is final output and should be nearly same as original breath signal. Depending
upon e(k) further update of weight W(k) will be done.
8
Equations are
x(k) = [n(k-1),n(k)]
y(k)= W(k)x(k)
e(k)=d(k)-y(k)
W(k+1)=W(k)+2 ex(k)
Fig. 3.3.2
Fig. 3.3.2 shows the result of LMS based active noise cancellation algorithm. Top signal
is breath + noise signal s(k), middle one is noise signal n(k) and bottom one is final
output e(k) of the system.
3.4.
Looking at Fig. 3.4.2 it can be found that contribution of frequencies above 0.2 is very
small. So by using a low pass filter of cutoff near 0.2 , high fluctuation from windowed
absolute sum can be removed. An IIR Butterworth filter has been designed using
impulse invariance method.
Fig. 3.4.1
Fig. 3.4.2
10
Filter specification
p = 0.15, s=0.25, amax=0.9, amin=0.1
required order of filter = 6, c=0.1918
Transfer function of designed filter
0.01747
H(z) = ----------------------------------------------------------------------------------------------------1 - 3.651 z-1 + 5.856 z-2 - 5.201 z-3 + 2.678 z-4 - 0.7538 z-5 + 0.09028 z-6
Fig. 3.4.3
11
Fig. 3.4.4
Fig 3.4.3 shows the pole-zero position and Fig 3.4.4 shows the magnitude and phase
plot of the designed filter.
This filter has been used to smoothen windowed absolute sum and result is shown in
The Fig 3.4.5
Fig. 3.4.5
Now by counting number of peaks above a threshold i.e. by getting the number of most
dominant peaks respiratory rate can be estimated.
12
Start
N%2
Stop the
respiratory rate
counter and
keep waiting for
N=1
1
Call respiratory rate counter function, get the
Breathe count for last minute
Fig. 4.2.1
N= Number of times external switch has been pressed.
Sampling frequency = 2 KHz
Window size = 100
For 1 minute data number of windows = 1200
13
Start
Local count = 0;
Count = 0;
Accumulator = 0;
Windowed abs sum [] =0
No
Timer
interrupt
?
Yes
Yesand again start ADCs.
Collect both ADCs data, clear timer interrupt
Call LMS algorithm to get estimated value of signal from above two data.
Add estimated value to Accumulator, and increase local count by 1. Check if
local count =100. If yes set local count =0, update count index data of
windowed abs sum by accumulator, increase count by 1 and reset
accumulator to 0.
No
Is
Count
=1200
Yes
Call LPF function to smoothen windowed
abs sum data
Call dominant peak counter to get
respiratory rate
4.2.
15
5. Hardware selection:
5.1.
Development Board:
ST microelectronics ARM cortex M4 based STM32F4 Discovery board has been
chosen for implementation and testing.
Fig4. 5.1
5.2.
Microphone:
Analog Devices ADMP401 analog microphone has been used for this.
Operating Voltage 3V
Output offset
0.8V
Sensitivity
0.01V/Pa
5.3.
Wi-Fi module:
Esp8266 version 1 Wi-Fi module has been used
Wireless SoC running at 80MHz
Wi-Fi 2.4 GHz,
TCP-IP protocol stack
Low power 32 bit MCU
Standby power consumption <1mW
Fig6. 5.3
16
6. Developed Prototyped:
Fig. 6.1
Extension to be connected with Development board for interfacing microphone, Wi-Fi module,
switch. 7 segment display is used for debugging.
Fig. 6.2
To be connected on AC side for generating control signal and hosting server for data transfer.
17
Fig. 6.3
Main Activity for configuring server address, connecting, reading and deleting stored data
Fig. 6.4
Activity which render the received data on a plot. Above plot is just simulation and is not
actual sleep data. .
18
Fig 6.
19
7. Image sources:
Fig 1.1
Fig 3.3.1
Fig 5.1
Fig 5.2
Fig 5.3
www.nwbotanicals.org
www.iro.umontreal.ca
galeria.tech-blog.pl/
www.sparkfun.com
www.espduino.com
8. References:
1. www.iro.umontreal.ca/~mignotte/IFT3205/APPLETS/AdaptiveSignalProcessing
/AdaptiveSignalProcessing.html
2. www:github.com/nodemcu
3. STM32F4 reference manual
20
END
21